Chalkybot / Syscall-Winapi-Rust

A demo of how to utilize syscalls in Rust to avoid EDR hooks.
4 stars 1 forks source link

Utilizing direct syscalls with Rust to avoid hooks

This repo is a proof concept of utilizing direct syscalls with Rust to avoid ntdll hooks placed by EDRs / Antiviruses.

At the time of writing, this can use known bad shellcode (a meterpreter shell), and bypass the majority of big name antimalware solutions. Having a custom reverse shell would make this far better.

Demo

Demo GIF

Clicking on the image opens a link to the demo video.

The execution flow:

Usage

Very simple, generate shellcode and pack it to a vector of u8. After this, place it to the DATA type in build.rs, and build. The build.rs encrypts the shellcode with random keys and packs in different sections of the resulting binary.

Using the binary is as simple as running it with the PID of your target process. You can inject to processes that aren't SecureObjects and are owned by your account without admin permissions, but setting SeDebugPrivilege to access SecureObjects does require admin privileges.

Why this works

This is purely sceptical, but my assumption is that as Rust binaries haven't been around for as long as C/C++ binaries, especially in the malware scene. This results in normal techniques not being fingerprinted.

A process having syscalls should itself already be a huge red flag, but even that flag can be avoided as as they can just be generated on the fly with WriteProcesMemory or another similar tool.

Please don't use this for bad stuff, it's just a demo.