Detection rules › Elastic
Potential Privilege Escalation via Rogue WinRM
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
| Tactic | Techniques |
|---|---|
| Privilege Escalation |
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.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.executable | eq | ?:\Windows\System32\svchost.exe | excludes:process.executable field:"process.executable" value:"?:\Windows\System32\svchost.exe" |
process.executable | eq | ?:\Windows\System32\WerFault.exe | excludes:process.executable field:"process.executable" value:"?:\Windows\System32\WerFault.exe" |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
destination.address | wildcard |
| field:"destination.address" kind:wildcard |
destination.port | eq |
| field:"DestinationPort" kind:eq value:"5985" |
event.action | eq |
| field:"EventType" kind:eq |
process.parent.Ext.real.pid | gt |
| field:"process.parent.Ext.real.pid" kind:gt value:"0" |
process.pid | ne |
| field:"process_id" kind:ne value:"4" |
source.address | wildcard |
| field:"aws::sourceIPAddress" kind:wildcard |
source.port | ge |
| field:"SourcePort" kind:ge value:"49152" |
user.id | eq |
| field:"user.id" kind:eq value:"S-1-5-18" |
user.id | ne |
| field:"user.id" kind:ne value:"S-1-5-18" |