https://github.com/am0nsec/SharpHellsGate/
Does the following
Perform direct x64 syscalls
Dynamic resolution of syscall IDs
Utilizes JIT RWX space to hide syscalls
More Technical Details
I have created an modification that is a bit easier to extend for direct syscall usage, in my opinion. I found it hard to figure out a simple way to note out the original repo here, so I made a smaller implementation that would be easier to explain how to extend. https://github.com/susMdT/SharpAndSimpleHellsGate
Key difference is that I am not using the hashing technique; the nt functions are called in plaintext name (for simplicity).
directSyscall
Method, passing in an object array of our arguments
//Initialize variables and an object array beforehand so we can capture updated args
IntPtr baseAddr = IntPtr.Zero;
IntPtr regionSize = (IntPtr)3000;
object[] allocArgs = new object[] {
(IntPtr)(-1),
baseAddr,
IntPtr.Zero,
regionSize,
Macros.MEM_COMMIT ,
Macros.PAGE_EXECUTE_READWRITE
};
directSyscall<Delegates.NtAllocateVirtualMemory>(
ntdll.GetSyscallId("NtAllocateVirtualMemory"),
freeRWX,
allocArgs
);
//Updating our vars
baseAddr = (IntPtr)allocArgs[1];
regionSize = (IntPtr)allocArgs[3];
directSyscall<Delegates.NtProtectVirtualMemory>(
ntdll.GetSyscallId("NtProtectVirtualMemory"),
freeRWX,
new object[] {
(IntPtr)(-1),
baseAddr,
regionSize,
Macros.PAGE_EXECUTE_READ,
(uint)0}
)