Rust-for-Malware-Development

Bypassing EDR Syscall Hooks with a Early Exception Handler

The problem with the (VEH, SEH, etc..) are themselves hooked and monitored heavily by modern EDRs

Modern EDRs monitor syscalls by placing inline hooks (usually a jmp at offset +3) inside the Nt* functions in ntdll.dll.

so when you call hooked funcitons like NtAllocateVirtualMemory, NtProtectVirtualMemory, … the EDR gets the first chance to inspect the arguments and block the call.

So to avoid detection, we can develop our own exception handler without relying on VEH or SEH to manipulate exception handling before the VEH is called.

To know more about this, the Example poc has been described in detail in this blog: Early Exception Handling

Note: Please note that this poc uses hardcoded SSN just for demonstration of the PoC. in your practices you can extract and use SSN using syscall techniques using Hells/halos/tartarus gate: For Syscall technique you can visit this seciton: Syscalls

PoC

We are going to test it on EDR Products. [Release Mode]

image_1

image_2

Debug print that explains how this PoC works step by step [Debug Mode]

image_3

Usage

To compile and run in debug mode. [To understand How this works]

cargo -r r --features debug

To compile and run it on release mode [Final]:

cargo r -r 

To compile on release mode [Final]:

cargo b -r 

Credits / Resoucres