Potential Privilege Escalation via SetWindowsHook DLL Injection
Description
Identifies a potentially untrusted DLL loaded by a privileged account from a suspicious location where the call stack indicates a user-mode callback path consistent with SetWindowsHookEx-style window hook execution. Adversaries can abuse window hooks to force a privileged process to load attacker-controlled DLLs and elevate privileges.
Query · eql
library where
user.id in ("S-1-5-18", "S-1-5-19", "S-1-5-20") and
not dll.code_signature.status like ("trusted", "errorCode_endpoint*") and
process.thread.Ext.call_stack_summary == "ntdll.dll|kernelbase.dll|user32.dll|ntdll.dll" and
(dll.Ext.relative_file_creation_time <= 900 or dll.Ext.relative_file_name_modify_time <= 900) and
_arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info like "?:\\Windows\\System32\\ntdll.dll!KiUserCallbackDispatcher*") and
not dll.path : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*", "?:\\Windows\\System32\\*")