A low-entropy shellcode executor that encodes shellcode bytes into common English words.
In short, many security software use the entropy of sections within binaries to determine if they contain encrypted or obfuscated code. By encoding shellcode bytes into English words, we can create a binary with very low entropy, which is less likely to be flagged by such security measures. You can watch Will Summerhill's presentation "Simplified Malware Development - Entropy and Other Techniques" to learn more.
Here's a "Hello, World!" shellcode encoded into English words:
...and this what the shellcode looks like when it's encoded and stored in the binary:
This project was originally a part of the CyberSci CTF challenge Vector Veil. It has been removed from the challenge before the competition, but I thought it might be a useful tool for bypassing heuristic-based security measures during pentests, so I decided to release it as a standalone project.
Aside from the basic shellcode encoding/decoding functionality, this shellcode executor also features the following anti-debug/analysis techniques:
- Stores the DJB2 hash of the English words in the lookup table instead of plaintext strings.
- Detects debuggers by abusing the
SIGTRAPsignal handler; executesexit(0);if debuggers are detected. - Obfuscates the control flow by manually overwriting the
mainfunction's return address with the allocated shellcode's address. - Hides the allocation of r/w/x memory in the
_init_arrayand the main code in the_fini_arraysomainappears to be empty.
I might add more in the future for fun.
This repo contains a built-in NASM template and shellcode encoding tools that allow you to easily create a binary that's ready to be deployed. All you need to do is to write your NASM code in the src/shellcode.nasm file, then compile the project.
- Write your own position-independent NASM shellcode program in
src/shellcode.nasm. - Compile the project by running
make. The shellcode will be automatically compiled, encoded, and embedded into the outputbin/lexiconbinary.
You can also prepare your own shellcode.
- Write your shellcode in a binary file and place it at
src/shellcode.bin. - Compile the project by running
make custom. The shellcode will be automatically encoded and embedded into the outputbin/lexiconbinary.