HookChain: EDR/XDR Bypass via User-land Ntdll Hooking
This talk demonstrates a novel EDR/XDR bypass technique called HookChain, which leverages user-land Ntdll hooking to intercept and redirect system calls. By dynamically mapping system service numbers and implanting custom stubs in the Import Address Table (IAT), the technique allows for the execution of malicious payloads without triggering security alerts. The research highlights the effectiveness of this approach against a wide range of endpoint protection platforms. The speaker provides a proof-of-concept implementation that successfully executes tools like Mimikatz in a protected environment.
Bypassing EDR/XDR via User-land Ntdll Hooking: The HookChain Technique
TLDR: This research introduces HookChain, a technique that bypasses EDR/XDR solutions by intercepting and redirecting system calls within user-land Ntdll. By dynamically mapping system service numbers and patching the Import Address Table (IAT), attackers can execute malicious payloads like Mimikatz without triggering behavioral alerts. Pentesters should use this to test the efficacy of their current EDR telemetry, while defenders must look beyond simple user-land hooks to detect these sophisticated redirection patterns.
Endpoint security has reached a point where most modern EDR and XDR solutions rely heavily on user-land hooking within Ntdll.dll. By placing hooks on critical functions, these tools monitor for suspicious activity before a system call ever reaches the kernel. This research, presented at DEF CON 2024, demonstrates that this reliance on user-land monitoring is a structural weakness. HookChain proves that if you can control the execution flow before the EDR sees it, you can effectively blind the security agent to your actions.
The Mechanics of HookChain
HookChain is not a standalone tool but a methodology for intercepting the execution chain. Most EDRs monitor for specific API calls by patching the beginning of functions in Ntdll. When an application calls a function like NtAllocateVirtualMemory, the EDR's hook redirects execution to its own analysis engine. If the EDR deems the call safe, it returns control to the original function.
The HookChain technique bypasses this by operating at a lower level of the call stack. Instead of trying to unhook Ntdll, which is often detected, HookChain identifies the system service number (SSN) associated with the desired function. It then dynamically resolves the address of the corresponding system call instruction within Ntdll. By creating a custom stub function that mimics the necessary parameters and executing the system call directly, the attacker avoids the EDR's hook entirely.
The research demonstrates this by modifying the Import Address Table (IAT) of a target process. By replacing the address of a standard function with the address of a custom, malicious stub, the attacker forces the application to execute their code instead of the legitimate system function. This is particularly effective because the EDR expects the call to originate from a specific location in the call stack. When the call originates from the attacker's stub, it appears legitimate to the EDR's monitoring logic.
Technical Implementation and Execution
Implementing this requires a deep understanding of the Windows system call interface. The process involves three primary steps: resolving the SSN, locating the system call instruction, and patching the IAT.
// Simplified logic for resolving SSN and executing a direct syscall
// This is a conceptual representation of the HookChain stub
void MyNtAllocateVirtualMemory(...) {
// 1. Resolve the SSN for NtAllocateVirtualMemory
// 2. Locate the syscall instruction in Ntdll
// 3. Execute the syscall directly
__asm {
mov r10, rcx
mov eax, [SSN]
syscall
}
}
The research highlights that the most effective way to handle this is by using a technique similar to Halo's Gate. By searching for the system call instruction in the memory space surrounding the hooked function, an attacker can dynamically determine the correct SSN even if the EDR has modified the function's prologue. This makes the technique resilient against EDRs that attempt to detect hooking by checking for common patterns.
During the demonstration, the researcher successfully executed Mimikatz in an environment protected by several top-tier EDR products. By using HookChain to redirect the necessary memory allocation and process access calls, the tool was able to dump credentials without triggering a single alert. The EDR remained in a "safe" state, completely unaware that the process memory had been accessed and modified.
Real-World Applicability for Pentesters
For those conducting red team engagements, this technique is a game-changer. It allows for the execution of post-exploitation tools in environments where traditional process injection or credential dumping would be immediately blocked. The key is the transparency of the technique. Because the execution flow remains within the expected parameters of the application, the EDR has no reason to flag the activity as malicious.
When testing, focus on the IAT of your target binaries. If you are using a C2 framework like Havoc, you can implement these stubs to ensure your beacon's communication and tasking remain stealthy. The impact is significant: you can maintain persistence and perform lateral movement in environments that were previously considered "hardened" against these types of attacks.
Defensive Considerations
Defenders must recognize that user-land hooking is no longer a sufficient control. If your EDR relies solely on Ntdll hooks, you are vulnerable to any technique that can bypass them. To mitigate this, security teams should prioritize kernel-level monitoring. Technologies like Kernel Callback Functions and Event Tracing for Windows (ETW) provide visibility into system calls that cannot be easily bypassed by user-land modifications.
Furthermore, monitoring for unexpected IAT modifications is critical. While this is difficult to do at scale, focusing on high-value processes and monitoring for memory protection changes (e.g., PAGE_EXECUTE_READWRITE) can help identify when an attacker is attempting to patch the IAT. The cat-and-mouse game continues, but by understanding the mechanics of how these bypasses work, we can build more resilient detection strategies. Investigate your EDR's visibility into direct system calls and ensure your team is looking for the right telemetry, not just the absence of alerts.
Vulnerability Classes
Tools Used
Target Technologies
Attack Techniques
Up Next From This Conference

Breaking Secure Web Gateways for Fun and Profit

Listen to the Whispers: Web Timing Attacks That Actually Work

Abusing Windows Hello Without a Severed Hand
Similar Talks

Social Engineering A.I. and Subverting H.I.

Living off Microsoft Copilot

