The generator::gadget policy uses syscall; ret gadgets found in ntdll.dll’s .text section. Instead of executing the syscall instruction from your own code, it redirects execution to legitimate syscall instructions within ntdll.dll.
This generator is x64 only. It is not available on x86 platforms.
When EDR/AV inspects the call stack during syscall execution, it sees the syscall originating from ntdll.dll’s .text section - exactly where legitimate syscalls should come from.
Return Address Validation
Many security products validate that syscalls return to legitimate code. With gadgets, the return address points to your stub, but the syscall itself executes from ntdll.dll.
Memory Region Analysis
Security tools that flag syscalls from unusual memory regions (heap, private memory, etc.) won’t trigger since the syscall instruction is in ntdll.dll’s .text section.
Pattern Diversity
Using multiple random gadgets makes it harder to establish a detection pattern compared to always using the same syscall location.
Platform Support: Only works on x64 Windows. The x86 version uses different calling conventions and syscall mechanisms.Initialization Overhead: Must scan ntdll.dll’s .text section to find gadgets during initialization.Slight Performance Cost: The stub uses indirect jumps which are slightly slower than direct syscalls.