Detection rules › Elastic

Potential CVE-2024-21338 Exploitation

Source
github.com/elastic/protections-artifacts

Identifies unsigned code calling a vulnerable IOCTL in the appid.sys AppLocker driver. Adversaries may exploit this vulnerability to execute code in kernel mode and tamper with security solutions.

MITRE ATT&CK coverage

TacticTechniques
Privilege Escalation
Defense Impairment

Rule body

[rule]
description = """
Identifies unsigned code calling a vulnerable IOCTL in the appid.sys AppLocker driver. Adversaries may exploit this
vulnerability to execute code in kernel mode and tamper with security solutions.
"""
id = "87cf026c-b242-4fbb-9343-1bdc62136586"
license = "Elastic License v2"
name = "Potential CVE-2024-21338 Exploitation"
os_list = ["windows"]
reference = [
    "https://decoded.avast.io/janvojtesek/lazarus-and-the-fudmodule-rootkit-beyond-byovd-with-an-admin-to-kernel-zero-day/",
]
version = "1.0.8"

query = '''
api where

 process.Ext.api.name == "DeviceIoControl" and user.id != "S-1-5-18" and

 (process.Ext.api.parameters.device : "\\Device\\AppId" or
  (user.id : "S-1-5-19" and process.Ext.api.parameters.device == "Unknown")) and

 /* IOCTL 0x22A018 & 0x22A014 */
 (process.Ext.api.parameters.io_control_code == 2269208 or process.Ext.api.parameters.io_control_code == 2269204) and

 /* exclude expected callers */
 not (process.name == "svchost.exe" and 
      (process.thread.Ext.call_stack_final_user_module.protection_provenance == "appidsvc.dll" or 
       process.thread.Ext.call_stack_final_user_module.name == "appidsvc.dll" or
       process.thread.Ext.call_stack_final_user_module.path like "c:\\windows\\system32\\esent.dll") and
      _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $caller, $caller.trusted == true)) and
 process.thread.Ext.call_stack_final_user_module.hash.sha256 != "20fae5e8376514a6e500af5a84d08f0f6c58b3302f5c8da48aa74e815a0e78de" and
 not process.thread.Ext.call_stack_final_user_module.path like ("c:\\windows\\system32\\mpssvc.dll", "c:\\windows\\system32\\wevtsvc.dll", "c:\\windows\\assembly\\nativeimages_*\\mscorlib.ni.dll") and
 not (process.executable : "C:\\Program Files\\Windows Defender Advanced Threat Protection\\Classification\\SenseCE.exe" and
      process.parent.executable : "C:\\Program Files\\Windows Defender Advanced Threat Protection\\MsSense.exe") and
 not (process.executable : "C:\\Windows\\System32\\WUDFHost.exe" and process.parent.executable : "C:\\Windows\\System32\\services.exe" and
      process.thread.Ext.call_stack_final_user_module.name == "ipf_umdf2.dll") and
 not (process.executable : "C:\\Windows\\System32\\svchost.exe" and process.thread.Ext.call_stack_final_user_module.path == "c:\\windows\\system32\\cdp.dll")
'''

min_endpoint_version = "8.14.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 = "T1068"
name = "Exploitation for Privilege Escalation"
reference = "https://attack.mitre.org/techniques/T1068/"


[threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1562"
name = "Impair Defenses"
reference = "https://attack.mitre.org/techniques/T1562/"


[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

[internal]
min_endpoint_version = "8.14.0"

Stages and Predicates

Stage 1: api

api where
 process.Ext.api.name == "DeviceIoControl" and user.id != "S-1-5-18" and
 (process.Ext.api.parameters.device : "\\Device\\AppId" or
  (user.id : "S-1-5-19" and process.Ext.api.parameters.device == "Unknown")) and
 (process.Ext.api.parameters.io_control_code == 2269208 or process.Ext.api.parameters.io_control_code == 2269204) and
 not (process.name == "svchost.exe" and
      (process.thread.Ext.call_stack_final_user_module.protection_provenance == "appidsvc.dll" or
       process.thread.Ext.call_stack_final_user_module.name == "appidsvc.dll" or
       process.thread.Ext.call_stack_final_user_module.path like "c:\\windows\\system32\\esent.dll") and
      _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $caller, $caller.trusted == true)) and
 process.thread.Ext.call_stack_final_user_module.hash.sha256 != "20fae5e8376514a6e500af5a84d08f0f6c58b3302f5c8da48aa74e815a0e78de" and
 not process.thread.Ext.call_stack_final_user_module.path like ("c:\\windows\\system32\\mpssvc.dll", "c:\\windows\\system32\\wevtsvc.dll", "c:\\windows\\assembly\\nativeimages_*\\mscorlib.ni.dll") and
 not (process.executable : "C:\\Program Files\\Windows Defender Advanced Threat Protection\\Classification\\SenseCE.exe" and
      process.parent.executable : "C:\\Program Files\\Windows Defender Advanced Threat Protection\\MsSense.exe") and
 not (process.executable : "C:\\Windows\\System32\\WUDFHost.exe" and process.parent.executable : "C:\\Windows\\System32\\services.exe" and
      process.thread.Ext.call_stack_final_user_module.name == "ipf_umdf2.dll") and
 not (process.executable : "C:\\Windows\\System32\\svchost.exe" and process.thread.Ext.call_stack_final_user_module.path == "c:\\windows\\system32\\cdp.dll")

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.thread.Ext.call_stack_final_user_module.code_signaturearray_any(no value, null check)excludes:process.thread.Ext.call_stack_final_user_module.code_signature
process.thread.Ext.call_stack_final_user_module.nameeqappidsvc.dllexcludes:process.thread.Ext.call_stack_final_user_module.name field:"process.thread.Ext.call_stack_final_user_module.name" value:"appidsvc.dll"
process.thread.Ext.call_stack_final_user_module.patheqc:\windows\system32\esent.dllexcludes:process.thread.Ext.call_stack_final_user_module.path field:"process.thread.Ext.call_stack_final_user_module.path" value:"c:\windows\system32\esent.dll"
process.thread.Ext.call_stack_final_user_module.protection_provenanceeqappidsvc.dllexcludes:process.thread.Ext.call_stack_final_user_module.protection_provenance field:"process.thread.Ext.call_stack_final_user_module.protection_provenance" value:"appidsvc.dll"
process.nameeqsvchost.exeexcludes:process.name field:"process.name" value:"svchost.exe"
process.executableeqC:\Program Files\Windows Defender Advanced Threat Protection\Classification\SenseCE.exeexcludes:process.executable field:"process.executable" value:"C:\Program Files\Windows Defender Advanced Threat Protection\Classification\SenseCE.exe"
process.parent.executableeqC:\Program Files\Windows Defender Advanced Threat Protection\MsSense.exeexcludes:process.parent.executable field:"process.parent.executable" value:"C:\Program Files\Windows Defender Advanced Threat Protection\MsSense.exe"
process.executableeqC:\Windows\System32\WUDFHost.exeexcludes:process.executable field:"process.executable" value:"C:\Windows\System32\WUDFHost.exe"
process.parent.executableeqC:\Windows\System32\services.exeexcludes:process.parent.executable field:"process.parent.executable" value:"C:\Windows\System32\services.exe"
process.thread.Ext.call_stack_final_user_module.nameeqipf_umdf2.dllexcludes:process.thread.Ext.call_stack_final_user_module.name field:"process.thread.Ext.call_stack_final_user_module.name" value:"ipf_umdf2.dll"
process.executableeqC:\Windows\System32\svchost.exeexcludes:process.executable field:"process.executable" value:"C:\Windows\System32\svchost.exe"
process.thread.Ext.call_stack_final_user_module.patheqc:\windows\system32\cdp.dllexcludes:process.thread.Ext.call_stack_final_user_module.path field:"process.thread.Ext.call_stack_final_user_module.path" value:"c:\windows\system32\cdp.dll"
process.thread.Ext.call_stack_final_user_module.pathwildcardc:\windows\system32\mpssvc.dll, c:\windows\system32\wevtsvc.dll, c:\windows\assembly\nativeimages_*\mscorlib.ni.dllexcludes:process.thread.Ext.call_stack_final_user_module.path field:"process.thread.Ext.call_stack_final_user_module.path" value:"c:\windows\system32\mpssvc.dll" field:"process.thread.Ext.call_stack_final_user_module.path" value:"c:\windows\system32\wevtsvc.dll" field:"process.thread.Ext.call_stack_final_user_module.path" value:"c:\windows\assembly\nativeimages_*\mscorlib.ni.dll"

Indicators

These rows show field, operator, and value matches.