Detection rules › Elastic

UAC Bypass via DiskCleanup Scheduled Task Hijack

Source
github.com/elastic/protections-artifacts

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

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.

FieldKindExcluded valuesSearch
process.executablewildcard?:\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.exeexcludes:process.executable

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • start corpus 391 (elastic 391)
field:"EventType" kind:eq value:"start"
process.Ext.token.integrity_level_nameeq
  • high corpus 22 (elastic 22)
field:"process.Ext.token.integrity_level_name" kind:eq value:"high"
process.argswildcard
  • /autoclean corpus 2 (elastic 2)
  • /d corpus 2 (elastic 2)
field:"process.args" kind:wildcard
process.hash.sha256is_not_null
  • (no value, null check)
field:"Hashes" kind:is_not_null