Skip to content
Threat Feed
high advisory

PowerShell Token Obfuscation via Process Creation

Adversaries employ token obfuscation techniques within PowerShell commands to evade detection by security tools, leveraging methods such as character insertion, string concatenation, and environment variable manipulation to mask their malicious intent.

Attackers are increasingly using PowerShell token obfuscation techniques to bypass security measures. This involves manipulating PowerShell command syntax to make it harder for security tools to identify malicious code. This technique leverages Invoke-Obfuscation, a known framework for obfuscating PowerShell scripts. This method allows malicious actors to disguise commands, such as downloading and executing arbitrary code, making traditional signature-based detections less effective. The use of token obfuscation highlights the need for more sophisticated detection strategies that focus on identifying anomalous behavior rather than relying solely on static code analysis. The scope of this threat is broad, as it can be incorporated into various attack vectors, from initial access to lateral movement.

Attack Chain

  1. Initial Access: The attacker gains initial access through an undisclosed method (e.g., phishing, exploit).
  2. PowerShell Execution: The attacker initiates a PowerShell process (powershell.exe).
  3. Token Obfuscation: The attacker employs token obfuscation techniques, such as inserting backticks (), using string concatenation, or manipulating environment variables, to disguise malicious commands. Examples from the source include INVoKe-eXpResSIOnand${eNv:pATh}.
  4. Command Obfuscation: The obfuscated PowerShell command is executed, masking the intent of the command.
  5. Payload Download: The obfuscated command may download a malicious payload from a remote server using methods such as (New-Object Net.WebClient).DownloadString.
  6. Code Execution: The downloaded payload is executed, potentially leading to further compromise of the system.
  7. Persistence: The attacker may establish persistence through various methods.
  8. Lateral Movement/Exfiltration: Depending on the attacker’s objectives, they may move laterally within the network or exfiltrate sensitive data.

Impact

Successful exploitation using PowerShell token obfuscation can lead to complete system compromise, data theft, and disruption of services. The obfuscation techniques make it difficult for traditional security tools to detect and prevent the attack. The number of victims and sectors targeted is currently unknown, but the potential impact is significant due to the widespread use of PowerShell in enterprise environments.

Recommendation

  • Deploy the Sigma rule “Detect Powershell Token Obfuscation with Backticks” to identify PowerShell commands containing backtick-obfuscated tokens in process_creation logs.
  • Deploy the Sigma rule “Detect Powershell Token Obfuscation with String Concatenation” to identify PowerShell commands using string concatenation to obfuscate tokens in process_creation logs.
  • Monitor process_creation logs for PowerShell processes executing commands with environment variable manipulation, as described in the Sigma rules provided.
  • Investigate any PowerShell processes that exhibit obfuscation techniques to determine if they are malicious.

Detection coverage 3

Detect Powershell Token Obfuscation with Backticks

high

Detects PowerShell commands using backticks to obfuscate tokens.

sigma tactics: defense_evasion techniques: T1027.009 sources: process_creation, windows

Detect Powershell Token Obfuscation with String Concatenation

high

Detects PowerShell commands using string concatenation to obfuscate tokens.

sigma tactics: defense_evasion techniques: T1027.009 sources: process_creation, windows

Detect Powershell Token Obfuscation with Env Path Manipulation

high

Detects PowerShell commands using environment path manipulation to obfuscate tokens.

sigma tactics: defense_evasion techniques: T1027.009 sources: process_creation, windows

Detection queries are kept inside the platform. Get full rules →