Detection of PowerShell Token Obfuscation Techniques
This brief documents detection logic for PowerShell command-line obfuscation methods commonly utilized by the Invoke-Obfuscation framework to bypass security monitoring.
This brief addresses the detection of PowerShell token obfuscation, a technique frequently used to hide malicious commands from security monitoring solutions. By utilizing backticks, string concatenation, and format operators, attackers can break up common cmdlets like 'Invoke-Expression' or 'New-Object', effectively evading simple keyword-based detection rules. This behavior is a core component of the Invoke-Obfuscation framework, which is widely employed by various threat actors during the initial access or post-exploitation phases of an attack. Detecting these patterns is essential for identifying obfuscated command execution within Windows environments.
Impact
The use of obfuscation allows attackers to mask their malicious activity from command-line logging and endpoint detection systems. If successful, this can lead to unauthorized code execution, credential theft, or the deployment of secondary malware payloads, significantly increasing the adversary's ability to maintain persistence and move laterally within a compromised network.
Recommendation
Detection engineering teams should implement the provided Sigma rule to identify obfuscated PowerShell command lines.
- Enable PowerShell script block logging and command-line process creation logging (Sysmon Event ID 1 or Windows Security Event ID 4688 with command line auditing).
- Tune the detection logic periodically to account for new obfuscation permutations, as adversaries frequently update these techniques.
- Deploy the following Sigma rules to your SIEM to monitor for these execution patterns.
Immediate actions
Deploy Sigma detection rule to SIEM.
Threat Hunt
Search for excessive use of backticks or -f format operators in PowerShell command lines.
Data: CommandLine process logs
Mitigations
Enable PowerShell Constrained Language Mode where appropriate.
T1027.009
Detection coverage 1
Detect PowerShell Token Obfuscation
highDetects various PowerShell token obfuscation techniques, including backtick usage, string concatenation, and format operators used to hide malicious cmdlets.
Detection queries are available on the platform. Get full rules →