PowerShell Dynamic Module Invocation Via ExportedCommands Array Index - PS Script
Detects obfuscated PowerShell scripts that enumerate Microsoft.PowerShell.Utility exported commands and invoke cmdlets indirectly by array index. This can be 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 - PS Script
2id: 4ff4ad3e-9fb5-4a70-9962-d6ea58090318
3related:
4 - id: 0c3ebe9f-df09-4e00-be0f-73d4ca8d62f6
5 type: similar
6status: experimental
7description: |
8 Detects obfuscated PowerShell scripts that enumerate Microsoft.PowerShell.Utility exported commands
9 and invoke cmdlets indirectly by array index. This can be used to evade detections
10 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)
14date: 2026-10-06
15tags:
16 - attack.execution
17 - attack.stealth
18 - attack.t1027
19 - attack.t1059.001
20logsource:
21 product: windows
22 category: ps_script
23 definition: 'Requirements: Script Block Logging must be enabled'
24detection:
25 selection_module_export_enum:
26 ScriptBlockText|contains:
27 - 'Get-Module '
28 - 'gmo '
29 ScriptBlockText|contains|all:
30 - 'ListAvailable'
31 - 'Microsoft.PowerShell.Utility'
32 - 'ExportedCommands'
33 - 'Values'
34 selection_index_used:
35 ScriptBlockText|contains: '[*]'
36 condition: all of selection_*
37falsepositives:
38 - Legitimate use of exported commands array indexing in PowerShell scripts (should be rare)
39level: medium
40regression_tests_path: regression_data/rules/windows/powershell/powershell_script/posh_ps_cmdlet_invocation_via_exported_commands_array_index/info.yml
References
Related rules
- Potential PowerShell Obfuscation Using Alias Cmdlets
- Base64 Encoded PowerShell Command Detected
- Potential PowerShell Command Line Obfuscation
- Potential PowerShell Obfuscation Via WCHAR/CHAR
- ConvertTo-SecureString Cmdlet Usage Via CommandLine