"Listen to the shadows, not the API."
Full Transparency: This project was created primarily as a Proof of Concept (PoC) and a beta test to evaluate the capabilities of modern AI in writing low-level Windows Internals code (C++/MASM).
My goal was to see if AI could successfully generate complex malware evasion techniques like:
- Manual PEB walking
- EAT parsing
- Hell's/Halo's Gate dynamic SSN resolution
I used Gemini 3 PRO, Github Copilot and Chatgpt 5.1
My role in this project: Prompt engineering, conceptual architecture, debugging, assembling the MASM stubs, and verifying the execution flow. It is a research prototype, not a fully weaponized tool.
For educational and research purposes only. NightCall demonstrates concepts (Indirect Syscalls, API Hashing, PEB walking) intended for security researchers and authorized Red Team exercises. Do not use these techniques for unauthorized access or malicious activity.
NightCall is a proof-of-concept syscall loader built to illustrate techniques used to avoid user-land hooks placed by Endpoint Detection & Response (EDR) systems. Instead of importing WinAPI or issuing direct syscall instructions from injected stubs, NightCall demonstrates an indirect approach that preserves a legitimate-looking call stack and avoids common user-mode hook detections.
This repository is intended as a learning resource for defensive researchers, OS internals students, and Red Teamers operating under authorization.
- 🚀 Indirect Syscalls — jumps to the
syscallinstruction insidentdll.dllso the call stack appears to originate from ntdll. - 🔎 Dynamic SSN Resolution — implements variations of "Hell's Gate" and "Halo's Gate" logic to resolve System Service Numbers at runtime and handle hooked syscall stubs.
- 🧭 No WinAPI Imports — discovers modules and functions via PEB walking and manual Export Address Table parsing (no
GetModuleHandle/GetProcAddressentries in the IAT). - 🔐 API Hashing — obfuscates module and function names using a case-insensitive djb2 hash to remove readable strings from the binary.
- 🧰 x64 ABI Compliance — ensures proper stack alignment and reserves Shadow Space before transitions to kernel mode.
- 🛡️ Safety Checks — bounds-checks
.textsections and avoids reading forwarders or uncommitted memory.
-
PEB Walk
- Locate
ntdll.dllby traversing the Process Environment Block's module lists.
- Locate
-
Manual EAT Parsing
- Parse
ntdll's Export Address Table and compare hashed function names to identify syscall stubs.
- Parse
-
Gate Logic
- Inspect the function stub bytes to determine whether the stub is "clean" or has been hooked.
- If hooked, perform neighborhood scanning (Halo's Gate) to infer the correct SSN from nearby stubs.
-
Indirect Execution
- Prepare registers (
r10,eax), align the stack, allocate shadow space, then perform an indirect jump to thesyscallinstruction contained withinntdll.dll.
- Prepare registers (
NightCall/
│
├── NightCall.cpp # Main C++ logic (PEB walking, hashing, gate logic)
├── syscalls.asm # MASM implementation of the indirect syscall stub
└── README.md # Documentation
Requirements
- Visual Studio 2019 or 2022 with the "Desktop development with C++" workload.
Quick steps
- Clone the repository.
- Open the solution in Visual Studio.
- Enable MASM:
- Project → Build Dependencies → Build Customizations... → Check
masm. - Right-click
syscalls.asm→ Properties → Item Type →Microsoft Macro Assembler.
- Project → Build Dependencies → Build Customizations... → Check
- Set configuration to
Releaseand platform tox64(x86 is not supported). - Build the solution (Ctrl+Shift+B).
Note: The MASM configuration is a critical step — the assembly stub must be assembled with MASM for x64.
The main() function currently demonstrates a PoC flow: it resolves a hashed name, finds the SSN and the syscall address for NtOpenProcess, and prepares to invoke it indirectly.
Example console output:
[*] Hash for NtOpenProcess: 0x71E3518A
[*] Searching for SSN and Syscall Address...
[+] SUCCESS!
|-> SSN: 0x26
|-> Syscall Address: 0x00007FFB3216D642
[*] Ready to invoke (Indirect Syscall).
To extend:
- Define additional native API prototypes in the C++ source.
- Add corresponding syscall stubs or use the existing indirect stub to invoke other native APIs.
(Use responsibly — this repository is a learning resource, not a turnkey offensive tool.)
- Hell's Gate / Halo's Gate techniques — VxUnderground & Sektor7 community
- SysWhispers — popularized direct/indirect syscall generation
- ReactOS — Windows internals references
- Tartarus Gate — advanced hooking detection ideas
Made for research. Keep it ethical.