Detection rules › Elastic
UAC Bypass via DiskCleanup Scheduled Task Hijack
Identifies User Account Control (UAC) bypass attempts via hijacking the DiskCleanup scheduled task. Attackers bypass UAC to stealthily execute code with elevated permissions.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Privilege Escalation |
Rule body
[rule]
description = """
Identifies User Account Control (UAC) bypass attempts via hijacking the DiskCleanup scheduled task. Attackers bypass UAC
to stealthily execute code with elevated permissions.
"""
id = "d487049e-381d-44ad-9ec9-d23e88dbf573"
license = "Elastic License v2"
name = "UAC Bypass via DiskCleanup Scheduled Task Hijack"
os_list = ["windows"]
reference = ["https://www.tiraniddo.dev/2017/05/exploiting-environment-variables-in.html"]
version = "1.0.32"
query = '''
process where event.action == "start" and
process.Ext.token.integrity_level_name == "high" and process.hash.sha256 != null and
process.args : "/autoclean" and process.args : "/d" and
not process.executable : ("?:\\Windows\\System32\\cleanmgr.exe",
"?:\\Windows\\SysWOW64\\cleanmgr.exe",
"?:\\Windows\\System32\\taskhostw.exe",
/* Issue #359 */
"?:\\Windows\\System32\\taskhost.exe",
"?:\\Windows\\SysWOW64\\taskhost.exe",
"\\Device\\HarddiskVolume*\\Windows\\Sys*\\cleanmgr.exe",
"\\Device\\HarddiskVolume*\\Windows\\Sys*\\taskhostw.exe",
"\\Device\\HarddiskVolume*\\Windows\\Sys*\\taskhost.exe")
'''
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 = "T1548"
name = "Abuse Elevation Control Mechanism"
reference = "https://attack.mitre.org/techniques/T1548/"
[[threat.technique.subtechnique]]
id = "T1548.002"
name = "Bypass User Account Control"
reference = "https://attack.mitre.org/techniques/T1548/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
Stage 1: process
process where event.action == "start" and
process.Ext.token.integrity_level_name == "high" and process.hash.sha256 != null and
process.args : "/autoclean" and process.args : "/d" and
not process.executable : ("?:\\Windows\\System32\\cleanmgr.exe",
"?:\\Windows\\SysWOW64\\cleanmgr.exe",
"?:\\Windows\\System32\\taskhostw.exe",
"?:\\Windows\\System32\\taskhost.exe",
"?:\\Windows\\SysWOW64\\taskhost.exe",
"\\Device\\HarddiskVolume*\\Windows\\Sys*\\cleanmgr.exe",
"\\Device\\HarddiskVolume*\\Windows\\Sys*\\taskhostw.exe",
"\\Device\\HarddiskVolume*\\Windows\\Sys*\\taskhost.exe")
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.executable | wildcard | ?:\Windows\System32\cleanmgr.exe, ?:\Windows\SysWOW64\cleanmgr.exe, ?:\Windows\System32\taskhostw.exe, ?:\Windows\System32\taskhost.exe, ?:\Windows\SysWOW64\taskhost.exe, \Device\HarddiskVolume*\Windows\Sys*\cleanmgr.exe, \Device\HarddiskVolume*\Windows\Sys*\taskhostw.exe, \Device\HarddiskVolume*\Windows\Sys*\taskhost.exe | excludes:process.executable |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.Ext.token.integrity_level_name | eq |
| field:"process.Ext.token.integrity_level_name" kind:eq value:"high" |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.hash.sha256 | is_not_null | field:"Hashes" kind:is_not_null |