Windows 7 / Security and Privacy
.exe files are not the only executables you can control with AppLocker. You can also control scripts (PowerShell and Visual Basic scripts), packaged apps and their installers, DLLs, and Windows Installer files (.msi). Packaged app rules in AppLocker are available in versions of Windows with apps (Windows 8 / Server 2012 and higher). It is typically deployed through Group Policy either on a single computer or across a domain.
This feature is similar to (but not exactly the same as) other Mandatory Access Control (MAC) measures in Linux such as SELinux and AppArmor.
To get started, open Group Policy Management (Start > Run > gpmc.msc or hit the Windows key and start typing Group Policy). Right click the organizational unit (OU) that you want to apply AppLocker policies to. In this case, we will use the Workstations OU we defined previously. Click 'Create a GPO in this domain, and Link it here':
Give your GPO a name. I will call our example 'Workstations AppLocker Policy'
Right click your newly created GPO and click Edit. AppLocker configuration is under Computer Configuration > Windows Settings > Security Settings > Application Control Policies > AppLocker.
First, we will create a default set of rules for each aspect of application configuration that is available to us. The defaults are not sufficient to have a robust AppLocker configuration. They are meant as a place to start, not to end. Like any defense measure, you should always tailor the configuration to your environment. The defaults are well known and can be bypassed.
We will start with Executable Rules. Expand the AppLocker section by click the little arrow next to it. Then click Executable Rules. In that window, right click anywhere and choose Create Default Rules:
You can see that there were three rules created by default:
AccessEnum will enumerate all of the permissions on a given directory and its subdirectories. We can then save the output and use a program like LibreOffice Calc or Excel to filter down to the permissions that we care about. Essentially, we are looking for any folder that has write permissions for Users or Authenticated Users.
The picture above comes from a Windows 8.1 Enterprise machine. We found one directory where Authenticated Users have write permissions: C:WindowsTasks. With the default AppLocker rules that we created above, a user could copy an executable to this directory and run it because all executables under C:Windows can run. That includes subdirectories. In fact, C:WindowsTasks is one folder that is often cited as a way to bypass default AppLocker permissions. However, there are others. I hit the Save button in AccessEnum and opened the resulting text file in LibreOffice. I then filtered on the Write column for anything that had Users or Authenticated Users, and this is what I found:
Here are the paths for easier copy / paste:
To do this, right click on the policy that says all programs in the Windows folder are allowed to run, click Edit, and then click the Exceptions tab:
For each path, click Add and type or copy / paste the paths we identified above (or ones that you identified):
When you are done, click OK. You can use AccessEnum for other directories you are worried about. In my environment, there were no user writable folders in either C:Program Files or C:Program Files (x86)
We will work through one more example. We will only allow signed applications to be run. This might not work for your environment, but it will stop a whole class of malware that is unsigned. This does not stop malware completely though, because even when only signed executables can run, the following could happen:
To create the rule, right click Executable Rules then click Create New Rule. The Executable Rule Wizard will pop up:
Click Next
We are writing a rule that only allows signs executables to run. This rule will apply to everyone. We will keep the two options shown here because we cannot say Deny unsigned executables to run. Rather, we have to say that only signed executables are allowed to run. Click Next.
Since we want to work with signatures and not paths or hashes, we will click Next here.
We have to provide a signed file. The publisher is not important because we are going to adjust it to allow any publisher. I chose write.exe under C:Windows. Then, slide the slider up to Any Publisher.
If we wanted to restrict our rule to certain properties of the signature, such as Publisher or Product name we could do it here by supplying a reference file (a file signed in the way we want this rule to apply). We are not going to do that because we are okay with all signed executables running.
When you click Next, you can define exceptions to the rule.![Applocker 2 7 0 32 mm Applocker 2 7 0 32 mm](https://techcommunity.microsoft.com/t5/image/serverpage/image-id/86577iC7059EDFDF2822A2/image-size/large?v=1.0&px=999)
We do not have any, so click Next.
You can give your new rule a name. I called it 'Only allow signed executables'
Finally, click Create. You will see your new rule in the right pane.
Now we need to enforce the rules. There are two things we need to do. First, we have to enable the Application Identity Service to load Automatically. To do that, click System Services under Computer Configuration > Policies > Windows Settings > Security Settings.
Then click OK. Now we have to set the rules to enforced. To do that, click on AppLocker under Computer Configuration > Windows Settings > Security Settings > Application Control Policies.
Then click Configure Rule Enforcement on the right side:
Click the check box next to Configured under Executable rules. We have not defined any other types of rules, so we will leave those alone. You could choose to put the rules in Audit Only mode which means that only logs will be generated instead of actually blocking executables. This is good if you want to test your rules before deploying them. We live on the edge, so we will leave this at Enforced. Click OK.
Before we apply the Group Policy settings on the machine, let's try to run an evil Hello World program on our domain-connected client:
Oh no! We cannot let this happen! When we apply the group policy (restarting the computer is easiest), this is what happens when we try to run the same program:
Awesome. We saved our network from that evil program.
In the path box, enter %HOT%. %HOT% is the variable for removable drives. There are other variables you can use, all listed here. You can also use %REMOVABLE% to restrict access to executables on removable media like CDs.
AppLocker is another tool for your defensive toolbox. Like just about every other network security measure, it takes configuration and maintenance to be effective. The default rules will not cut because they can be easily bypassed as we saw with writable directories in the Windows folder. However, if you take the time to build a comprehensive rule set, AppLocker may help mitigate some of the vulnerabilities in your network.
References
AppLocker Policies Deployment Guide
Working with AppLocker Rules
Start studying chapters 1 and 2. Learn vocabulary, terms, and more with flashcards, games, and other study tools. The first true 32-bit operating system developed. Requirements to Use AppLocker.; 2 minutes to read; In this article.
Some IT departments choose to control which applications users can run. Sometimes, administratorssimply block specific applications that are known to be problematic. However, clientsecurity benefits more when administrators block all applications that IT has not approved.
The benefits of restricting users from running applications that are not approved can beimmense. First, the risk of malware is significantly reduced, because Windows would preventusers from running the malware application because it had not been approved by IT. Second,compatibility problems are reduced, because users can only run approved versions of applications.Finally, user productivity is increased by eliminating the possibility that users couldrun games or other applications that might take time away from their work.
Restricting users from running applications does have significant costs, however, andfor many organizations, those costs outweigh the benefits. IT has to test each applicationand create a rule that allows users to run it. Inevitably, users will be prevented from runninglegitimate applications, which can reduce their productivity while they wait for IT to approvea new application. Sometimes, users will choose to work around IT by running applications onnon-IT computers. Each time an application is updated, IT needs to again test and approvethe application.
Windows 7 includes AppLocker, which is an update to Software Restriction Policies, a featurein earlier versions of Windows. With Software Restriction Policies, IT professionals couldcreate rules such as 'Trust all content signed by Microsoft,' 'Trust this single executable file,'or 'Trust the file at this path.' With AppLocker, IT professionals can create more refined rulesbased on an application's metadata, such as 'Trust Microsoft Office if it is signed and the versionis greater than 12.0.0.0.' Additionally, AppLocker rules can be assigned on a per-groupand per-user basis.
Templates for excel by gn 4 0. Table lists the differences between Software Restriction Policies and AppLocker
Software Restriction Policies Compared to AppLocker
Feature | Software Restriction Policies | Applocker |
Conditions | Hash, path, certificate, registry path, and Internet zone | Hash, path, and publisher |
Rule scope | All users | All users, or specific users and groups |
Audit-only mode | No | Yes |
Automatically generate rules | No | Yes |
Policy import and export No | No | Yes |
Windows PowerShell support | No | Yes |
Custom error messages | No | Yes |
AppLocker is available only in Windows 7 Enterprise and Windows 7 Ultimate Editions. Youcan use Windows 7 Professional Edition to create AppLocker rules, but the rules will not beenforced on the computer running Windows 7 Professional. You must configure the ApplicationIdentity service to start for Windows 7 to apply AppLocker rules; by default, it is configured tostart manually.
The sections that follow provide more detailed information about how to configure, test,and manage AppLocker.
In this tutorial:
Hey everyone - Today, we are going to talk about AppLocker. We will start with a discussion of what it is. Then, we will talk about why you would want to use it. Finally, we will talk about how to use it. More after the jump..What is AppLocker?
AppLocker is a mechanism in Windows for controlling access to applications. It does this based on a set of rules defined by the administrator of the domain or computer. These rules are defined on aspects of the application (usually based on its digital signature) and who is trying to use it. On the client side, AppLocker was introduced with Windows 7. On the server side, it was introduced in Windows Server 2008 R2. Different versions of Windows allow you to do different things with AppLocker. As a rule of thumb, on the client side, you need at least the Pro version of Windows (Pro, Enterprise, Ultimate). A full chart is available here..exe files are not the only executables you can control with AppLocker. You can also control scripts (PowerShell and Visual Basic scripts), packaged apps and their installers, DLLs, and Windows Installer files (.msi). Packaged app rules in AppLocker are available in versions of Windows with apps (Windows 8 / Server 2012 and higher). It is typically deployed through Group Policy either on a single computer or across a domain.
This feature is similar to (but not exactly the same as) other Mandatory Access Control (MAC) measures in Linux such as SELinux and AppArmor.
Why Would You Want To Use It?
AppLocker is not intended to be the only defense mechanism you employ in your organization. As we talked about with EMET, it is meant to be one layer in a multi-layer defense. AppLocker is good when you want relatively granular control over which applications are allowed to run in your network. You might want to use AppLocker to only allow applications signed by trusted publishers (like your internal developers or organizations you have a relationship with).How Do I Use It?
The examples we will work through today are in our test domain that we built a little while back. If you have an appropriate version of Windows with AppLocker, you can implement it through Local Group Policy. The idea is the same.To get started, open Group Policy Management (Start > Run > gpmc.msc or hit the Windows key and start typing Group Policy). Right click the organizational unit (OU) that you want to apply AppLocker policies to. In this case, we will use the Workstations OU we defined previously. Click 'Create a GPO in this domain, and Link it here':
Give your GPO a name. I will call our example 'Workstations AppLocker Policy'
Right click your newly created GPO and click Edit. AppLocker configuration is under Computer Configuration > Windows Settings > Security Settings > Application Control Policies > AppLocker.
First, we will create a default set of rules for each aspect of application configuration that is available to us. The defaults are not sufficient to have a robust AppLocker configuration. They are meant as a place to start, not to end. Like any defense measure, you should always tailor the configuration to your environment. The defaults are well known and can be bypassed.
We will start with Executable Rules. Expand the AppLocker section by click the little arrow next to it. Then click Executable Rules. In that window, right click anywhere and choose Create Default Rules:
You can see that there were three rules created by default:
- Everyone can execute anything in Program Files
- Everyone can execute anything in the Windows folder
- Administrators can execute anything
AccessEnum will enumerate all of the permissions on a given directory and its subdirectories. We can then save the output and use a program like LibreOffice Calc or Excel to filter down to the permissions that we care about. Essentially, we are looking for any folder that has write permissions for Users or Authenticated Users.
Applocker 2 7 0 32 Gb
The picture above comes from a Windows 8.1 Enterprise machine. We found one directory where Authenticated Users have write permissions: C:WindowsTasks. With the default AppLocker rules that we created above, a user could copy an executable to this directory and run it because all executables under C:Windows can run. That includes subdirectories. In fact, C:WindowsTasks is one folder that is often cited as a way to bypass default AppLocker permissions. However, there are others. I hit the Save button in AccessEnum and opened the resulting text file in LibreOffice. I then filtered on the Write column for anything that had Users or Authenticated Users, and this is what I found:
Here are the paths for easier copy / paste:
- C:WindowsTasks
- C:WindowsdebugWIA
- C:WindowsSystem32Tasks
- C:WindowsSysWOW64Tasks
- C:Windowstracing
- C:WindowsSystem32LogFilesWUDF
- C:WindowsRemotePackages
- C:WindowsRegistrationCRMLog
To do this, right click on the policy that says all programs in the Windows folder are allowed to run, click Edit, and then click the Exceptions tab:
For each path, click Add and type or copy / paste the paths we identified above (or ones that you identified):
When you are done, click OK. You can use AccessEnum for other directories you are worried about. In my environment, there were no user writable folders in either C:Program Files or C:Program Files (x86)
We will work through one more example. We will only allow signed applications to be run. This might not work for your environment, but it will stop a whole class of malware that is unsigned. This does not stop malware completely though, because even when only signed executables can run, the following could happen:
- If a trusted publisher's signing certificate is compromised, someone could sign malicious binaries with it (either an insider or an intruder).
- If someone is able to install a root certificate on a box, they could sign arbitrary software with it.
- If there is some vulnerability in a signed application, it could be exploited to run other executable code (i.e. from memory). AppLocker does not act on executables that are solely in memory.
To create the rule, right click Executable Rules then click Create New Rule. The Executable Rule Wizard will pop up:
Click Next
We are writing a rule that only allows signs executables to run. This rule will apply to everyone. We will keep the two options shown here because we cannot say Deny unsigned executables to run. Rather, we have to say that only signed executables are allowed to run. Click Next.
Since we want to work with signatures and not paths or hashes, we will click Next here.
We have to provide a signed file. The publisher is not important because we are going to adjust it to allow any publisher. I chose write.exe under C:Windows. Then, slide the slider up to Any Publisher.
If we wanted to restrict our rule to certain properties of the signature, such as Publisher or Product name we could do it here by supplying a reference file (a file signed in the way we want this rule to apply). We are not going to do that because we are okay with all signed executables running.
When you click Next, you can define exceptions to the rule.
We do not have any, so click Next.
You can give your new rule a name. I called it 'Only allow signed executables'
Finally, click Create. You will see your new rule in the right pane.
Now we need to enforce the rules. There are two things we need to do. First, we have to enable the Application Identity Service to load Automatically. To do that, click System Services under Computer Configuration > Policies > Windows Settings > Security Settings.
Applocker 2 7 0 32 +
Double click Application Identity, click Define This Policy Setting, then click Automatic:Then click OK. Now we have to set the rules to enforced. To do that, click on AppLocker under Computer Configuration > Windows Settings > Security Settings > Application Control Policies.
Then click Configure Rule Enforcement on the right side:
Click the check box next to Configured under Executable rules. We have not defined any other types of rules, so we will leave those alone. You could choose to put the rules in Audit Only mode which means that only logs will be generated instead of actually blocking executables. This is good if you want to test your rules before deploying them. We live on the edge, so we will leave this at Enforced. Click OK.
Before we apply the Group Policy settings on the machine, let's try to run an evil Hello World program on our domain-connected client:
Oh no! We cannot let this happen! When we apply the group policy (restarting the computer is easiest), this is what happens when we try to run the same program:
Awesome. We saved our network from that evil program.
Applocker 2 7 0 32 Mm
There is another good rule you can set up. Suppose a user brings in a USB from home, and without their knowledge, an executable on it is malicious. We can use AppLocker to stop programs from running from removable media. Here is how. When you create a rule, make a new Deny rule, and choose Path as the condition.In the path box, enter %HOT%. %HOT% is the variable for removable drives. There are other variables you can use, all listed here. You can also use %REMOVABLE% to restrict access to executables on removable media like CDs.
Conclusions and Final Thoughts
AppLocker is another tool for your defensive toolbox. Like just about every other network security measure, it takes configuration and maintenance to be effective. The default rules will not cut because they can be easily bypassed as we saw with writable directories in the Windows folder. However, if you take the time to build a comprehensive rule set, AppLocker may help mitigate some of the vulnerabilities in your network.
References
Applocker 2 7 0 32 Bit
AppLocker OverviewAppLocker Policies Deployment Guide
Working with AppLocker Rules