Detection rules › Elastic
NTDLL Loaded from an Unusual Path
Identifies when a process loads the Windows NTDLL image from an unusual path. 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 the Windows NTDLL image from an unusual path. This may be indicative of adversarial
attempt to evade NTDLL syscall hooking by loading a clean (unhooked) copy of the same image.
"""
id = "3205274e-7eb0-4765-a712-5783361091ae"
license = "Elastic License v2"
name = "NTDLL Loaded from an Unusual Path"
os_list = ["windows"]
reference = [
"https://www.elastic.co/security-labs/Hunting-for-Suspicious-Windows-Libraries-for-Execution-and-Evasion",
]
version = "1.0.39"
query = '''
library where dll.pe.original_file_name : "ntdll.dll" and
dll.name != null and process.pid != 4 and process.executable != null and
not dll.path : ("?:\\Windows\\SysWOW64\\ntdll.dll",
"?:\\Windows\\System32\\ntdll.dll",
"?:\\Windows\\System32\\ntdll.dll.???",
"?:\\Windows\\SyChpe32\\ntdll.dll",
"?:\\Windows\\WinSxS\\amd64_microsoft-windows-ntdll_*\\ntdll.dll",
"?:\\Windows\\WinSxS\\wow64_microsoft-windows-ntdll_*\\ntdll.dll",
"?:\\Windows\\WinSxS\\Temp\\InFlight\\*\\amd64_microsoft-windows-ntdll_*\\ntdll.dll",
"C:\\Windows\\SMSS-*.tmp",
"C:\\$Windows.~BT\\NewOS\\Windows\\SysWOW64\\ntdll.dll",
/* vsmbSharePrefix */
"\\Device\\vmsmb\\VSMB-{*}\\os\\windows\\*\\ntdll.dll",
"?:\\Windows\\WinSxS\\Temp\\PendingDeletes\\$$DeleteMe*",
"?:\\ProgramData\\Microsoft\\Windows\\Containers\\BaseImages\\*\\Files\\Windows\\System32\\ntdll.dll",
"?:\\Windows\\WinSxS\\Temp\\InFlight\\*\\ntdll.dll",
"?:\\$Windows.~BT\\NewOS\\Windows\\WinSxS\\amd64_microsoft-windows-ntdll_*\\ntdll.dll",
"C:\\ProgramData\\SecureWorks\\TaegisAgent\\{*}\\ntdll.x64.dll",
"C:\\$Windows.~BT\\NewOS\\Windows\\System32\\ntdll.dll") and
not (process.code_signature.subject_name : ("INCA Internet Co.,Ltd.", "NEXON Korea Corporation.", "Acronis International GmbH", "Pearl abyss Corp") and
process.code_signature.trusted == true) and
not (process.executable : "C:\\Windows\\System32\\smss.exe" and dll.path : "?:\\ProgramData\\docker\\windowsfilter\\*\\Files\\Windows\\System32\\ntdll.dll")
'''
min_endpoint_version = "8.0.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 = "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.0.0"
Stages and Predicates
Stage 1: library
library where dll.pe.original_file_name : "ntdll.dll" and
dll.name != null and process.pid != 4 and process.executable != null and
not dll.path : ("?:\\Windows\\SysWOW64\\ntdll.dll",
"?:\\Windows\\System32\\ntdll.dll",
"?:\\Windows\\System32\\ntdll.dll.???",
"?:\\Windows\\SyChpe32\\ntdll.dll",
"?:\\Windows\\WinSxS\\amd64_microsoft-windows-ntdll_*\\ntdll.dll",
"?:\\Windows\\WinSxS\\wow64_microsoft-windows-ntdll_*\\ntdll.dll",
"?:\\Windows\\WinSxS\\Temp\\InFlight\\*\\amd64_microsoft-windows-ntdll_*\\ntdll.dll",
"C:\\Windows\\SMSS-*.tmp",
"C:\\$Windows.~BT\\NewOS\\Windows\\SysWOW64\\ntdll.dll",
"\\Device\\vmsmb\\VSMB-{*}\\os\\windows\\*\\ntdll.dll",
"?:\\Windows\\WinSxS\\Temp\\PendingDeletes\\$$DeleteMe*",
"?:\\ProgramData\\Microsoft\\Windows\\Containers\\BaseImages\\*\\Files\\Windows\\System32\\ntdll.dll",
"?:\\Windows\\WinSxS\\Temp\\InFlight\\*\\ntdll.dll",
"?:\\$Windows.~BT\\NewOS\\Windows\\WinSxS\\amd64_microsoft-windows-ntdll_*\\ntdll.dll",
"C:\\ProgramData\\SecureWorks\\TaegisAgent\\{*}\\ntdll.x64.dll",
"C:\\$Windows.~BT\\NewOS\\Windows\\System32\\ntdll.dll") and
not (process.code_signature.subject_name : ("INCA Internet Co.,Ltd.", "NEXON Korea Corporation.", "Acronis International GmbH", "Pearl abyss Corp") and
process.code_signature.trusted == true) and
not (process.executable : "C:\\Windows\\System32\\smss.exe" and dll.path : "?:\\ProgramData\\docker\\windowsfilter\\*\\Files\\Windows\\System32\\ntdll.dll")
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
dll.path | wildcard | ?:\ProgramData\docker\windowsfilter\*\Files\Windows\System32\ntdll.dll | excludes:dll.path field:"dll.path" value:"?:\ProgramData\docker\windowsfilter\*\Files\Windows\System32\ntdll.dll" |
process.executable | eq | C:\Windows\System32\smss.exe | excludes:process.executable field:"process.executable" value:"C:\Windows\System32\smss.exe" |
process.code_signature.subject_name | eq | INCA Internet Co.,Ltd., NEXON Korea Corporation., Acronis International GmbH, Pearl abyss Corp | excludes:process.code_signature.subject_name |
process.code_signature.trusted | eq | true | excludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true" |
dll.path | wildcard | ?:\Windows\SysWOW64\ntdll.dll, ?:\Windows\System32\ntdll.dll, ?:\Windows\System32\ntdll.dll.???, ?:\Windows\SyChpe32\ntdll.dll, ?:\Windows\WinSxS\amd64_microsoft-windows-ntdll_*\ntdll.dll, ?:\Windows\WinSxS\wow64_microsoft-windows-ntdll_*\ntdll.dll, ?:\Windows\WinSxS\Temp\InFlight\*\amd64_microsoft-windows-ntdll_*\ntdll.dll, C:\Windows\SMSS-*.tmp, C:\$Windows.~BT\NewOS\Windows\SysWOW64\ntdll.dll, \Device\vmsmb\VSMB-{*}\os\windows\*\ntdll.dll, ?:\Windows\WinSxS\Temp\PendingDeletes\$$DeleteMe*, ?:\ProgramData\Microsoft\Windows\Containers\BaseImages\*\Files\Windows\System32\ntdll.dll, ?:\Windows\WinSxS\Temp\InFlight\*\ntdll.dll, ?:\$Windows.~BT\NewOS\Windows\WinSxS\amd64_microsoft-windows-ntdll_*\ntdll.dll, C:\ProgramData\SecureWorks\TaegisAgent\{*}\ntdll.x64.dll, C:\$Windows.~BT\NewOS\Windows\System32\ntdll.dll | excludes:dll.path |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
dll.name | is_not_null | field:"dll.name" kind:is_not_null | |
dll.pe.original_file_name | wildcard |
| field:"dll.pe.original_file_name" kind:wildcard value:"ntdll.dll" |
process.executable | is_not_null | field:"Image" kind:is_not_null | |
process.pid | ne |
| field:"process_id" kind:ne value:"4" |