Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
title: Potential Cmdlet Invocation Via ExportedCommands Array Index
id: 4ff4ad3e-9fb5-4a70-9962-d6ea58090318
status: experimental
description: |
Detects 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-06-11
tags:
- attack.execution
- attack.t1059.001
- attack.stealth
- attack.t1027.010
logsource:
product: windows
category: ps_script
definition: 'Requirements: Script Block Logging must be enabled'
detection:
selection_module_export_enum:
ScriptBlockText|contains|all:
- 'Get-Module'
- 'ListAvailable'
- 'Microsoft.PowerShell.Utility'
- 'ExportedCommands'
- 'Values'
selection_index_used:
ScriptBlockText|contains: '[*]'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will search in all the ScriptBlockText [ any caracter ] that can be prone to FP , but with the selection_module_export_enum it should be fine, isn't it ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the idea. selection_module_export_enum should do the heavy-lifting here. selection_index_used is just to make sure that there exist a possibility of using array index within the script. A more fine tuned rule would probably check against integer literal or variable reference, but that would require using regular expressions. I think they are too heavy for what we want to achieve here.

condition: all of selection_*
falsepositives:
- Unknown
level: medium
Loading