Detection rules › Elastic
Privilege Escalation via PKEXEC Exploitation
Identifies attempt to exploit a local privilege escalation in polkit pkexec (CVE-2021-4034) via unsecure environment variable injection. Successful exploitation allows an unprivileged user to escalate to the root user.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Privilege Escalation | |
| Stealth |
Rule body
[rule]
description = """
Identifies attempt to exploit a local privilege escalation in polkit pkexec (CVE-2021-4034) via unsecure environment
variable injection. Successful exploitation allows an unprivileged user to escalate to the root user.
"""
id = "30c89cc9-d93c-4134-a976-58f8413f2f32"
license = "Elastic License v2"
name = "Privilege Escalation via PKEXEC Exploitation"
os_list = ["linux"]
reference = ["https://seclists.org/oss-sec/2022/q1/80", "https://haxx.in/files/blasty-vs-pkexec.c"]
version = "1.0.28"
query = '''
file where event.action != "deletion" and
process.executable like ("/tmp/*", "/dev/shm/*", "/var/tmp/*", "/root/*", "/home/*", "./*", "/boot/*") and
file.path like~ "/*GCONV_PATH*"
'''
min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1068"
name = "Exploitation for Privilege Escalation"
reference = "https://attack.mitre.org/techniques/T1068/"
[[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"
Stages and Predicates
Stage 1: file
file where event.action != "deletion" and
process.executable like ("/tmp/*", "/dev/shm/*", "/var/tmp/*", "/root/*", "/home/*", "./*", "/boot/*") and
file.path like~ "/*GCONV_PATH*"
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | ne |
| field:"EventType" kind:ne value:"deletion" |
file.path | wildcard |
| field:"TargetFilename" kind:wildcard value:"/*GCONV_PATH*" |
process.executable | wildcard |
| field:"Image" kind:wildcard |