Detectionhightest
Potential PowerShell Command Line Obfuscation
Detects the PowerShell command lines with special characters
Teymur Kheirkhabarov, Vasiliy Burov, oscd.community, Tim SheltonCreated 2020-10-15Updated 2024-04-15d7bcd677-645d-4691-a8d4-7a5602b780d1windows
Log Source
WindowsProcess Creation
ProductWindows← raw: windows
CategoryProcess Creation← raw: process_creation
Events generated when a new process is spawned on the system. Covers command-line arguments, parent/child relationships, and process metadata.
Detection Logic
Detection Logic4 selectors
detection:
selection_img:
- Image|endswith:
- '\powershell.exe'
- '\pwsh.exe'
- OriginalFileName:
- 'PowerShell.EXE'
- 'pwsh.dll'
selection_re:
# TODO: Optimize for PySIGMA
- CommandLine|re: '\+.*\+.*\+.*\+.*\+.*\+.*\+.*\+.*\+.*\+.*\+.*\+.*\+.*\+'
- CommandLine|re: '\{.*\{.*\{.*\{.*\{.*\{.*\{.*\{.*\{.*\{'
- CommandLine|re: '\^.*\^.*\^.*\^.*\^'
- CommandLine|re: '`.*`.*`.*`.*`'
filter_optional_amazonSSM:
ParentImage: C:\Program Files\Amazon\SSM\ssm-document-worker.exe
filter_optional_defender_atp:
CommandLine|contains:
- 'new EventSource("Microsoft.Windows.Sense.Client.Management"'
- 'public static extern bool InstallELAMCertificateInfo(SafeFileHandle handle);'
condition: all of selection_* and not 1 of filter_optional_*False Positives
Amazon SSM Document Worker
Windows Defender ATP
References
MITRE ATT&CK
Techniques
Sub-techniques
Rule Metadata
Rule ID
d7bcd677-645d-4691-a8d4-7a5602b780d1
Status
test
Level
high
Type
Detection
Created
2020-10-15
Modified
2024-04-15
Path
rules/windows/process_creation/proc_creation_win_powershell_cmdline_special_characters.yml
Raw Tags
attack.executionattack.stealthattack.t1027attack.t1059.001