2Pack
December 28, 2025 Β· View on GitHub
Rust Based PE & Shellcode Packer
π Overview
2Pack is a simple packing tool designed for malware hobbyists. It supports both PE files (EXE/DLL) and raw shellcode. The tool employs multiple layers of protection including AES encryption, XOR obfuscation, and compression before embedding payloads in the .rsrc sections of template loaders.
β οΈPlease note that all templates were written with no evasion techniques in mind, This project was created solely for educational purposes to learn more about windows internals. The techniques implemented are very outdated and mainstream, there is 0 chance of making it past any self-respecting AV/EDR :(
I will continue updating the templates as I progress in my maldev journery <3
βοΈUsage:
- Specify the input file using
--inputor-i - Specify the file format using
--formator-f - Specify the mode, either local or remote, using
--modeor-m - Specify the targeted process for injetction in remote mode using
--processor-p - Specify the template file using
-tor--template
Example:
> cargo run --bin tpack -- --input shellcode.bin --format shellcode --mode remote --template stomper --process Calc.exe
πTemplates:
β‘οΈ Stomper : --template stomper
Remote Function stomping via memory patching. The template Allocates RWX memory in target process, injects payload, and overwrites NtQuerySystemTime entry with jumps to injected shellcode.
π» Hollower : --template hollower
Remote Process Hollowing where the template creates a suspended process pointing to legitimate code, then hollows out the thread's context to redirect execution to injected shellcode.
π Reflective-Loader : --template reflective-loader
A custom PE loader that manually parses and maps portable executable files (EXE-DLL) directly into memory without using the Windows loader or touching the disk.
π‘ Templates parameters
| Stomper | Hollower | Reflective-Loader | |
|---|---|---|---|
| Local | β | β | β |
| Remote | β | β | β |
| Shellcode | β | β | β |
| Exe | β | β | β |
| Dll | β | β | β |
π οΈ CUSTOM TEMPLATES
All template source code is located in src/templates_src/. To create a custom template:
- Modify the Rust source code of your chosen template
- Compile using: cargo build --bin [template_name] --release
- Place the compiled binary in templates/compiled/ with a .2pk extension
Example:
cargo build --bin remote_shellcode_stomper --release
copy target/release/remote_shellcode_stomper.exe templates/compiled/remote_shellcode_stomper.2pk
π DISCLAIMER
You are responsible for ensuring you have proper authorization before using this tool. The author assumes no liability for misuse.
π€ Collaborations
This is an ongoing project, contributions and suggestions are welcome! If you have ideas, improvements, or would like to collaborate, feel free to reach out at: M0kht4rHacks@protonmail.com