Detection rules › Elastic

Library Loaded from a Spoofed Call Stack

Source
github.com/elastic/protections-artifacts

Detects library load from a potentially altered call stack in order to conceal the true source of the call.

MITRE ATT&CK coverage

Rule body

[rule]
description = "Detects library load from a potentially altered call stack in order to conceal the true source of the call."
id = "c6cfc1e1-2198-4f72-a2df-cd4e13f3e1ca"
license = "Elastic License v2"
name = "Library Loaded from a Spoofed Call Stack"
os_list = ["windows"]
reference = ["https://www.zscaler.com/blogs/security-research/dodgebox-deep-dive-updated-arsenal-apt41-part-1"]
version = "1.0.6"

query = '''
library where
  dll.name : ("wininet.dll", "ws2_32.dll", "winhttp.dll", "netapi32.dll", "wmiutils.dll", "wtsapi32.dll", "psapi.dll") and
  (
   process.thread.Ext.call_stack_summary == "ntdll.dll|kernelbase.dll|kernel32.dll|ntdll.dll" or 
   
   (process.thread.Ext.call_stack_summary == "ntdll.dll|kernel32.dll|ntdll.dll" and 
    _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: "*ntdll.dll!TpReleaseWait*") and
    _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: "*ntdll.dll!RtlInitializeResource*") and 
    not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: "*ntdll.dll!LdrUnloadDl*"))
   ) and
  _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: "*\\ntdll.dll!LdrLoadDll*") and
  not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: ("*\\KernelBase.dll!LoadLibrary*", "*\\kernel32.dll!LoadLibrary*")) and
  not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: ("*\\KernelBase.dll+0x*", "*\\kernel32.dll+0x*"))
'''

min_endpoint_version = "8.10.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 = "T1036"
name = "Masquerading"
reference = "https://attack.mitre.org/techniques/T1036/"

[[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

Stage 1: library

library where
  dll.name : ("wininet.dll", "ws2_32.dll", "winhttp.dll", "netapi32.dll", "wmiutils.dll", "wtsapi32.dll", "psapi.dll") and
  (
   process.thread.Ext.call_stack_summary == "ntdll.dll|kernelbase.dll|kernel32.dll|ntdll.dll" or 
   
   (process.thread.Ext.call_stack_summary == "ntdll.dll|kernel32.dll|ntdll.dll" and 
    _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: "*ntdll.dll!TpReleaseWait*") and
    _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: "*ntdll.dll!RtlInitializeResource*") and 
    not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: "*ntdll.dll!LdrUnloadDl*"))
   ) and
  _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: "*\\ntdll.dll!LdrLoadDll*") and
  not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: ("*\\KernelBase.dll!LoadLibrary*", "*\\kernel32.dll!LoadLibrary*")) and
  not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: ("*\\KernelBase.dll+0x*", "*\\kernel32.dll+0x*"))

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.thread.Ext.call_stackarray_any(no value, null check)excludes:process.thread.Ext.call_stack

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
dll.namewildcard
  • netapi32.dll corpus 3 (elastic 3)
  • psapi.dll corpus 7 (elastic 7)
  • winhttp.dll corpus 16 (elastic 16)
  • wininet.dll corpus 18 (elastic 18)
  • wmiutils.dll corpus 6 (elastic 6)
  • ws2_32.dll corpus 20 (elastic 20)
  • wtsapi32.dll corpus 5 (elastic 5)
field:"dll.name" kind:wildcard
process.thread.Ext.call_stack_summaryeq
  • ntdll.dll|kernel32.dll|ntdll.dll corpus 4 (elastic 4)
  • ntdll.dll|kernelbase.dll|kernel32.dll|ntdll.dll corpus 2 (elastic 2)
field:"process.thread.Ext.call_stack_summary" kind:eq