VirtualProtect Call via NtTestAlert
Description
Detects calls to the VirtualProtect Windows API to change memory permissions and the call is originating from a thread pointing to the API NtTestAlert. This may indicate that this call is coming from a pending APC or a sleeping thread.
Query · eql
api where
process.Ext.api.name : "VirtualProtect" and
process.thread.Ext.call_stack_summary : "ntdll.dll*" and
_arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info : ("*NtTestAlert*", "*ZwTestAlert*")) and
_arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info : "*ProtectVirtualMemory*") and
process.thread.Ext.call_stack_summary : ("ntdll.dll", "ntdll.dll|kernelbase.dll|ntdll.dll|Unknown", "ntdll.dll|Unbacked", "ntdll.dll|Unknown") and
not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.protection_provenance : ("Kernel", "Kernel|*"))