Privilege Escalation via Windir or SystemRoot Environment Variable


Description

Identifies a privilege escalation attempt via a rogue Windows directory (Windir) or System Root environment variable. This is a known primitive that is often combined with other vulnerabilities to elevate privileges.

Query · eql

registry where registry.data.strings != null and
 not user.id : "S-1-5-18" and
 registry.path : ("HKEY_USERS\\*\\windir", "HKEY_USERS\\*\\systemroot") and
 not registry.data.strings : ("?:\\windows", "?SystemRoot?") and
 not registry.path : "HKEY_USERS\\*\\SOFTWARE\\*"
Raw source Privilege Escalation via Windir or SystemRoot Environment Variable · Elastic TOML
Esc
Published by elastic/protections-artifacts ↗, licensed under Elastic License 2.0 ↗. Reproduced here unmodified.
[rule]
description = """
Identifies a privilege escalation attempt via a rogue Windows directory (Windir) or System Root environment variable.
This is a known primitive that is often combined with other vulnerabilities to elevate privileges.
"""
id = "18ffee0c-5f40-4dd8-aa9a-28251a308dbc"
license = "Elastic License v2"
name = "Privilege Escalation via Windir or SystemRoot Environment Variable"
os_list = ["windows"]
reference = ["https://www.tiraniddo.dev/2017/05/exploiting-environment-variables-in.html"]
version = "1.0.33"

query = '''
registry where registry.data.strings != null and
 not user.id : "S-1-5-18" and
 registry.path : ("HKEY_USERS\\*\\windir", "HKEY_USERS\\*\\systemroot") and
 not registry.data.strings : ("?:\\windows", "?SystemRoot?") and
 not registry.path : "HKEY_USERS\\*\\SOFTWARE\\*"
'''

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 = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"
[[threat.technique.subtechnique]]
id = "T1574.007"
name = "Path Interception by PATH Environment Variable"
reference = "https://attack.mitre.org/techniques/T1574/007/"



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

[internal]
min_endpoint_version = "7.15.0"

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.