Detection rules › Elastic

Kernel Driver Registered via NtLoadDriver

Time window
5m
Sequence by
process.entity_id
Source
github.com/elastic/protections-artifacts

Adversaries may load a driver to a compromised machine to execute code in kernel mode. A majority of legitimate kernel driver installations involve a new service creation via the Windows Service Control Manager (SCM) which generate audit logs. Adversaries can leverage the undocumented Windows API NtLoadDriver to load a driver directly, avoiding service creation traces.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Adversaries may load a driver to a compromised machine to execute code in kernel mode. A majority of legitimate kernel
driver installations involve a new service creation via the Windows Service Control Manager (SCM) which generate audit
logs. Adversaries can leverage the undocumented Windows API NtLoadDriver to load a driver directly, avoiding service
creation traces.
"""
id = "5b5fa228-596a-4df2-a0ff-4d98b97e67b3"
license = "Elastic License v2"
name = "Kernel Driver Registered via NtLoadDriver"
os_list = ["windows"]
reference = [
    "http://undocumented.ntinternals.net/index.html?page=UserMode%2FUndocumented%20Functions%2FExecutable%20Images%2FNtLoadDriver.html",
]
version = "1.0.27"

query = '''
sequence by process.entity_id with maxspan=5m
 [process where event.action == "start" and 
  (process.code_signature.trusted == false or process.code_signature.exists == false) and 
  (process.Ext.relative_file_creation_time <= 3600 or process.Ext.relative_file_name_modify_time <= 500)]
 [registry where
  registry.path : "HKLM\\SYSTEM\\ControlSet001\\*\\Type" and registry.data.strings : "1"]
'''

min_endpoint_version = "8.10.0"
reputation = true
[[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.technique]]
id = "T1543"
name = "Create or Modify System Process"
reference = "https://attack.mitre.org/techniques/T1543/"
[[threat.technique.subtechnique]]
id = "T1543.003"
name = "Windows Service"
reference = "https://attack.mitre.org/techniques/T1543/003/"



[threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"

[internal]
min_endpoint_version = "8.10.0"

Stages and Predicates

Ordered sequence: each step below must occur in order within 5m, correlated by process.entity_id.

Stage 1: process

[process where event.action == "start" and 
  (process.code_signature.trusted == false or process.code_signature.exists == false) and 
  (process.Ext.relative_file_creation_time <= 3600 or process.Ext.relative_file_name_modify_time <= 500)]

Stage 2: registry

[registry where
  registry.path : "HKLM\\SYSTEM\\ControlSet001\\*\\Type" and registry.data.strings : "1"]

Indicators

These rows show field, operator, and value matches.