DEPLOYING WINDOWS 10 APPLICATION CONTROL POLICY
Published Jun 25 2021 12:40 PM 25.1K Views
Microsoft

WDAC.gif

 

Dear IT Pros,

Today we discuss about All things about WDAC – Windows Defender Application Control.

WDAC was introduced with Windows 10 and could be applied to Windows server 2016 and later, its older name is Configurable Code Integrity (CCI). WDAC allows organizations to control which drivers and applications are allowed to run on devices.

  • Windows Server 2016/2019 or anything before version 1903 only support legacy policies (aka 1 policy in place)
  • Windows Server Core edition does support WDAC but some components that depends on AppLocker won’t work

WDAC policies apply to the managed computer as a whole and affects all users of the device. WDAC rules can be defined based on:

  • Attributes of the codesigning certificate(s) used to sign an app and its binaries
  • Attributes of the app's binaries that come from the signed metadata for the files, such as Original Filename and version, or the hash of the file
  • The reputation of the app as determined by Microsoft's Intelligent Security Graph
  • The identity of the process that initiated the installation of the app and its binaries (managed installer)
  • The Folder or File path from which the app or file is launched (beginning with Windows 10 version 1903)
  • The process that launched the app or binary

Multiple Policies and Supplemental Policy.

Beginning with Windows 10 version 1903, Windows server 2022, WDAC supports up to 32 active policies on a device at once. The following scenarios are supported:

  • Enforce and Audit Side-by-Side
  • Multiple Base Policies, users can enforce two or more base policies simultaneously in order to allow simpler policy targeting for policies with different scope/intent.
  • If two base policies exist on a device, an application has to be allowed by both to run
  • Supplemental Policies, users can deploy one or more supplemental policies to expand a base policy. For supplemental policies, applications that are allowed by either the base policy or its supplemental policy/policies are allowed to run

PLANNING.

Implementing application control can have unintended consequences, plan your deployment carefully.

  • Decide what devices you will manage with WDAC and split them into deployment rings: Test, UAT and Prod ring, so you can control the scale of the deployment and respond if anything goes wrong.
  • All WDAC policy changes should be deployed in audit mode before proceeding to enforcement. Carefully monitor events from devices where the policy has been deployed to ensure the block events you observe match your expectation before broadening the deployment to other deployment rings.
  • If your organization uses Microsoft Defender for Endpoint, you can use the Advanced Hunting feature to centrally monitor WDAC-related events. Otherwise, we recommend using an event log forwarding solution to collect relevant events from your managed endpoints.
  • Leverage medatada in the policies (version, policyID, description, etc) to keep track of which policies applied to what group of devices in production.

Options For WDAC Policy Creation:

The creation of an WDAC Policy depends on the level of restriction you may want to apply to your target devices. You could start with a pre-built template of Windows 10:

Level of Restriction

Template to be used (C:\Windows\schemas\CodeIntegrity\ExamplePolicies)

Allowed All Applications

AllowAll.xml

Allowed All Enabled HVCI

AllowAll_EnableHVCI.xml   (Enable Hypervisor-Code-Integrity in Memory)

Allowed All Microsoft Applications

AllowMicrosoft.xml

Allowed All Microsoft and Good Reputation Applications

DefaultWindows_Enforced.xml   or

DefaultWindows_Audit.xml

Deny All Applications but the one you choose

DenyAllAudit.xml

Other pre-built .xml template for Application or Script Control

Allowed Application deployed by Microsoft Endpoint Configuration Manager (MECM).

WDAC Policy deployed to Clients at directory location:

%OSDrive%\Windows\CCM\DeviceGuard

 

Device Guard Signing Service (DGSS) DefaultPolicy.xml

Including the rules from DefaultWindows and adds rules to trust apps signed with your organization-specific certificates issued by the DGSS version 2

 

  • You could use WDAC Wizard to view and customize the allow or deny rules applied to different applications.
  • Every WDAC policy is created with audit mode enabled by default. After you have successfully deployed and tested a WDAC policy in audit mode and are ready to test the policy in enforced mode, use WDAC Wizard to turn off Audit mode this will make the WDAC Policy become Enforced mode. You also could use command in an elevated Windows PowerShell session to make WDAC Policy in Enforced mode:
    • Ensure that rule options 9 (“Advanced Boot Options Menu”) and 10 (“Boot Audit on Failure”) are set the way that you intend for this policy. We strongly recommend that you enable these rule options before you run any enforced policy for the first time. Enabling these options provides administrators with a pre-boot command prompt and allows Windows to start even if the WDAC policy blocks a kernel-mode driver from running. When ready for enterprise deployment, you can remove these options.
    • To ensure that these options are enabled in a policy, use Set-RuleOption as shown in the following commands. You can run these commands even if you're not sure whether options 9 and 10 are already enabled—if so, the commands have no effect.

> Set-RuleOption -FilePath InitialCIPolicy -Option 9

> Set-RuleOption -FilePath InitialCIPolicy -Option 10                         

  •  Copy the initial file to maintain an original copy:

> copy InitialCIPolicy.xml EnforcedCIPolicy.xml

  • Use Set-RuleOption to delete the audit mode rule option:

> Set-RuleOption -FilePath EnforcedCIPolicy.xml -Option 3 -Delete

 Note

To enforce a WDAC policy, you delete option 3, the Audit Mode Enabled option. There is no “enforced” option in a WDAC policy.

> ConvertFrom-CIPolicy EnforcedCIPolicy.xml EnforcedCIPolicy.bin

  • Now that this policy is in enforced mode, you can deploy it to your test computers. Rename the policy to SIPolicy.p7b and copy it to C:\Windows\System32\CodeIntegrity for testing, or deploy the policy through Group Policy by following the instructions in Deploy and manage Windows Defender Application Control with Group Policy. You can also use other client management software to deploy and manage the policy.
  • Windows Defender Application Control policy - policy rule options

WDAC - policy rule options

 

Rule option

Description

WDAC Wizard Icon

0 Enabled:UMCI

WDAC policies restrict both kernel-mode and user-mode binaries. By default, only kernel-mode binaries are restricted. Enabling this rule option validates user mode executables and scripts.

 

TanTran_56-1624634198607.png

 


 

1 Enabled:Boot Menu Protection

This option is not currently supported.

 

2 Required:WHQL

By default, legacy drivers that are not Windows Hardware Quality Labs (WHQL) signed are allowed to execute. Enabling this rule requires that every executed driver is WHQL signed and removes legacy driver support. Kernel drivers built for Windows 10 should be WHQL certified.

 

TanTran_57-1624634236178.png

 


 

3 Enabled:Audit Mode (Default)

Instructs WDAC to log information about applications, binaries, and scripts that would have been blocked if the policy was enforced. You can use this option to identify the potential impact of your WDAC policy, and use the audit events to refine the policy before enforcement. To enforce a WDAC policy, delete this option.

 

TanTran_4-1624632547867.png

 

4 Disabled:Flight Signing

If enabled, WDAC policies will not trust flightroot-signed binaries. This option would be used by organizations that only want to run released binaries, not pre-release Windows builds.

 

TanTran_58-1624634321815.png

 


 

5 Enabled:Inherit Default Policy

This option is reserved for future use and currently has no effect.

 

6 Enabled:Unsigned System Integrity Policy (Default)

Allows the policy to remain unsigned. When this option is removed, the policy must be signed and the certificates that are trusted for future policy updates must be identified in the UpdatePolicySigners section.

 

TanTran_6-1624632547868.png

 

7 Allowed:Debug Policy Augmented

This option is not currently supported.

 

8 Required:EV Signers

This rule requires that drivers must be WHQL signed and have been submitted by a partner with an Extended Verification (EV) certificate. All Windows 10 and later drivers will meet this requirement.

 

TanTran_7-1624632547868.png

 

9 Enabled:Advanced Boot Options Menu

The F8 preboot menu is disabled by default for all WDAC policies. Setting this rule option allows the F8 menu to appear to physically present users.

 

TanTran_8-1624632547869.png

 

10 Enabled:Boot Audit on Failure

Used when the WDAC policy is in enforcement mode. When a driver fails during startup, the WDAC policy will be placed in audit mode so that Windows will be able to load at boot.

TanTran_9-1624632547869.png

 

11 Disabled:Script Enforcement

This option disables script enforcement options. Unsigned PowerShell scripts and interactive PowerShell are no longer restricted to Constrained Language Mode. NOTE: This option is supported on 1709, 1803, and 1809 builds with the 2019 10C LCU or higher, and on devices with the Windows 10 May 2019 Update (1903) and higher. Using it on versions of Windows 10 without the proper update may have unintended results.

 

TanTran_10-1624632547870.png


 

12 Required:Enforce Store Applications

WDAC policies will also apply to Universal Windows applications. (Microsoft Store App)

TanTran_11-1624632547870.png

 

13 Enabled:Managed Installer

Use this option to automatically allow applications installed by a managed installer. For more information, see Authorize apps deployed with a WDAC managed installer

 

TanTran_12-1624632547870.png

 

14 Enabled:Intelligent Security Graph Authorization

Use this option to automatically allow applications with "known good" reputation as defined by Microsoft’s Intelligent Security Graph (ISG).

 

TanTran_13-1624632547871.png

 

15 Enabled:Invalidate EAs on Reboot

When the Intelligent Security Graph option (14) is used, WDAC sets an extended file attribute that indicates that the file was authorized to run. This option will cause WDAC to periodically revalidate the reputation for files that were authorized by the ISG upon Windows reboot.

 

TanTran_14-1624632547871.png

 

16 Enabled:Update Policy No Reboot

Use this option to allow future WDAC policy updates to apply without requiring a system reboot. NOTE: This option is only supported on Windows 10, version 1709, and above.

 

TanTran_15-1624632547872.png

 

17 Enabled:Allow Supplemental Policies

Use this option on a base policy to allow supplemental policies to expand it. NOTE: This option is only supported on Windows 10, version 1903, and above.

 

TanTran_16-1624632547872.png

 

18 Disabled:Runtime FilePath Rule Protection

This option disables the default runtime check that only allows FilePath rules for paths that are only writable by an administrator. NOTE: This option is only supported on Windows 10, version 1903, and above.

 

TanTran_17-1624632547872.png

 

19 Enabled:Dynamic Code Security

Enables policy enforcement for .NET applications and dynamically loaded libraries. NOTE: This option is only supported on Windows 10, version 1803, and above.

 

TanTran_59-1624634587559.png

 


 

 

USING WDAC WIZARD TO CREATE POLICY

Steps to proceed with creating the WDAC Policy by Wizard:

  • Download WDAC Wizard and install it.

The WDAC Wizard has 3 options for creating, modifying or merge 2 WDAC policies as shown here:

TanTran_19-1624632547874.png

  • Create WDAC policy by Wizard

You could create single base policy or multiple base policy or supplemental policies.

TanTran_20-1624632547892.png

 

  • Launch the WDAC Wizard and choose Single Policy Format
  • Choose the Template named “Signed and Reputable Mode” for Microsoft and 3rd party Vendor Applications.
  • Typing name for WDAC policy and directory location as shown:

TanTran_21-1624632547895.png

 

  • Choose the option for policy:

TanTran_22-1624632547907.png

 

  • Next, Adding Custom rule,
    • Rule type: Choose how to identify the application by publisher name, by path to application executable file or folder, by File attributes, by Packaged App, by File

Hash:

TanTran_23-1624632547907.png 

- Custom Rule by Publisher:

Enter the executable file of the related Publisher for the Wizard to collect the Publisher Sign in Code:

TanTran_24-1624632547910.png

- Custom Rule by File Attribute

Checking the box “Use Custom Values” and Use the glider to choose the attribute as shown here

TanTran_25-1624632547914.png

- Custom Rule by Package App (UWP)

Packaged apps, also known as Universal Windows apps, are based on a model that ensures all the files within an app package share the same identity.

 

* To get a list of packaged apps run on a device, run command: 

> Get-AppxPackage | ft

 

TanTran_26-1624632547957.png

 

>  Typing the Package Name to the Wizard under “Package Name” and click Search button as shown:

 

TanTran_27-1624632547960.png

       -  Custom Rule by File Hash

You could add multiple file hash separated by comma with Custom rule or use the browser button and specify the file:

TanTran_28-1624632547964.png

 

      -  Custom Rule by Folder Path or File Path:

TanTran_29-1624632547976.png

 

  • Create Rule

TanTran_30-1624632547998.png

  • Make sure to let WDAC Wizard to create the binary file if you need it in Settings – “Convert policy to binary after xml creation” as shown in the following:

TanTran_31-1624632548004.png

  • Next, Wizard will build the WDAC Policy in xml format. You could close the Wizard once it finishes the task.

TanTran_32-1624632548006.png

  • Run Powershell, cd to the location of WDAC Policy
  • Convert .xml policy to binary: 

> ConvertFrom-CIPolicy .\SignedReputable052621.xml SignedReputable052621.bin

TanTran_33-1624632548007.png

 

  • Applying WDAC binary policy to targeted device by GPO or Local Group Policy:

TanTran_34-1624632548043.png

 

  • Result:   After reboot the windows 10 device the first time (needed only once) for WDAC Policy to be applied. We could test the access.

To Generate new WDAC Policy from current Audit Policy

While a WDAC policy is running in audit mode, any application that runs but are supposed to be  denied according to WDAC Audit Policy, is logged in the 

Applications and Services Logs\Microsoft\Windows\CodeIntegrity\Operational event log. Script and MSI are logged in the 

Applications and Services Logs\Microsoft\Windows\AppLocker\MSI and Script event log. These events can be used to generate a new WDAC policy that can be merged with the original Base policy or deployed as a separate Supplemental policy, if allowed.

You must have already deployed a WDAC audit mode policy to use this process.

  • To generate new policy from current one by Powershell:
  1. In an elevated PowerShell session, run the following commands to initialize variables used by this procedure. This procedure builds upon the Lamna_FullyManagedClients_Audit.xml policy introduced in Create a WDAC policy for fully managed devices and will produce a new policy called EventsPolicy.xml.

PowerShell

$PolicyName= "Lamna_FullyManagedClients_Audit"

$LamnaPolicy=$env:userprofile+"\Desktop\"+$PolicyName+".xml"

$EventsPolicy=$env:userprofile+"\Desktop\EventsPolicy.xml"

$EventsPolicyWarnings=$env:userprofile+"\Desktop\EventsPolicyWarnings.txt"

  1. Use New-CIPolicy to generate a new WDAC policy from logged audit events. This example uses a FilePublisher file rule level and a Hash fallback level. Warning messages are redirected to a text file EventsPolicyWarnings.txt.

PowerShell

> New-CIPolicy -FilePath $EventsPolicy -Audit -Level FilePublisher -Fallback Hash –UserPEs -Mul

More detail here.

  • To generate new policy from current one by WDAC Wizard:
  • Run the WDAC Wizard, Policy Editor
  • Enter the Event log and click “Parse…”

TanTran_35-1624632548047.png

 

  • When get the prompt, click OK, Next

TanTran_36-1624632548048.png

 

  • Next, … and close the Wizard after policy is created.

To Create Suplemental Policy from a base policy by WDAC Wizard

  • Run WDAC Wizard from Windows Start Menu.
  • Choose Policy Creator mode
  • Click Multiple Policy Format
  • Choose Supplemental Policy
  • Browse to Supplemental Policy location
  • Browse to Base Policy location

TanTran_37-1624632548054.png

  • Next, Create policy and close the Wizard.

DEPLOYING WDAC POLICY

There are 4 ways to deploy WDAC:

      TanTran_38-1624632548056.png

 

To activate the WDAC Policy binary file to WMI repository.

  • Another option is using Github AaronLocker Script, You can easily customize rules for your specific requirements with simple text-file edits. AaronLocker includes scripts that document AppLocker and WDAC policies and capture event data into Excel workbooks that facilitate analysis and policy maintenance. AaronLocker is designed to restrict program and script execution by non-administrative users.
  • Deploying WDAC Policy by GPO for Domain’s devices.

Group Policy-based deployment of WDAC policies only supports single-policy format WDAC policies. To deploy multiple policy for Windows 10 version 1903 and later, you will need to use other deploying mechanisms.

You can copy the WDAC policies to a file share to which all computer accounts have access, e.g: \\NYCCL1\WDAC\AllowMSAppEnforcedV3.bin:

TanTran_40-1624632548064.png

 

  • Regardless of the type of policy you deploy (.bin, .p7b, or .p7), they are all converted to SIPolicy.b7p in directory Windows\System32\CodeIntegrity\ when WDAC is applied to Client Windows 10TanTran_41-1624632548066.png
  • For multiple policies, they are in {Policy GUID}.cip policy files found in the Windows\System32\CodeIntegrity\CIPolicies\Active folder once WDAC Policy is applied to Client Windows 10.

TanTran_42-1624632548068.png

 

 Deploying WDAC Policy by MECM (SCCM) for Device Collection.

An Example is shown here:

TanTran_43-1624632548089.png

 

           > Adding File or Folder path as shown here:

TanTran_44-1624632548096.png

        > Next and Close.

 

 

Deploy WDAC Policy by MDM (Intune)

Intune includes native support for WDAC which can be a helpful starting point, but customers may find the available circle-of-trust options too limiting. To deploy a custom policy through Intune and define your own circle of trust, you can configure a profile using Custom OMA-URI.

An Example:

  • OMA-URI: ./Vendor/MSFT/ApplicationControl/Policies/Policy GUID/Policy
  • Data type: Base64
  • Certificate file: upload your binary format policy file. You do not need to upload a Base64 file, as Intune will convert the uploaded .bin file to Base64 on your behalf.

TanTran_48-1624632548117.png

  • Result:

After the first reboot to apply the WDAC Policy, then, only Office 365 applications, and Allowed Applications ( Acrobat DC) are able to run. Others (like Chrome) will be blocked as shown here:

TanTran_49-1624632548120.png

 

Also, you could download and install applications but you could not run it as shown here:

 

TanTran_50-1624632548127.png

 

To Monitor WDAC Events

A Windows Defender Application Control (WDAC) policy logs events locally in Windows Event Viewer in either enforced or audit mode. These events are generated under two locations:

  • Event IDs beginning with 30 appear in Applications and Services logs – Microsoft – Windows – CodeIntegrity – Operational
  • Event IDs beginning with 80 appear in Applications and Services logs – Microsoft – Windows – AppLocker – MSI and Script

Microsoft Windows CodeIntegrity Operational log event IDs

Event ID

Explanation

3076

Audit executable/dll file

3077

Block executable/dll file

3089

Signing information event correlated with either a 3076 or 3077 event. One 3089 event is generated for each signature of a file. Contains the total number of signatures on a file and an index as to which signature it is.
Unsigned files will generate a single 3089 event with TotalSignatureCount 0. Correlated in the "System" portion of the event data under "Correlation ActivityID".

3099

Indicates that a policy has been loaded

Microsoft Windows Applocker MSI and Script log event IDs

Event ID

Explanation

 

8028

Audit script/MSI file generated by Windows LockDown Policy (WLDP) being called by the scripthosts themselves. Note: there is no WDAC enforcement on 3rd party scripthosts.

 

8029

Block script/MSI file

 

8038

Signing information event correlated with either a 8028 or 8029 event. One 8038 event is generated for each signature of a script file.

Unsigned script files will generate a single 8038 event with TotalSignatureCount 0.

 

Optional Intelligent Security Graph (ISG) or Managed Installer (MI) diagnostic events 3090, 3091, 3092

Event ID

Explanation

3090

Allow executable/dll file

3091

Audit executable/dll file

3092

Block executable/dll file

  • The SmartLocker template which appears in the event should indicate why the binary passed/failed. Only one event is generated per binary pass/fail.
  • If both ISG and MI are disabled, 3090, 3091, and 3092 events will not be generated.

Enabling ISG and MI diagnostic events

  • In order to enable 3091 audit events and 3092 block events, you must create a TestFlags regkey with a value of 0x100.
    • reg add hklm\system\currentcontrolset\control\ci -v TestFlags -t REG_DWORD -d 0x100
  • In order to enable 3090 allow events as well as 3091 and 3092 events, you must instead create a TestFlags regkey with a value of 0x300.

o    reg add hklm\system\currentcontrolset\control\ci -v TestFlags -t REG_DWORD -d 0x300

 

WDAC Tips

  • Quick WDAC Policy applied to a testing Windows 10 device without GPO or Deployment Mechanism:

        To apply the policy immediately,

           >  copy the {Policy GUID}.cip binary policy created by the WDAC Wizard location to the CodeIntergrity Active Foder in :

               Windows\System32\CodeIntegrity\CIPolicies\Active folder

TanTran_2-1624651673376.png

 

          > Reboot device after copying policy to the above folder.

 

  • To Control Application Installation – Managed Installer:
    • Specify managed installers by using the Managed Installer rule collection in AppLocker policy.
    • Enable service enforcement in AppLocker policy.
    • Enable the managed installer option in a WDAC policy.

Detailed steps as in Microsoft document “Configure a WDAC managed installer (Windows 10)

  • To prevent machine unbootable to Windows OS during WDAC testing period.

The denied rule of WDAC Policy related to system driver may cause a loss of OS on testing device.

In WDAC Wizard’ Settings, please make sure to enable “Boot Audit on Failure” feature, it will automatically switch policy mode from enforcement to audit if the system drivers failed to load due to denied rule of Policy. This will save OS from loss because of driver failure in boot procedure.

 

To prevent loss of OS :

  • On testing device, run WDAC Wizard – Policy Editor
  • Select your Policy xml file to open it
  • Policy Rules, click Advanced Options as shown here:

TanTran_0-1624652764604.png

 

 

> Click to turn on “Boot Audit on Failure”

TanTran_1-1624652797433.png

 

> Next and close the Wizard.

> In Windows\System32\CodeIntegrity\CIPolicies\Active folder, replace the old .cip policy with new cip policy and reboot the device to apply new WDAC policy.

 

  • To Generate an WDAC rule for Universal App WUA based on package name:

  >  Run WDAC Wizard and Create a Custom Rule based on package App as shown here:

 

TanTran_0-1624651285457.png

> Type a word related name of package e.g: F5

> Search (button)

> Create Rule

To view the name of your package if you do not know the exact name of WUA

> Go to  C:\Program Files\WindowsApps

> View your WUA apps ID

TanTran_1-1624651401774.png

 

 

      I hope the information is useful for your WDAC deployment. Then, until next time.


Reference:

 

 

Disclaimer

  • The sample scripts are not supported under any Microsoft standard support program or service. The sample scripts are provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.

 

18 Comments
Brass Contributor

@TanTran 

Is it possible to make "Intune/Endpoint Manager" a "Managed Installer".

In all examples this is possible with Configuration Manager, where you can configure the "CCMEXEC.exe" as a "Managed Installer".

 

But it's difficult to find how to make "Intune/Endpoint Manager" a "Managed Installer".

For example I have problems with deploying MSI files from Intune, which are blocked... File Path rules are not working for MSI's...

Microsoft

Managed Installer has to be combined with Applocker as per MS doc:

- Setting up managed installer tracking and application execution enforcement requires applying both an AppLocker and WDAC policy :

 good luck Sir, 

Tan Tran

Brass Contributor

@TanTran 

Thank you for your respons.

In the same article you have to make a "RuleCollection" to make a "Managed Installer".

In example below on the site, you can make CCMEXEC.EXE as a "Managed Installer".

Which executable do you need for Intune/Endpoint Manager to make a "Managed Installer"? 

 

 

<RuleCollection Type="ManagedInstaller" EnforcementMode="AuditOnly"> <FilePublisherRule Id="6cc9a840-b0fd-4f86-aca7-8424a22b4b93" Name="MEMCM - CCMEXEC.EXE, 5.0.0.0+, Microsoft signed" Description="" UserOrGroupSid="S-1-1-0" Action="Allow"> <Conditions> <FilePublisherCondition PublisherName="O=MICROSOFT CORPORATION, L=REDMOND, S=WASHINGTON, C=US" ProductName="*" BinaryName="CCMEXEC.EXE"> <BinaryVersionRange LowSection="5.0.0.0" HighSection="*" /> </FilePublisherCondition> </Conditions> </FilePublisherRule> <FilePublisherRule Id="780ae2d3-5047-4240-8a57-767c251cbb12" Name="MEMCM - CCMSETUP.EXE, 5.0.0.0+, Microsoft signed" Description="" UserOrGroupSid="S-1-1-0" Action="Allow"> <Conditions> <FilePublisherCondition PublisherName="O=MICROSOFT CORPORATION, L=REDMOND, S=WASHINGTON, C=US" ProductName="*" BinaryName="CCMSETUP.EXE"> <BinaryVersionRange LowSection="5.0.0.0" HighSection="*" /> </FilePublisherCondition> </Conditions> </FilePublisherRule> </RuleCollection>

Brass Contributor

Hi all,

happy NAIDOC 2021 week.

 

I'm working through MDAC and have it all working in BLOCK mode, aside from the Company Portal - Managed installer piece.

 

I have a case open with MS Premium Support & the MS Fast Track team, however I'm not making any headway.

 

We are running Azure/Intune only joined/managed laptops, no on-prem/SCCM presence.

 

I've included the managed installer option in both base and supplemental policy - and I can confirm these are being deployed as they are visible on client C:\Windows\System32\CodeIntegrity\CiPolicies\Active directory. Also visible in the Microsoft-Windows-CodeIntegrity/Operational event log. So far so good!

 

I have deployed an AppLocker policy via Intune as follows. (Note; each "OMA-URI Setting" requires it's own entry in the policy otherwise you'll get an "Syncml(516): Command was inside Atmoci element...." error. (google it).)

 

Windows 10 - Custom - AppLocker Intune Managed Installer policy - Default EXE
./Vendor/MSFT/AppLocker/ApplicationLaunchRestrictions/ThisIsRandomString25/EXE/Policy
<RuleCollection Type="Exe" EnforcementMode="AuditOnly">
<FilePathRule Id="9420c496-046d-45ab-bd0e-455b2649e41e" Name="Dummy Rule" Description="" UserOrGroupSid="S-1-1-0" Action="Deny">
<Conditions>
<FilePathCondition Path="%OSDRIVE%\ThisWillBeBlocked.exe" />
</Conditions>
</FilePathRule>
<RuleCollectionExtensions>
<ThresholdExtensions>
<Services EnforcementMode="Enabled" />
</ThresholdExtensions>
<RedstoneExtensions>
<SystemApps Allow="Enabled"/>
</RedstoneExtensions>
</RuleCollectionExtensions>
</RuleCollection>

--------------------------------------------------------------------------------------------------------------------------------------

Windows 10 - Custom - AppLocker Intune Managed Installer policy - Default DLL
./Vendor/MSFT/AppLocker/ApplicationLaunchRestrictions/ThisIsRandomString26/DLL/Policy
<RuleCollection Type="Dll" EnforcementMode="AuditOnly" >
<FilePathRule Id="86f235ad-3f7b-4121-bc95-ea8bde3a5db5" Name="Dummy Rule" Description="" UserOrGroupSid="S-1-1-0" Action="Deny">
<Conditions>
<FilePathCondition Path="%OSDRIVE%\ThisWillBeBlocked.dll" />
</Conditions>
</FilePathRule>
<RuleCollectionExtensions>
<ThresholdExtensions>
<Services EnforcementMode="Enabled" />
</ThresholdExtensions>
<RedstoneExtensions>
<SystemApps Allow="Enabled"/>
</RedstoneExtensions>
</RuleCollectionExtensions>
</RuleCollection>

--------------------------------------------------------------------------------------------------------------------------------------

Windows 10 - Custom - AppLocker Intune Managed Installer policy - Default MSI
./Vendor/MSFT/AppLocker/ApplicationLaunchRestrictions/ThisIsRandomString30/MSI/Policy
<RuleCollection Type="MSI" EnforcementMode="NotConfigured" />

--------------------------------------------------------------------------------------------------------------------------------------

Windows 10 - Custom - AppLocker Intune Managed Installer policy - Default Script
./Vendor/MSFT/AppLocker/ApplicationLaunchRestrictions/ThisIsRandomString31/Script/Policy
<RuleCollection Type="Script" EnforcementMode="NotConfigured" />

--------------------------------------------------------------------------------------------------------------------------------------

Windows 10 - Custom - AppLocker Intune Managed Installer policy - Managed Installer Exe
./Vendor/MSFT/AppLocker/ApplicationLaunchRestrictions/ThisIsRandomString35/EXE/Policy
<RuleCollection Type="ManagedInstaller" EnforcementMode="Enable">
<FilePublisherRule Id="ebd0307f-a4b2-4253-85e0-2b0b7bdc4580" Name="MICROSOFT® INTUNE™, from O=MICROSOFT CORPORATION, L=REDMOND, S=WASHINGTON, C=US" Description="" UserOrGroupSid="S-1-1-0" Action="Allow">
<Conditions>
<FilePublisherCondition PublisherName="O=MICROSOFT CORPORATION, L=REDMOND, S=WASHINGTON, C=US" ProductName="MICROSOFT® INTUNE™" BinaryName="*">
<BinaryVersionRange LowSection="*" HighSection="*" />
</FilePublisherCondition>
</Conditions>
</FilePublisherRule>
</RuleCollection>

 

I tried using both FilePath and FilePublisher condition (indeed I even tried combining both) but in each case apps (msi's) downloaded by end user via Intune Company Portal are blocked. The block is visible in the Microsoft-Windows-AppLocker/MSI and Script event log.

 

So has anyone actually managed to get Intune Company Portal listed as a managed installed in a MDAC/WDAC BLOCK mode deployment?

 

I've spent weeks on this (on and off) so I'm happy to try/troubleshoot/lab any suggestions.

 

Thanks y'all!

Copper Contributor

@shane_foley - Did you end up finding a resolution? I'm also looking to configure what you are trying to setup but finding it hard to find doco on how to do it. 

Brass Contributor

Hi there Josh,

hmmm I though I had updated this page with my latest 'progress'.

 

Anywho - I had a ticket logged with MS support, and it was assigned to various teams over a month long period. It was closed with the following "resolution";

 

Please be informed that, we discussed this issue with research team, currently, We do not have any workaround regarding the issue we are facing.

This technical functionalities do not exist or are not supported in the requested manner, hence, not much we can do as support.

 
 
 

 I'm trying to follow up and get clarification on the following;

 

For Intune only joined devices (no SCCM presence) there is currently no way to configure Intune Company Portal as a managed installer in an MDAC/WDAC deployment.

 

As such the following article does not apply to Intune Company Portal;

https://docs.microsoft.com/en-us/windows/security/threat-protection/windows-defender-application-con...

 

Still waiting on a reply back....  I'll keep trying though.

 

Doesn't give you a solution, but hopefully saves you wasting time on it (like I did!!).

 

Shane.

Brass Contributor

Me again - just got confirmation...

 

Intune/Company Portal cannot be listed as a managed installer.

 

Please add your vote to this;

 

https://microsoftintune.uservoice.com/forums/291681-ideas/suggestions/43396065-use-intune-as-managed...

 

 

Copper Contributor

I am looking to create a WDAC policy, which should prevent applications running from specific locations. Which base template would be the most appropriate?

Copper Contributor

@shane_foley @JEllisNZ 

Not sure is you all saw this or not but they did get this working.  Just want to put this out here incase someone else stumbles upon this like me.  I have been trying to work this out for a long time.

Allow apps deployed with a WDAC managed installer (Windows) - Windows security | Microsoft Docs

 

https://github.com/MicrosoftDocs/windows-itpro-docs/blob/public/windows/security/threat-protection/w...

 

 

Brass Contributor

@mbrown2180 

 

Thank you for this information.

At this moment we still have problems with this solution when using a cloud-only solution...

 

To explain my problem, my scenario:

- Cloud-Only, Windows is Intune only managed (MDM enrolled with AutoPilot) (There's no SCCM or on-premises managed solutions)

- Using MDAC, created a custom policy, starting with the default template : C:\Windows\schemas\CodeIntegrity\ExamplePolicies\DefaultWindows_Enforced.xml

- Because all users are "standard users", we have added some exclussions with filepaths : C:\Windows\*, C:\Program Files\*, C:\Program Files (x86)\*

- We have converted the policy to a BIN file, using OMA-URL we have deployed it to "Test" systems in Intune.

- MDAC is doing it's job after deployment, it's working nice.

 

But we have seen some scenario's with Application Deployments that MDAC is preventing installation, without a nice solution...

 

For example:

- We have downloaded a application from a vendor website, downloaded the MSI from the original source website... but it's unsigned...

- But we have seen that the "Filepath" exclussion isn't working for MSI, seems to be only for EXE? So starting in C:\Windows\IMEcache isn't working... 

- We can create a hash rule, so it seems to be no problem in first place.

- But sometimes we see strange behaviours, for example the MSI's extracts itself to another location, where it starts another EXE/MSI installation, for example somewhere in the C:\ProgramData subfolders or in C:\Windows\System32\config\systemprofile\AppData\Local\ subfolders.

- Sometime we have to add multiple hashes to let the installation work... sometimes it's a problem, because when installation is succesfull it will delete the "extra extracted installation folders" so it will be imposible to track al blocking MSI's...

- Also when the application needs to be replaced by a new version, will must hash everything again. If it was only the first installer it is not a problem, but al the sub installation files are.

 

We thought with "Managed Installer" option it will be possible to give all "Intune Deployments" sort kind of "Exception" from MDAC, everything from Intune we trust... doesn't matter if it's a MSI/EXE or Script...

But this seems to be difficult to setup...

 

When trying to upload the XML file with the Managed Installer for Intune, we have to split the XML for EXE, MSI, SCRIPT, etc... like:

./Vendor/MSFT/AppLocker/ApplicationLaunchRestrictions/groupname/MSI/Policy

./Vendor/MSFT/AppLocker/ApplicationLaunchRestrictions/groupname/EXE/Policy

etc

 

So how can we deploy the Managed Installer XML correctly with Intune.... ?

Or is there another solution for this, like creating a .intunewin file with the XML and create a CMD which will import the Applocker XML file?

 

And also in the example file for Managed Installer, we see only EXE and DLL, is it also possbile to add MSI in the XML for Managed Installer? 

 

We have also some problems with deploying firmware/bios settings with Dell systems, because also these executables will extract the extra installers to C:\ProgramData folders and will execute there, also not signed...

 

C:\ProgramData is a user-writable location, to add this folder to the filepath is not an option...

 

When deploying MDAC and Applocker, which rule will win? Sometimes we see Applocker can complement MDAC...

 

Many questions, but cannot find all answers on the internet...

 

 

Copper Contributor

@MZONDERLAND 

 

First off I will say I am in the same situation and answers are very hard to find.  Most of my answers come from trial and error so take it for what its worth.  I am also doing this with no SCCM.

I will try and answer what I can.

First off MSI installs do not bypass MDAC with managed installers.  The first link I sent does hint at that.  Hopefully Microsoft can address this.  My issue started with an MSI install but the latest version from the vender switched to an exe.

I used a script to  enable the managed installer through Intune.  I will paste it in at the end.

Only issue I see right now is I need to do an extra reboot until the app in question installs. so my autopilot application install fails on the first go.

I am going to try to package the script and deploy it as an app with a reboot required, then set dependencies on the other app not to install until it finishes.

Hope this helps.  Let me know if you have anymore questions, or make some progress that could be useful.

 

$policyFile =
@"
<AppLockerPolicy Version="1">
<RuleCollection Type="Dll" EnforcementMode="AuditOnly" >
<FilePathRule Id="86f235ad-3f7b-4121-bc95-ea8bde3a5db5" Name="Benign DENY Rule" Description="" UserOrGroupSid="S-1-1-0" Action="Deny">
<Conditions>
<FilePathCondition Path="%OSDRIVE%\ThisWillBeBlocked.dll" />
</Conditions>
</FilePathRule>
<RuleCollectionExtensions>
<ThresholdExtensions>
<Services EnforcementMode="Enabled" />
</ThresholdExtensions>
<RedstoneExtensions>
<SystemApps Allow="Enabled"/>
</RedstoneExtensions>
</RuleCollectionExtensions>
</RuleCollection>
<RuleCollection Type="Exe" EnforcementMode="AuditOnly">
<FilePathRule Id="9420c496-046d-45ab-bd0e-455b2649e41e" Name="Benign DENY Rule" Description="" UserOrGroupSid="S-1-1-0" Action="Deny">
<Conditions>
<FilePathCondition Path="%OSDRIVE%\ThisWillBeBlocked.exe" />
</Conditions>
</FilePathRule>
<RuleCollectionExtensions>
<ThresholdExtensions>
<Services EnforcementMode="Enabled" />
</ThresholdExtensions>
<RedstoneExtensions>
<SystemApps Allow="Enabled"/>
</RedstoneExtensions>
</RuleCollectionExtensions>
</RuleCollection>
<RuleCollection Type="ManagedInstaller" EnforcementMode="AuditOnly">
<FilePublisherRule Id="55932f09-04b8-44ec-8e2d-3fc736500c56" Name="MICROSOFT.MANAGEMENT.SERVICES.INTUNEWINDOWSAGENT.EXE version 1.39.200.2 or greater in MICROSOFT® INTUNE™ from O=MICROSOFT CORPORATION, L=REDMOND, S=WASHINGTON, C=US" Description="" UserOrGroupSid="S-1-1-0" Action="Allow">
<Conditions>
<FilePublisherCondition PublisherName="O=MICROSOFT CORPORATION, L=REDMOND, S=WASHINGTON, C=US" ProductName="*" BinaryName="MICROSOFT.MANAGEMENT.SERVICES.INTUNEWINDOWSAGENT.EXE">
<BinaryVersionRange LowSection="1.39.200.2" HighSection="*" />
</FilePublisherCondition>
</Conditions>
</FilePublisherRule>
</RuleCollection>
</AppLockerPolicy>
"@

$policyFile | Out-File ./ApplockerMI.xml

Set-AppLockerPolicy -XmlPolicy .\ApplockerMI.xml -Merge -ErrorAction SilentlyContinue

appidtel.exe start -mionly

Copper Contributor

@MZONDERLAND 

 

Also these are helpful to see if the script installed.

 

Get-AppLockerPolicy -Effective -Xml -ErrorVariable ev -ErrorAction SilentlyContinue

Get-AppLockerPolicy -Local

Brass Contributor

@mbrown2180 

Thank you very much for your reaction.

We have tested the XML deployment for the Managed Installer conform your advice.

It seems to be deploying succesfull...

We are now testing the results to see if this works conform we think it should be :)

 

(Hoping in the future Microsoft will add MSI Support for this)

Brass Contributor

@mbrown2180 and/or @TanTran 

 

I have a question...

At this moment we are using WDAC with MSI files.

We thought everything was working fine, we have signed the MSI files, also whitelisted the publisher.

 

At this moment we are seeing problems with MSI files with MST/MSP.

Deploying only MSI file is succesfull installed, no problems.

The same MSI file with MST file, installation failed.

 

We see events in the Applocker MSI and Script logs that the MST file (not MSI) is prevented from running due to Config CI Policy. (Event ID 8029)

 

Do we have to sign the MST also? That seems to be working when tested, but is that the Best Practice?

Why is WDAC/Applocker blocking the MST file, MSI is allowed...

 

We also see the same problem with MSP files, must we also allow them in the policy?

Copper Contributor

I have also had mixed results with MSI installations and Microsoft does not officially support MSI files to function with Managed Installers.
https://docs.microsoft.com/en-us/windows/security/threat-protection/windows-defender-application-con...

Brass Contributor

@mbrown2180 

Thanks for your quick response.

At this moment the MSI installation works fine, not using Managed Installer.

We are using our own packages and we are signing them with our own Code Signing certificate (third party).

Our certificate is added as trusted Publisher.

Every MSI signed with our certificate works fine...

 

But when using MST, like "msiexec.exe /i 7zip.msi TRANSFORMS=7zip.mst" then the installation fails.

In the event log we are seeing the 7zip.mst is prevented from installation.

When deploying only 7zip.msi without MST, the MSI is deployed successfull.

 

It seems to be a problem introduced the last couple of months...

When signing also the MST file with the same trusted publisher certificate it's working without problems.

But we didn't used signed MST's before...

7zip.jpg

Copper Contributor

Have you installed or used WDAC Tools PowerShell Module.  It allows you to drill down into failures as well as many other things.  I have not gotten completely setup on this method, but the PowerShell module is very useful.  It even allows you to decompile policy files(.cip or .bin or .p7b)

 

 

Video is kind of long but very informative.

https://www.youtube.com/watch?v=kPYThE-2Ck8

Download Module here

https://github.com/mattifestation/WDACTools

Copper Contributor

So I learnt the hard way that doing the following is bad news:

  • Creating new rules from audit logs into their own XML
  • Merging the new XML policy into an existing supplemental policy, with the existing policy second in the list of policies to merge.
  • Converting the policy to a BIN and then deploying it online.

 

Doing this (specifically the merging in the wrong order) caused the following:

  • The new policy was a base policy with a new ID and no other related supplemental policies.
  • Targeted devices now had two base policies present.
  • Everything (I mean everything) started getting blocked.
  • After restarting, all devices went into blue repair screens and couldn't reach windows.

We resolved the issue by following the Microsoft documentation for Removing WDAC Policies causing Boot Stop Failures.

One at a time. For many, many devices.

 

After this eye-opening event, I have done some more digging and now discovered the setting mentioned above for "10 Enabled:Boot Audit on Failure". 

If this had been enabled on (both) of the base policies, we would have still been able to allow users to access Windows and receive the rolled back WDAC policy.

 

However, my questions is:

If we turn on option 10, does something actually jump out and alert us that devices are now in Audit mode because of a boot failure event?

If not, don't we risk not noticing and our baseline policy being in a prolonged state of audit mode?

 

Thanks!

 

 

Co-Authors
Version history
Last update:
‎Jun 25 2021 01:27 PM
Updated by: