Obfuscation & Evasion
Various techniques for a wide variety of obfuscation and evasion
Command Line Obfuscation
Invoke-DOSfuscation: https://github.com/danielbohannon/Invoke-DOSfuscation
Argfuscator: https://argfuscator.net/
General tidbits:
- Use of double quotes
- Unprintable character insertion
PowerShell Obfuscation
General PowerShell Script Evasion
Invoke-Obfuscation: https://github.com/danielbohannon/Invoke-Obfuscation
Bypass Execution Policy
Use this flag to bypass execution policy (or move to PS2 on older hosts!):
powershell -ExecutionPolicy Bypass
AMSI Bypass
- Change AMSI keywords to something else
- Move to PS2 (older hosts only; PowerShell 2.0 is removed from Windows 11 24H2 and Server 2025)
- Use amsi.fail
- Patch memory
- Break AMSI
Antivirus Evasion
Finding Defender exclusions: Windows Post-Exploitation › Finding Defender Exclusions
Sandbox Evasion
General Tips
- Have malware wait 10 seconds before executing
- Have malware wait until some routine interaction occurs from the user (i.e. enter being hit several times)
- Checking for
IsDebuggerPresent - Looking at network setting
User Account Control (UAC) Bypass
UAC is not a security boundary, so Microsoft does not care if evasions exist. It can be trivially evaded with UACme.