Privilege Escalation via Windir Environment Variable

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

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2020/11/26"
 3integration = ["endpoint"]
 4maturity = "production"
 5min_stack_comments = "New fields added: required_fields, related_integrations, setup"
 6min_stack_version = "8.3.0"
 7updated_date = "2023/06/22"
 8
 9[rule]
10author = ["Elastic"]
11description = """
12Identifies a privilege escalation attempt via a rogue Windows directory (Windir) environment variable. This is a known
13primitive that is often combined with other vulnerabilities to elevate privileges.
14"""
15from = "now-9m"
16index = ["logs-endpoint.events.*", "endgame-*"]
17language = "eql"
18license = "Elastic License v2"
19name = "Privilege Escalation via Windir Environment Variable"
20references = ["https://www.tiraniddo.dev/2017/05/exploiting-environment-variables-in.html"]
21risk_score = 73
22rule_id = "d563aaba-2e72-462b-8658-3e5ea22db3a6"
23severity = "high"
24tags = ["Domain: Endpoint", "OS: Windows", "Use Case: Threat Detection", "Tactic: Privilege Escalation", "Data Source: Elastic Endgame", "Data Source: Elastic Defend"]
25timestamp_override = "event.ingested"
26type = "eql"
27
28query = '''
29registry where host.os.type == "windows" and registry.path : (
30    "HKEY_USERS\\*\\Environment\\windir",
31    "HKEY_USERS\\*\\Environment\\systemroot",
32    "\\REGISTRY\\USER\\*\\Environment\\windir",
33    "\\REGISTRY\\USER\\*\\Environment\\systemroot"
34    ) and
35 not registry.data.strings : ("C:\\windows", "%SystemRoot%")
36'''
37
38
39[[rule.threat]]
40framework = "MITRE ATT&CK"
41[[rule.threat.technique]]
42id = "T1574"
43name = "Hijack Execution Flow"
44reference = "https://attack.mitre.org/techniques/T1574/"
45[[rule.threat.technique.subtechnique]]
46id = "T1574.007"
47name = "Path Interception by PATH Environment Variable"
48reference = "https://attack.mitre.org/techniques/T1574/007/"
49
50
51
52[rule.threat.tactic]
53id = "TA0004"
54name = "Privilege Escalation"
55reference = "https://attack.mitre.org/tactics/TA0004/"

References

Related rules

to-top