PowerShell Dynamic Module Invocation Via ExportedCommands Array Index - PS Script

 Original Source: [Sigma source]
Title: PowerShell Dynamic Module Invocation Via ExportedCommands Array Index - PS Script
Status: experimental
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.
References:
  -https://www.linkedin.com/posts/mark-o-halloran1_clickfix-defense-evasion-tactic-today-i-ugcPost-7453463467736408064-snrp/
Author: Norbert Jaƛniewicz (AlphaSOC)
Date: 2026-10-06
modified:None
Tags:
  • -'attack.execution'
  • -'attack.stealth'
  • -'attack.t1027'
  • -'attack.t1059.001'
Logsource:
  • product: windows
  • category: ps_script
  • definition: Requirements: Script Block Logging must be enabled
Detection:
  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_*
Falsepositives:
  -Legitimate use of exported commands array indexing in PowerShell scripts (should be rare)
Level: medium