Direct syscall construction from first principles
Hades Gate is a pure first-principles direct syscall implementation that bypasses userland EDR/AV hooks by:
GetModuleHandle)GetProcAddress)Caller → hg_syscall("NtAllocateVirtualMemory")
↓
hg_find_ntdll() - PEB walking (no APIs)
↓
hg_resolve() - Manual PE export parsing
↓
Extract SSN from stub (4C 8B D1 B8 XX...)
↓
hg_build_stub() - Generate clean syscall stub
↓
Execute direct syscall → Kernel
# Developer Command Prompt for VS 2022
cl /O2 /GS- examples\test.c src\hades_gate.c /Fe:hades_test.exe
hades_test.exe
Expected output:
[*] Hades Gate - Pure PEB Walker
[1] ntdll base: 0x00007FF87E600000
[2] NtQuerySystemInformation SSN: 54 (0x36)
[3] Syscall result: 0xC0000004
[+] Hades Gate is WORKING!
#include "hades_gate.h"
// Typedef for the syscall
typedef NTSTATUS (NTAPI* pNtAllocateVirtualMemory)(
HANDLE ProcessHandle,
PVOID* BaseAddress,
ULONG_PTR ZeroBits,
PSIZE_T RegionSize,
ULONG AllocationType,
ULONG Protect
);
int main() {
// Get clean syscall stub
void* stub = hg_syscall("NtAllocateVirtualMemory");
if (!stub) return 1;
// Cast to function pointer
pNtAllocateVirtualMemory NtAllocateVirtualMemory =
(pNtAllocateVirtualMemory)stub;
// Use it (never touches hooked ntdll!)
PVOID buffer = NULL;
SIZE_T size = 0x1000;
NTSTATUS status = NtAllocateVirtualMemory(
GetCurrentProcess(), &buffer, 0, &size,
MEM_COMMIT, PAGE_READWRITE
);
// Cleanup
VirtualFree(stub, 0, MEM_RELEASE);
return 0;
}
Hades Gate is built upon the Holy Trilogy:
- Fukahi Na Tekiō - SGN XOR Encoder
- ASLR Bypass - ASLR BYPASS
- SHELLCODE research - SHellcode research
This implementation honors Jake's vision of first-principles security research - knowledge should be free and accessible to all.
VirtualAlloc (replace with NtAllocateVirtualMemory via Hades Gate)hg_find_ntdll)Hades Gate is a red team tool for research. Detection considerations:
- PAGE_EXECUTE_READWRITE memory is suspicious
- Direct syscalls without normal call stack may be detected
- Use indirect syscalls and proper memory protection for production
⛧ From first principles, with respect to those who came before ⛧
// click a file to view source