Windows PowerShell Token Obfuscation via Process Command Line
Identifies Windows PowerShell command lines using token obfuscation patterns, common in Invoke-Obfuscation.
FreeUnreviewedSigmahighv1
windows-powershell-token-obfuscation-via-process-command-line-deb9b646
title: Windows PowerShell Token Obfuscation via Process Command Line
id: f4ba6f80-92bc-400e-b1ba-ac827d5626a1
related:
- id: f3a98ce4-6164-4dd4-867c-4d83de7eca51
type: similar
- id: deb9b646-a508-44ee-b7c9-d8965921c6b6
type: derived
status: test
description: This rule flags Windows process creation events where the command line contains patterns consistent with PowerShell token obfuscation as used by Invoke-Obfuscation. Attackers use this behavior to evade signature-based detection by fragmenting or encoding keywords and expressions. The detection relies on process creation telemetry, specifically the process command line, and applies a filter to reduce matches involving ${env:path}.
references:
- https://github.com/danielbohannon/Invoke-Obfuscation
- https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_powershell_token_obfuscation.yml
author: frack113, Huntrule Team
date: 2022-12-27
modified: 2026-03-16
tags:
- attack.stealth
- attack.t1027.009
logsource:
category: process_creation
product: windows
detection:
selection:
- CommandLine|re: \w+`(?:\w+|-|.)`[\w+|\s]
- CommandLine|re: '"(?:\{\d\})+"\s*-f'
- CommandLine|re: (?i)\$\{`?e`?n`?v`?:`?p`?a`?t`?h`?\}
filter_main_envpath:
CommandLine|contains: ${env:path}
condition: selection and not 1 of filter_main_*
falsepositives:
- Unknown
level: high
license: DRL-1.1
What it detects
This rule flags Windows process creation events where the command line contains patterns consistent with PowerShell token obfuscation as used by Invoke-Obfuscation. Attackers use this behavior to evade signature-based detection by fragmenting or encoding keywords and expressions. The detection relies on process creation telemetry, specifically the process command line, and applies a filter to reduce matches involving ${env:path}.
Known false positives
- Unknown
Detection content is published as a reviewed draft. Tune thresholds and exclusions against your own telemetry before enabling this rule for alerting.