Library Load from a Truncated Stack
Description
Detects attempts to load libraries from a potentially truncated call stack in order to conceal the true source of the call.
Query · eql
library where
(
(dll.name : ("wininet.dll", "ws2_32.dll", "winhttp.dll", "amsi.dll", "netapi32.dll", "wldap32.dll", "wtsapi32.dll", "mswsock.dll", "urlmon.dll") and
process.thread.Ext.call_stack_summary == "ntdll.dll|kernelbase.dll" and
_arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: "C:\\Windows\\Sys?????\\KernelBase.dll!LoadLibrary*")) or
(dll.name : ("kernel32.dll", "kernelbase.dll", "dbghelp.dll", "ntdll.dll", "amsi.dll") and process.thread.Ext.call_stack_summary == "ntdll.dll" and
_arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: "C:\\Windows\\System32\\ntdll.dll!??MapViewOfSectionEx*") and
not _arraysearch(process.thread.Ext.call_stack, $entry,
$entry.symbol_info: ("C:\\Windows\\System32\\ntdll.dll!??MapViewOfSectionEx*",
"c:\\windows\\System32\\kernelbase.dll!LoadLibrary*",
"c:\\windows\\System32\\ntdll.dll!Ldr*",
"C:\\Windows\\System32\\ntdll.dll!RtlUserThreadStart*")))
)