What is syscalls-cpp?
syscalls-cpp is a C++20 policy-based framework for crafting undetectable/protected syscalls on Windows (x86/x64). It provides a modular, compile-time approach to system call invocation that gives you full control over operational security tradeoffs. The core principle is modularity. You are not given a black box; you are given building blocks.Why syscalls-cpp?
Traditional syscall libraries often provide limited flexibility and can be easily detected by security software. syscalls-cpp addresses these challenges by:- Policy-based Design: Mix and match allocation, stub generation, and parsing strategies at compile-time
- Automatic Resolution: Directly parses ntdll.dll metadata to resolve system call numbers
- Hook Resilience: Leverages PE structure (exception directory on x64, sorted exports on x86) to bypass user-mode hooks
- Adjacent Syscall Detection: Can find nearby syscalls if a target is patched
- Type Safety: Leverages C++20 concepts for compile-time validation

SEC_NO_CHANGE protected section fails.
Architecture Overview
The framework is built around three core policy types:Allocation Policies
Control how memory for syscall stubs is allocated:| Policy | Method | Security Level |
|---|---|---|
allocator::section | NtCreateSection with SEC_NO_CHANGE flag | Highest - prevents patching |
allocator::heap | HeapCreate with HEAP_CREATE_ENABLE_EXECUTE | Medium |
allocator::memory | NtAllocateVirtualMemory (RW → RX) | Standard |
Stub Generation Policies
Define how syscall instructions are generated:| Policy | Method | Platform |
|---|---|---|
generator::direct | Classic self-contained syscall instruction | x86/x64 |
generator::gadget | Jumps to syscall; ret gadget in ntdll.dll | x64 only |
generator::exception | Triggers breakpoint (ud2) via custom VEH | x86/x64 |
Parsing Policies
Determine how syscall numbers are resolved:| Policy | Method | Notes |
|---|---|---|
parser::directory | Maps exception directory (.pdata) to exports (x64) or sorts Zw* exports (x86) | Primary method |
parser::signature | Scans function prologues with hook detection | Fallback with halo gates |
Key Features
Compile-time Policy Selection
Choose allocation, generation, and parsing strategies at compile-time for zero runtime overhead
Extensible Design
Create custom policies by implementing simple C++20 concepts
Hook Detection
Automatically detects and bypasses common hooking techniques
Thread-safe
Built-in synchronization for safe concurrent usage
Example Usage
Here’s a simple example of allocating memory using direct syscalls with section-based protection:Next Steps
Installation
Install syscalls-cpp using vcpkg or Conan
Quick Start
Get started with a step-by-step guide