PowerShell Dynamic Module Invocation Via ExportedCommands Array Index - PS Script
Description
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.
Query · sigma
selection_module_export_enum: ScriptBlockText|contains: - 'Get-Module ' - 'gmo ' ScriptBlockText|contains|all: - ListAvailable - Microsoft.PowerShell.Utility - ExportedCommands - Values selection_index_used: ScriptBlockText|contains: '[*]' condition: all of selection_*
Known false positives
- Legitimate use of exported commands array indexing in PowerShell scripts (should be rare)