Detection rules › Elastic

Privilege Escalation via Named Pipe Impersonation

Source
github.com/elastic/protections-artifacts

Identifies a privilege escalation attempt via named pipe impersonation. An adversary may abuse this technique by utilizing a framework like Metasploit's getsystem command.

MITRE ATT&CK coverage

TacticTechniques
Privilege Escalation

Rule body

[rule]
description = """
Identifies a privilege escalation attempt via named pipe impersonation. An adversary may abuse this technique by
utilizing a framework like Metasploit's getsystem command.
"""
id = "a0265178-779d-4bc5-b3f1-abb3bcddedab"
license = "Elastic License v2"
name = "Privilege Escalation via Named Pipe Impersonation"
os_list = ["windows"]
reference = [
    "https://www.ired.team/offensive-security/privilege-escalation/windows-namedpipes-privilege-escalation",
]
version = "1.0.35"

query = '''
process where event.action == "start" and
   (process.name in~ ("cmd.exe", "powershell.exe", "sc.exe", "schtasks.exe") or 
    process.pe.original_file_name in ("Cmd.Exe", "PowerShell.EXE",  "sc.exe", "schtasks.exe")) and 
   process.command_line : "*echo*>*\\\\.\\pipe\\*" and
   not process.parent.executable like 
           ("?:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",
            "?:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
            "?:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe")
'''

min_endpoint_version = "7.15.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1134"
name = "Access Token Manipulation"
reference = "https://attack.mitre.org/techniques/T1134/"


[threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"

[internal]
min_endpoint_version = "7.15.0"

Stages and Predicates

Stage 1: process

process where event.action == "start" and
   (process.name in~ ("cmd.exe", "powershell.exe", "sc.exe", "schtasks.exe") or 
    process.pe.original_file_name in ("Cmd.Exe", "PowerShell.EXE",  "sc.exe", "schtasks.exe")) and 
   process.command_line : "*echo*>*\\\\.\\pipe\\*" and
   not process.parent.executable like 
           ("?:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",
            "?:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
            "?:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe")

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.parent.executableeq?:\Program Files (x86)\Google\Chrome\Application\chrome.exe, ?:\Program Files\Google\Chrome\Application\chrome.exe, ?:\Program Files (x86)\Microsoft\Edge\Application\msedge.exeexcludes:process.parent.executable field:"process.parent.executable" value:"?:\Program Files (x86)\Google\Chrome\Application\chrome.exe" field:"process.parent.executable" value:"?:\Program Files\Google\Chrome\Application\chrome.exe" field:"process.parent.executable" value:"?:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • start corpus 391 (elastic 391)
field:"EventType" kind:eq value:"start"
process.command_linewildcard
  • *echo*>*\\.\pipe\*
field:"CommandLine" kind:wildcard value:"*echo*>*\\.\pipe\*"
process.namein
  • cmd.exe corpus 121 (elastic 92, splunk 29)
  • powershell.exe corpus 184 (elastic 140, splunk 44)
  • sc.exe corpus 32 (elastic 17, splunk 15)
  • schtasks.exe corpus 30 (elastic 19, splunk 11)
field:"process_name" kind:in
process.pe.original_file_namein
  • Cmd.Exe corpus 81 (sigma 43, elastic 21, splunk 17)
  • PowerShell.EXE corpus 138 (sigma 84, splunk 30, elastic 24)
  • sc.exe corpus 30 (sigma 12, splunk 10, elastic 8)
  • schtasks.exe corpus 31 (sigma 18, elastic 9, splunk 4)
field:"OriginalFileName" kind:in