Shellcode Behavior via .NET Core
Description
Identifies the call of code injection related Windows API with suspicious parameters that align with shellcode allocation from a Managed .NET application.
Query · eql
api where
(
(process.Ext.api.behaviors == "allocate_shellcode" and process.Ext.api.parameters.size >= 100000 and
process.Ext.api.metadata.target_address_name == "Unbacked" and
process.Ext.api.name in ("VirtualAlloc", "VirtualProtect", "MapViewOfFile", "MapViewOfFile2")) or
(process.Ext.api.name == "SetThreadContext" and process.Ext.api.behaviors == "shellcode")
) and
process.thread.Ext.call_stack_final_user_module.name == "Unbacked" and
(
process.thread.Ext.call_stack_final_user_module.protection_provenance == "system.core.ni.dll" or
process.thread.Ext.call_stack_final_user_module.protection_provenance_path like "c:\\windows\\assembly\\nativeimages_*\\system.core.ni.dll"
)
and not process.thread.Ext.call_stack_summary like ("*|Unbacked|clr.dll|*", "*Unbacked|mscorlib.ni.dll|*")