PhantomsGate is a sophisticated shellcode injection technique that leverages Hell's Gate to dynamically find syscall numbers, modifies system calls, and uses thread hijacking to inject and execute shellcode within a target process. This technique is designed to evade detection and bypass security mechanisms by dynamically resolving syscall numbers and executing shellcode in the context of existing threads.
PhantomGate is an improvement over LiesGate, adding the ability to dynamically modify functions to use different syscall numbers, set hardware breakpoints, and update registers. This enhanced method provides additional stealth and flexibility, making it even more effective in evading detection.
- Dynamic Syscall Resolution (Hell's Gate): Finds syscall numbers dynamically by analyzing function bytes in
ntdll.dll
. - Function Modification: Modifies functions to use different syscall numbers.
- Thread Hijacking: Suspends and resumes threads to execute shellcode.
- Hardware Breakpoints: Sets hardware breakpoints on functions for additional control.
- Register Updates: Updates registers and continues execution seamlessly.
- Windows OS
- Visual Studio or a compatible C++ compiler
- Administrative privileges for process and thread manipulation
- Dynamic Syscall Resolution: The
FindSyscallNumber
function parses the bytes of a function inntdll.dll
to find the syscall number. - Function Modification: The
ModifyFunctionToSyscall
function modifies the first few bytes of a function to directly invoke a syscall with a specified syscall number. - Loading Shellcode: Shellcode is read from a binary file and written into the target process's memory.
- Memory Protection: Changes the memory protection of the allocated shellcode region to
PAGE_EXECUTE_READ
. - Thread Hijacking: Takes a snapshot of the target process's threads, finds a thread, suspends it, modifies its context to point to the shellcode, and resumes it.
- Hardware Breakpoints: Sets a hardware breakpoint on the modified function for additional control.
- Compile the Code: Use Visual Studio or a compatible C++ compiler to compile the code.
- Run the Program: Execute the compiled binary with administrative privileges, specifying the target process ID and the shellcode file.
This project is licensed under the MIT License.
- LiesGate Implementation [https://github.com/CyberSecurityUP/LiesGate]
- MutationsGate Implementation [https://github.com/senzee1984/MutationGate]
- HellsGate [https://github.com/am0nsec/HellsGate]