Detection rules › Elastic
Suspicious NTDLL Image Load
Identifies when a process loads a second copy of Windows NTDLL image. This may be indicative of adversarial attempt to evade NTDLL syscall hooking by loading a clean (unhooked) copy of the same image.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Rule body
[rule]
description = """
Identifies when a process loads a second copy of Windows NTDLL image. This may be indicative of adversarial attempt to
evade NTDLL syscall hooking by loading a clean (unhooked) copy of the same image.
"""
id = "5eb3c0b3-8d11-439d-b26d-d7623c5b3723"
license = "Elastic License v2"
name = "Suspicious NTDLL Image Load"
os_list = ["windows"]
reference = [
"https://www.elastic.co/security-labs/Hunting-for-Suspicious-Windows-Libraries-for-Execution-and-Evasion",
]
version = "1.0.29"
query = '''
sequence by process.entity_id with maxspan=1m
[process where event.action == "start" and
not process.Ext.token.integrity_level_name in ("system", "low") and
(
process.name : ("rundll32.exe", "regsvr32.exe", "mshta.exe", "wscript.exe", "notepad.exe", "msbuild.exe", "regasm.exe", "Installutil.exe") or
process.executable : ("?:\\Users\\Public\\*",
"?:\\Windows\\SysWOW64\\explorer.exe",
"?:\\Users\\*\\AppData\\Local\\Temp\\7z*\\",
"?:\\Users\\*\\AppData\\Local\\Temp\\Rar$*\\*",
"?:\\Users\\*\\AppData\\Local\\Temp\\Temp?_*\\*",
"?:\\Users\\*\\AppData\\Local\\Temp\\BNZ.*") or
(process.parent.name : ("rundll32.exe", "regsvr32.exe", "winword.exe", "excel.exe", "powerpnt.exe") and
not process.executable : ("?:\\Program Files (x86)\\Microsoft Office\\*", "?:\\Program Files\\Microsoft Office\\*")) or
(process.name : "powershell.exe" and (length(process.command_line) >= 100 or process.command_line : "*http*"))
) and
not (process.name : ("wscript.exe", "cscript.exe") and process.args : "\\\\*\\SysVol\\*")
]
[library where
dll.path : ("?:\\Windows\\SysWOW64\\ntdll.dll", "?:\\Windows\\System32\\ntdll.dll") and
process.thread.Ext.call_stack_summary : "?*" and
not process.thread.Ext.call_stack_summary : "ntdll.dll" and
not _arraysearch(process.thread.Ext.call_stack, $entry,
$entry.symbol_info : ("?:\\Program Files\\ESET\\ESET Security\\ebehmoni.dll*", "?:\\Program Files (x86)\\ESET\\ESET Security\\ebehmoni.dll*"))]
[dns where dns.question.name : "*.*"]
'''
min_endpoint_version = "8.10.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1055"
name = "Process Injection"
reference = "https://attack.mitre.org/techniques/T1055/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.10.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 1m, correlated by process.entity_id.
Stage 1: process
[process where event.action == "start" and
not process.Ext.token.integrity_level_name in ("system", "low") and
(
process.name : ("rundll32.exe", "regsvr32.exe", "mshta.exe", "wscript.exe", "notepad.exe", "msbuild.exe", "regasm.exe", "Installutil.exe") or
process.executable : ("?:\\Users\\Public\\*",
"?:\\Windows\\SysWOW64\\explorer.exe",
"?:\\Users\\*\\AppData\\Local\\Temp\\7z*\\",
"?:\\Users\\*\\AppData\\Local\\Temp\\Rar$*\\*",
"?:\\Users\\*\\AppData\\Local\\Temp\\Temp?_*\\*",
"?:\\Users\\*\\AppData\\Local\\Temp\\BNZ.*") or
(process.parent.name : ("rundll32.exe", "regsvr32.exe", "winword.exe", "excel.exe", "powerpnt.exe") and
not process.executable : ("?:\\Program Files (x86)\\Microsoft Office\\*", "?:\\Program Files\\Microsoft Office\\*")) or
(process.name : "powershell.exe" and (length(process.command_line) >= 100 or process.command_line : "*http*"))
) and
not (process.name : ("wscript.exe", "cscript.exe") and process.args : "\\\\*\\SysVol\\*")
]
Stage 2: library
[library where
dll.path : ("?:\\Windows\\SysWOW64\\ntdll.dll", "?:\\Windows\\System32\\ntdll.dll") and
process.thread.Ext.call_stack_summary : "?*" and
not process.thread.Ext.call_stack_summary : "ntdll.dll" and
not _arraysearch(process.thread.Ext.call_stack, $entry,
$entry.symbol_info : ("?:\\Program Files\\ESET\\ESET Security\\ebehmoni.dll*", "?:\\Program Files (x86)\\ESET\\ESET Security\\ebehmoni.dll*"))]
Stage 3: dns
[dns where dns.question.name : "*.*"]
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | wildcard | \\*\SysVol\* | excludes:process.args field:"process.args" value:"\\*\SysVol\*" |
process.name | eq | wscript.exe, cscript.exe | excludes:process.name field:"process.name" value:"wscript.exe" field:"process.name" value:"cscript.exe" |
process.Ext.token.integrity_level_name | in | low, system | excludes:process.Ext.token.integrity_level_name field:"process.Ext.token.integrity_level_name" value:"low" field:"process.Ext.token.integrity_level_name" value:"system" |
process.thread.Ext.call_stack | array_any | excludes:process.thread.Ext.call_stack | |
process.thread.Ext.call_stack_summary | eq | ntdll.dll | excludes:process.thread.Ext.call_stack_summary field:"process.thread.Ext.call_stack_summary" value:"ntdll.dll" |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
dll.path | wildcard |
| field:"ImageLoaded" kind:wildcard |
dns.question.name | wildcard |
| field:"QueryName" kind:wildcard value:"*.*" |
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard value:"*http*" |
process.executable | wildcard |
| field:"Image" kind:wildcard |
process.name | wildcard |
| field:"process_name" kind:wildcard |
process.parent.name | wildcard |
| field:"parent_process_name" kind:wildcard |
process.thread.Ext.call_stack_summary | wildcard |
| field:"process.thread.Ext.call_stack_summary" kind:wildcard value:"?*" |