Detection rules › Elastic

Suspicious Powershell via Windows Power User Menu

Time window
1m
Sequence by
process.entity_id
Source
github.com/elastic/protections-artifacts

Identifies the execution of Windows Powershell via the Start Menu dialog box. Adversaries may use phishing to instruct the victim to copy and paste malicious commands for execution via crafted phsihing web pages.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies the execution of Windows Powershell via the Start Menu dialog box. Adversaries may use phishing to instruct
the victim to copy and paste malicious commands for execution via crafted phsihing web pages.
"""
id = "01bcebbb-6fce-4921-b932-e8f6da9e73fd"
license = "Elastic License v2"
name = "Suspicious Powershell via Windows Power User Menu"
os_list = ["windows"]
reference = ["https://x.com/g0njxa/status/1958506796798140569"]
version = "1.0.3"

query = '''
sequence by process.entity_id with maxspan=1m
 [process where event.action == "start" and process.name == "powershell.exe" and process.args_count == 1 and
  process.parent.name == "explorer.exe" and
  process.parent.thread.Ext.call_stack_summary == "ntdll.dll|kernelbase.dll|kernel32.dll|windows.storage.dll|shell32.dll|windows.storage.dll|shell32.dll|shcore.dll|kernel32.dll|ntdll.dll"]
 [api where process.name == "powershell.exe" and process.Ext.api.name == "AmsiScanBuffer" and process.Ext.api.parameters.buffer : ("* # *", "*iwr *", "*|iex*", "*invoke-web*", "*WebClient*", "*http*") and
  not process.Ext.api.parameters.buffer like ("*# https://go.microsoft.com/fwlink*",
                                              "#*", "$targetUser*", "wget https://*_windows_amd64.zip",
                                              "Get-LicCertificate*", "*go.microsoft.com/fwlink/*", "#---------*") and
  not process.Ext.api.parameters.content_name : "?*"]
 [any where event.category in ("network", "dns") and process.name == "powershell.exe" and dns.question.name != "go.microsoft.com"]
'''

min_endpoint_version = "8.16.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
tree = true

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1566"
name = "Phishing"
reference = "https://attack.mitre.org/techniques/T1566/"


[threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"


[[threat.technique]]
id = "T1204"
name = "User Execution"
reference = "https://attack.mitre.org/techniques/T1204/"


[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"

[internal]
min_endpoint_version = "8.16.0"

Stages and Predicates

Ordered sequence: each step below must occur in order within 1m, correlated by process.entity_id.

Stage 1: process

[process where event.action == "start" and process.name == "powershell.exe" and process.args_count == 1 and
  process.parent.name == "explorer.exe" and
  process.parent.thread.Ext.call_stack_summary == "ntdll.dll|kernelbase.dll|kernel32.dll|windows.storage.dll|shell32.dll|windows.storage.dll|shell32.dll|shcore.dll|kernel32.dll|ntdll.dll"]

Stage 2: api

[api where process.name == "powershell.exe" and process.Ext.api.name == "AmsiScanBuffer" and process.Ext.api.parameters.buffer : ("* # *", "*iwr *", "*|iex*", "*invoke-web*", "*WebClient*", "*http*") and
  not process.Ext.api.parameters.buffer like ("*# https://go.microsoft.com/fwlink*",
                                              "#*", "$targetUser*", "wget https://*_windows_amd64.zip",
                                              "Get-LicCertificate*", "*go.microsoft.com/fwlink/*", "#---------*") and
  not process.Ext.api.parameters.content_name : "?*"]

Stage 3: any

[any where event.category in ("network", "dns") and process.name == "powershell.exe" and dns.question.name != "go.microsoft.com"]

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.Ext.api.parameters.bufferwildcard*# https://go.microsoft.com/fwlink*, #*, $targetUser*, wget https://*_windows_amd64.zip, Get-LicCertificate*, *go.microsoft.com/fwlink/*, #---------*excludes:process.Ext.api.parameters.buffer
process.Ext.api.parameters.content_namestarts_with?excludes:process.Ext.api.parameters.content_name field:"process.Ext.api.parameters.content_name" value:"?"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
dns.question.namene
  • go.microsoft.com
field:"QueryName" kind:ne value:"go.microsoft.com"
event.actioneq
  • start corpus 391 (elastic 391)
field:"EventType" kind:eq value:"start"
event.categoryin
  • dns corpus 3 (elastic 3)
  • network corpus 19 (elastic 19)
field:"event.category" kind:in
process.Ext.api.nameeq
  • AmsiScanBuffer corpus 16 (elastic 16)
field:"process.Ext.api.name" kind:eq value:"AmsiScanBuffer"
process.Ext.api.parameters.bufferwildcard
  • * # *
  • *WebClient*
  • *http* corpus 2 (elastic 2)
  • *invoke-web*
  • *iwr *
  • *|iex*
field:"process.Ext.api.parameters.buffer" kind:wildcard
process.args_counteq
  • 1 transforms: number corpus 49 (elastic 49)
field:"process.args_count" kind:eq value:"1"
process.nameeq
  • powershell.exe corpus 184 (elastic 140, splunk 44)
field:"process_name" kind:eq value:"powershell.exe"
process.parent.nameeq
  • explorer.exe corpus 51 (elastic 50, splunk 1)
field:"parent_process_name" kind:eq value:"explorer.exe"
process.parent.thread.Ext.call_stack_summaryeq
  • ntdll.dll|kernelbase.dll|kernel32.dll|windows.storage.dll|shell32.dll|windows.storage.dll|shell32.dll|shcore.dll|kernel32.dll|ntdll.dll
field:"process.parent.thread.Ext.call_stack_summary" kind:eq value:"ntdll.dll|kernelbase.dll|kernel32.dll|windows.storage.dll|shell32.dll|windows.storage.dll|shell32.dll|shcore.dll|kernel32.dll|ntdll.dll"