May 29, 2026, 09:30 PM
If you’re still letting EDRs hook your API calls, you’re essentially giving the security team a play-by-play of your operation. Modern EDRs don't just look for "malicious" behavior; they monitor the entry points to the kernel. Every time you call a standard function like
, the EDR has already intercepted it through a
instruction placed in the prologue of the function in
.
Here is how you frame the discussion on "Ghosting" your execution.
If your payload is still relying on the Windows API to allocate memory or create threads, you aren't evading anything. You’re just waiting to be flagged. The industry is currently split between two schools of thought: Unhooking (restoring the state of
) and Direct Syscalls (bypassing the DLL entirely).
1. NTDLL Unhooking: The "Refresh" MethodThe concept is simple: The EDR loads its hooks into the process’s memory space at runtime. If you can acquire a clean, unhooked copy of
from disk and map it over the existing, hooked version in memory, you effectively "clean" the API.
calls are loud. They trigger
notification callbacks that EDRs monitor to see when new modules are being mapped. Manual mapping involves manually parsing the PE (Portable Executable) headers of your own payload, allocating memory, and mapping the sections yourself.
hooks by using the
instruction.
asm
VirtualAllocExjmpntdll.dllHere is how you frame the discussion on "Ghosting" your execution.
If your payload is still relying on the Windows API to allocate memory or create threads, you aren't evading anything. You’re just waiting to be flagged. The industry is currently split between two schools of thought: Unhooking (restoring the state of
ntdll1. NTDLL Unhooking: The "Refresh" MethodThe concept is simple: The EDR loads its hooks into the process’s memory space at runtime. If you can acquire a clean, unhooked copy of
ntdll.dll- The Logic:
- Read from disk into a buffer.
C:\Windows\System32\ntdll.dll
- Find the section of the loaded
.text
in your current process.ntdll
- Use to make that section writable.
VirtualProtect
- Overwrite the hooked bytes with the clean bytes from your disk-read buffer.
- Restore protection to .
READ_EXECUTE
- Read
LoadLibraryLdr- The Workflow:
- Map the headers (DOS/NT/Section).
- Resolve imports by manually parsing the Export Address Table (EAT) of required DLLs.
- Perform base relocations if the preferred base address is occupied.
- Execute the Entry Point.
- Map the headers (DOS/NT/Section).
ntdll.dllsyscallasm
; Example of a direct NtAllocateVirtualMemory syscall
; You need the SSN (System Service Number) for your specific Windows version
mov r10, rcx
mov eax, 0x18 ; Syscall index for NtAllocateVirtualMemory (Win 10/11 varies)
syscall
ret