What is Native API Abuse – Bitdefender TechZone
2026-10-01
Native API Abuse (T1106) bypasses EDR usermode hooks entirely via direct syscalls, syscall injection, unhooking, and dynamic SSN resolution. Each bypass family defeats a different hook-based detection layer. Reliable defense requires kernel-mode monitoring—ETW-TI events, stack unwinding, kernel callbacks—and behavioral correlation on injection outcomes.
When attackers need to inject code into a remote process without triggering an EDR, they go under it. The Windows Native API — exported by ntdll.dll — sits one layer below the Win32 API and exposes the syscall interface directly. EDR products hook ntdll's exported stubs to intercept sensitive operations before they reach the kernel. Attackers bypass those hooks by issuing syscalls directly, borrowing ntdll's syscall instruction with a spoofed service number, or restoring a clean unhooked copy of ntdll at runtime.
This article covers all three bypass families (MITRE ATT&CK T1106), the syscall number resolution problem that underpins them, and the detection signals that operate at the kernel layer, beyond where usermode sensors can reach.
Native API Abuse Example
An incident responder reviewing endpoint telemetry sees a suspicious memory write complete in a target process. The injected content executed, yet no NtWriteVirtualMemory call appeared in the EDR hook trace.
The operation was invisible to the sensor's usermode hook layer because the attacking loader never touched ntdll's hooked stub. It issued the syscall instruction directly — Extended Accumulator Register (EAX) preloaded with the correct service number, execution transferred straight into the kernel. The hook was never invoked because it was never reached.
The detection signal that eventually flagged the activity was a syscall address range check: the syscall instruction address was outside the address range of ntdll as mapped in the process. That discrepancy catches one family of this evasion class. The other two require sensors that operate inside ntdll's address range or at the kernel layer, beyond where usermode sensors can reach. Each bypass family exploits a different property of Windows syscall dispatch. The detection section below maps which signals catch which families — and which blind spots each signal carries.
What Native API Abuse Is
Native API abuse is not an exploit technique. It does not attack a vulnerability in the target process or the operating system. It uses Windows' own syscall dispatch mechanism — the architecture that every process on the system uses legitimately — to issue sensitive operations while bypassing the EDR's interception layer.
The distinction that matters for detection: because the bypass operates at or below the usermode hook surface, the EDR's hook never executes. Detection depends on sensors that operate below that surface — kernel callbacks, ETW-TI events, hypervisor-level monitoring — not on the hook state of ntdll in the attacking process. The tool issuing the syscall is irrelevant. The mechanism is what matters.
![]() |
How the Windows Call Chain Works
Win32 API functions — CreateRemoteThread, WriteProcessMemory, and their peers — are thin wrappers. Each translates to a corresponding Native API function exported from ntdll.dll: NtCreateThreadEx, NtWriteVirtualMemory, and so on. Each ntdll export contains a short stub that loads a System Service Number (SSN) into the EAX register and executes the syscall instruction, transferring execution from usermode into the Windows kernel. The kernel reads the SSN, looks up the corresponding function in the System Service Dispatch Table (SSDT), and invokes it.
ntdll is the lowest layer of Windows accessible from usermode. Below it sits the kernel, reachable only through the syscall gate. MITRE ATT&CK T1106 covers the abuse of this boundary to execute process operations while bypassing higher-level API monitoring.
EDR products hook ntdll stubs because it is the logical intercept point: the stubs run in the same address space as the inspected process, carry full call context, and are reachable without kernel modifications. The mechanism works because Windows allows a process to modify its own virtual memory, including its private copy of ntdll. The EDR overwrites the first bytes of each stub with a JMP instruction into its inspection engine. What makes this design convenient for security vendors is also what makes it bypassable: the hook lives entirely in the process's private committed memory mapping for ntdll. It is not written to the on-disk image, nor is it enforced by hardware. Any code running in that process with write access to its own memory space can route around it.
Direct Syscalls
The simplest bypass skips ntdll entirely. Instead of calling a hooked NtWriteVirtualMemory stub, the attacker's code emits the syscall instruction inline with the correct System Service Number (SSN) preloaded into EAX. Execution transitions directly into the kernel, leaving the hooked stub completely untouched.
Why this works: The kernel's syscall dispatcher validates the SSN in EAX and dispatches the corresponding function. It does not check where in usermode address space the syscall instruction originated, nor does it inspect the call stack at the time of dispatch.
The tooling ecosystem is mature. Tools like SysWhispers, SysWhispers2, and SysWhispers3 generate assembly stubs with hardcoded or dynamically resolved SSNs that compile directly into loader shellcode or Beacon Object Files (BOFs). C2 frameworks including Cobalt Strike and Havoc implement these stubs natively, making direct syscall execution standard equipment in modern post-exploitation tooling.
The detection angle: The syscall instruction address falls outside ntdll's mapped memory range in the target process. A sensor operating at the kernel layer can flag this discrepancy immediately. Usermode sensors miss it entirely because the hook is never invoked.
Indirect Syscalls
The EDR response to direct syscalls was syscall address origin validation: if the syscall instruction address falls outside ntdll's mapped memory range, flag the event. Indirect syscalls defeat this by executing a syscall instruction that physically resides inside ntdll while supplying an SSN chosen by the attacker.
The mechanism: The attacker's code scans ntdll stubs in memory to locate the address of the syscall instruction inside an exported function, then constructs a custom stub that loads the desired SSN into EAX and jumps (JMP) directly to that instruction address inside ntdll. The processor executes the syscall from within ntdll's mapped range, causing the address origin check to pass.
Why this works: There is no hardware enforcement governing how execution arrives at the syscall instruction. A JMP into ntdll from external unbacked code is architecturally indistinguishable at the CPU level from a standard execution flow. Tools implementing this pattern include RecycledGate and TartarusGate, both of which scan ntdll exports to locate valid syscall bytes and build stubs that jump to them.
The detection angle: Call stack return-address inspection. When a sensor operating at the kernel layer unwinds the call stack upon syscall dispatch, indirect syscalls produce a return-address chain that exits ntdll immediately without passing through the expected API caller hierarchy. This creates an anomalous stack frame that can be flagged by any sensor capable of stack unwinding (such as ETW-TI or kernel callbacks).
The video above shows Havoc's Demon agent executing process injection via indirect syscalls. The syscall instruction executes from inside ntdll's mapped range, successfully bypassing origin validation. However, the detection signal remains in the call stack: the return-address chain exits ntdll without passing through the expected caller hierarchy — a discrepancy visible to sensors operating at the kernel layer.
Unhooking
If an EDR hook lives in the process's private memory mapping of ntdll, replacing that mapping with a clean version removes the hook entirely without altering the on-disk binary.
Three practical implementation variants:
Disk reloading: Reading ntdll.dll directly from \System32\ on disk and copying its clean .text section over the hooked in-memory section.
KnownDlls mapping: Mapping ntdll directly from the \KnownDlls\ section object — a repository of pre-mapped system DLL images maintained by the Session Manager at boot that EDR hooks never touch.
Section remap: Calling NtMapViewOfSection to map a fresh view of ntdll's image file section directly over the process's existing hooked mapping.
![]() |
Why this works: EDR hooks are injected into memory by the security agent after the process loads. They are never written to the on-disk image, never reflected in the \KnownDlls\ section, and not tracked by the Windows kernel. Overwriting the modified in-memory mapping discards the hook bytes and restores original native stubs.
The detection angle: Anomalous NtMapViewOfSection calls requesting an ntdll image mapping outside the standard Windows loader initialization sequence, as well as .text section memory modification events or unexpected page permission changes (PAGE_EXECUTE_READWRITE) during section remapping.
Dynamic SSN Resolution: Hell's Gate, Halo's Gate, Tartarus' Gate
Direct and indirect syscalls both require the correct System Service Number (SSN) for each target function. SSNs are not static — they change across Windows major releases and even between cumulative updates within the same release. A loader using a hardcoded SSN for NtWriteVirtualMemory on Windows 10 22H2 will issue the wrong syscall on Windows 11 24H2. The kernel then dispatches whichever function happens to correspond to that provided SSN, resulting in undefined behavior or a process crash.
Dynamic resolution solves this problem through several evolving techniques:
Hell's Gate (2020): Scans each ntdll stub for the mov eax, <SSN> instruction at the stub's entry point and reads the SSN from that immediate value — a technique that works reliably when the stub is intact and unhooked.
Halo's Gate: Addresses scenarios where the target stub is hooked and its opening bytes are replaced with a JMP. It scans neighboring functions in ntdll's export table and infers the target function's SSN by offset, exploiting the predictable numeric increment across adjacent syscall stubs.
Tartarus' Gate: Extends this logic to handle stubs that are selectively patched mid-instruction or protected by non-standard hooks, using anomaly checking across multiple neighboring exports to calculate the correct SSN.
![]() |
The detection angle: A loader relying on dynamic resolution must iterate ntdll's export table and inspect raw bytes across the .text section at runtime. This sequential byte-reading scan pattern is distinct from standard loader behavior and serves as a key behavioral indicator when correlated with subsequent suspicious process or memory operations.
Common Mistakes and Misconceptions
"EDR products that hook ntdll catch all Native API abuse"
Usermode hooks are a single layer in a defense stack, not an exhaustive capture net. Direct syscalls bypass the stub entirely. Indirect syscalls route through the stub's physical address without invoking its inspection logic. Unhooking restores original bytes so no hook remains. Each bypass family defeats the hook through a different mechanism, and no hook-based detection catches all three. Comprehensive defense requires sensors that operate at the kernel layer, beyond the usermode hook surface.
"Direct syscalls make malware completely invisible to the kernel"
They bypass usermode sensors, not kernel visibility. Kernel callbacks registered via PsSetCreateProcessNotifyRoutine, PsSetCreateThreadNotifyRoutine, and related APIs fire as part of standard OS operation regardless of how the syscall was issued. A loader issuing NtCreateThreadEx via a direct syscall still triggers the kernel's thread creation callback if a kernel driver has registered one. ETW-TI events and hypervisor-level inspection are equally unaffected. The bypass surface is strictly the EDR's usermode hook layer — nothing deeper.
"Syscall numbers are stable across Windows versions"
They are not. Microsoft does not publish or guarantee SSN stability. Service numbers are reassigned between major releases and routinely shift between cumulative updates within the same release. The Hell's Gate lineage — Hell's Gate, Halo's Gate, and Tartarus' Gate — exists precisely because hardcoded SSNs break, making progressively more sophisticated dynamic resolvers necessary as EDR products adapted their hooking methods.
What Reliable Native API Abuse Signals Look Like
No signal below catches every bypass family; the value is in knowing which one each covers and where it goes blind. Each is rated against a standard Windows 10/11 endpoint with a kernel-mode sensor present. The detection angle for each technique is covered in its section above.
Signal | Reliability | Notes |
|---|---|---|
Syscall address range check | High | Catches direct syscalls, where the instruction address falls outside ntdll's mapped range; blind to indirect syscalls, which execute from inside it. |
Call stack return-address inspection | High | Catches indirect syscalls, where the return chain exits ntdll without passing through the expected callers; requires kernel-mode stack unwinding. |
Kernel callbacks (PsSet*) | High | Process creation, thread creation, and image load are reported regardless of syscall path; defeated only by a separate kernel-mode driver suppressing callbacks. |
ETW-TI events | Medium | Memory allocation and thread injection, generated inside the kernel before returning to usermode; requires the EDR to subscribe to the provider, and correlation to manage volume. |
ntdll .text section integrity | Medium | Catches unhooking, where the in-memory section diverges from expected state; the baseline must account for expected hook bytes, not the pristine on-disk image. |
Reliability High means the signal produces very few false positives on an endpoint with a kernel-mode sensor present. Reliability Medium means it requires tuning or correlation before it is actionable.
Correlation Strategy: A single syscall address anomaly in isolation carries low confidence; that same signal immediately preceding remote thread creation in a high-value process is a high-confidence injection indicator. When an anomaly triggers:
Identify the process that issued the anomalous syscall.
Review its parent-child ancestry for injection precursors.
Check for ntdll .text modification anomalies within the same process.
Correlate with cross-process memory writes or thread creation within the surrounding time window.
Mitigation
Every control below assumes the usermode hook will be bypassed and shifts detection to layers beyond where usermode evasions can reach.
Deploy kernel-level telemetry: Utilize a kernel-mode security sensor that registers PsSet callbacks and consumes ETW-TI (Threat Intelligence) events so coverage does not depend on usermode hook integrity.
Enforce Driver Signature Enforcement (DSE): Enforce strict kernel-mode code signing. This significantly increases the effort required for an attacker to deploy a vulnerable or malicious kernel driver (BYOVD) to disable callbacks — the primary route to defeating the kernel callback layer.
Monitor DLL section remapping: Track anomalous NtMapViewOfSection calls that reload system DLLs outside the standard process initialization sequence. This is what unhooking looks like to external monitoring.
Detect runtime export scanning: Alert on runtime ntdll export scanning and memory page inspection that occurs without a legitimate loader or diagnostic component in the call stack ancestry. This is what dynamic SSN resolution looks like in execution.
Bitdefender GravityZone Detection
Bypass techniques that operate at or below the usermode hook surface require detection sensors that operate at the kernel layer, beyond where usermode evasions can reach.
![]() |
Kernel-API Monitoring is the layer that catches the attack in the demonstration. GravityZone's kernel driver registers callbacks for process creation, thread creation, and module loading, while also subscribing to ETW-TI events — which the kernel generates regardless of whether the call passed through ntdll. Because it operates in kernel mode, it can unwind the call stack upon syscall completion. This is the exact signal that exposes Havoc's Demon agent: while its syscall executes from inside ntdll's mapped range and passes the address origin check, its return-address chain exits ntdll without passing through the expected caller hierarchy.
Process Protection pairs Advanced Threat Control (ATC) with kernel-mode Process Introspection to monitor process behavior at runtime. ATC applies over 300 behavioral patterns alongside machine learning to process groups during execution. It keys on behavioral sequences — anomalous cross-process memory allocation, RWX memory regions in processes lacking legitimate JIT runtimes, suspicious handle requests, and remote thread creation — rather than the specific API path used. This sequence-based focus preserves detection effectiveness even after usermode instrumentation is bypassed. Process Introspection complements ATC at the kernel level by identifying trusted processes being abused as injection targets.
The Endpoint Sensor (EDR) and GravityZone XDR Correlation Engine consolidate handle requests, memory allocations, thread creations, and network connections into a single incident graph. This ties the anomalous syscall directly to the injection payload it served instead of leaving it as an isolated event, while Historical Search exposes the full execution context for Security Operations Center (SOC) investigation.
Related Resources
MITRE ATT&CK T1106: Native API — technique reference covering usermode Native API use to execute process operations while bypassing higher-level monitoring.
SysWhispers3, GitHub (klezVirus) — current generation of direct syscall stub generation tooling; documents the SSN resolution problem and its evolution across SysWhispers versions.
Outflank, "Direct Syscalls in Beacon Object Files" (December 2020) — primary documentation of direct syscall use in Cobalt Strike BOF payloads.
Hell's Gate (smelly__vx and am0nsec, 2020) — foundational SSN dynamic resolution technique; the lineage origin for Halo's Gate and Tartarus' Gate.



