githubEdit

AppLocker Bypasses

AppLocker is application control built into Windows. Policies can be enumerated from GPO or local registry.


Registry Enumeration

# From Beacon (execute-assembly or powerpick)
Get-ChildItem 'HKLM:Software\Policies\Microsoft\Windows\SrpV2'

# Check specific rule types (Exe, Dll, Script, Msi, Appx)
Get-ChildItem 'HKLM:Software\Policies\Microsoft\Windows\SrpV2\Exe'

# Get effective policy
$policy = Get-AppLockerPolicy -Effective
$policy.RuleCollections

GPO Enumeration (Beacon)

Enumerate AppLocker policies from GPO when on an unprotected machine targeting a protected one:

# Find AppLocker GPO
ldapsearch (objectClass=groupPolicyContainer) --attributes displayName,gPCFileSysPath

# Example output:
# displayName: AppLocker
# gPCFileSysPath: \\inlanefreight.local\SysVol\inlanefreight.local\Policies\{8ECEE926-7FEE-48CD-9F51-493EB5AD95DC}

# List GPO contents
ls \\inlanefreight.local\SysVol\inlanefreight.local\Policies\{GPO-GUID}\Machine

# Download Registry.pol for local analysis
download \\inlanefreight.local\SysVol\inlanefreight.local\Policies\{GPO-GUID}\Machine\Registry.pol

Parse locally:


Path Wildcard Abuse

Some rules use wildcards that can be abused:

If path starts with *\, an executable in any directory with that name is allowed. Create a matching directory anywhere you have write access.


Writable Directories

Default allowed paths (%WINDIR%\*) contain writable directories:

Drop payloads here and they will be allowed to run.


LOLBAS - MSBuild Bypass

MSBuild executes arbitrary C# from .csproj files and exists in whitelisted %WINDIR%\*:

beacon.csproj:

Execute:


PowerShell CLM Bypass (Custom COM Object)

AppLocker puts PowerShell into ConstrainedLanguage mode. Bypass by loading a DLL via custom COM object:


Rundll32 Bypass

DLL rules are rarely enabled due to performance. When disabled, load Beacon DLL via rundll32:


Check Current Language Mode

Last updated