Detection rules › Elastic

Potential Privilege Escalation via Rogue WinRM

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

Identifies a privilege escalation attempt via impersonation using RogueWinRM. RogueWinRM is a local privilege escalation exploit that allows to escalate from a Service account (with SeImpersonatePrivilege) to Local System account if the WinRM service is not running.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies a privilege escalation attempt via impersonation using RogueWinRM. RogueWinRM is a local privilege escalation
exploit that allows to escalate from a Service account (with SeImpersonatePrivilege) to Local System account if the
WinRM service is not running.
"""
id = "33962262-436f-43d7-86e9-06dbddfffb5d"
license = "Elastic License v2"
name = "Potential Privilege Escalation via Rogue WinRM"
os_list = ["windows"]
reference = [
    "https://decoder.cloud/2019/12/06/we-thought-they-were-potatoes-but-they-were-beans/",
    "https://github.com/antonioCoco/RogueWinRM",
]
version = "1.0.31"

query = '''
sequence with maxspan=1m
 [network where process.pid != 4 and event.action == "disconnect_received" and

  /* localhost connection via WinRM default listening port */
  destination.port == 5985 and source.port >= 49152 and
  destination.address : ("127.*", "::1") and source.address : ("127.*", "::1") and
  not process.executable : "?:\\Windows\\System32\\svchost.exe" and user.id != "S-1-5-18"] by process.entity_id
 [process where event.action == "start" and user.id == "S-1-5-18" and
  /* started via seclogon service */
  process.parent.Ext.real.pid > 0 and
  not process.executable : "?:\\Windows\\System32\\WerFault.exe"] by process.parent.entity_id
'''

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

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

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

[[threat.technique.subtechnique]]
id = "T1134.002"
name = "Create Process with Token"
reference = "https://attack.mitre.org/techniques/T1134/002/"



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

[internal]
min_endpoint_version = "7.15.0"

Stages and Predicates

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

Stage 1: network

[network where process.pid != 4 and event.action == "disconnect_received" and
  destination.port == 5985 and source.port >= 49152 and
  destination.address : ("127.*", "::1") and source.address : ("127.*", "::1") and
  not process.executable : "?:\\Windows\\System32\\svchost.exe" and user.id != "S-1-5-18"] by process.entity_id

Stage 2: process

[process where event.action == "start" and user.id == "S-1-5-18" and
  process.parent.Ext.real.pid > 0 and
  not process.executable : "?:\\Windows\\System32\\WerFault.exe"] by process.parent.entity_id

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.executableeq?:\Windows\System32\svchost.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\System32\svchost.exe"
process.executableeq?:\Windows\System32\WerFault.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\System32\WerFault.exe"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
destination.addresswildcard
  • 127.*
  • ::1
field:"destination.address" kind:wildcard
destination.porteq
  • 5985 transforms: number corpus 4 (sigma 2, elastic 1, chronicle 1)
field:"DestinationPort" kind:eq value:"5985"
event.actioneq
  • disconnect_received corpus 2 (elastic 2)
  • start corpus 391 (elastic 391)
field:"EventType" kind:eq
process.parent.Ext.real.pidgt
  • 0 transforms: number corpus 11 (elastic 11)
field:"process.parent.Ext.real.pid" kind:gt value:"0"
process.pidne
  • 4 transforms: number corpus 44 (elastic 44)
field:"process_id" kind:ne value:"4"
source.addresswildcard
  • 127.*
  • ::1
field:"aws::sourceIPAddress" kind:wildcard
source.portge
  • 49152 transforms: number corpus 16 (elastic 16)
field:"SourcePort" kind:ge value:"49152"
user.ideq
  • S-1-5-18 corpus 6 (elastic 6)
field:"user.id" kind:eq value:"S-1-5-18"
user.idne
  • S-1-5-18 corpus 36 (elastic 36)
field:"user.id" kind:ne value:"S-1-5-18"