Detection rules › Elastic

Suspicious NTDLL Image Load

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

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

TacticTechniques
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.

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
dll.pathwildcard
  • ?:\Windows\SysWOW64\ntdll.dll
  • ?:\Windows\System32\ntdll.dll
field:"ImageLoaded" kind:wildcard
dns.question.namewildcard
  • *.* corpus 7 (elastic 4, kusto 2, splunk 1)
field:"QueryName" kind:wildcard value:"*.*"
event.actioneq
  • start corpus 391 (elastic 391)
field:"EventType" kind:eq value:"start"
process.command_linewildcard
  • *http* corpus 52 (sigma 34, elastic 15, chronicle 2, splunk 1)
field:"CommandLine" kind:wildcard value:"*http*"
process.executablewildcard
  • ?:\Users\*\AppData\Local\Temp\7z*\ corpus 3 (elastic 3)
  • ?:\Users\*\AppData\Local\Temp\BNZ.* corpus 7 (elastic 7)
  • ?:\Users\*\AppData\Local\Temp\Rar$*\* corpus 4 (elastic 4)
  • ?:\Users\*\AppData\Local\Temp\Temp?_*\* corpus 4 (elastic 4)
  • ?:\Users\Public\* corpus 4 (elastic 4)
  • ?:\Windows\SysWOW64\explorer.exe
field:"Image" kind:wildcard
process.namewildcard
  • Installutil.exe corpus 37 (elastic 32, splunk 5)
  • msbuild.exe corpus 39 (elastic 36, splunk 3)
  • mshta.exe corpus 84 (elastic 79, splunk 5)
  • notepad.exe corpus 6 (elastic 4, splunk 2)
  • powershell.exe corpus 184 (elastic 140, splunk 44)
  • regasm.exe corpus 26 (elastic 24, splunk 2)
  • regsvr32.exe corpus 73 (elastic 68, splunk 5)
  • rundll32.exe corpus 126 (elastic 100, splunk 26)
  • wscript.exe corpus 83 (elastic 82, splunk 1)
field:"process_name" kind:wildcard
process.parent.namewildcard
  • excel.exe corpus 28 (elastic 27, splunk 1)
  • powerpnt.exe corpus 23 (elastic 23)
  • regsvr32.exe corpus 13 (elastic 13)
  • rundll32.exe corpus 20 (elastic 20)
  • winword.exe corpus 26 (elastic 26)
field:"parent_process_name" kind:wildcard
process.thread.Ext.call_stack_summarywildcard
  • ?* corpus 14 (elastic 14)
field:"process.thread.Ext.call_stack_summary" kind:wildcard value:"?*"