Security analysts might encounter shellcode when examining exploits that they detect on the network, observe inside malicious document files, or find on compromised systems. This note recommends two tools for converting shellcode into x86 assembly instructions that the analyst can read to understand the exploit and its payload: ConvertShellcode.exe and shellcode2exe.py.
The ConvertShellcode.exe tool for Windows parses the supplied shellcode string and immediately disassembles it, converting the string into corresponding x86 assembly instructions. This tool was
written by Alain Rioux.
The “shellcode” string can follow any of the following formats:
You can download ConvertShellcode.exe as a zip archive.
The shellcode2exe.py script accepts shellcode encoded as a string or as raw binary data, and produces an executable that can run that shellcode. You load the resulting executable file into a debugger to examine its. This approach is useful for analyzing shellcode that’s difficult to understand without stepping through it with a debugger. This script was written by Mario Vilas, and was later tweaked by Anand Sastry to accept not only shellcode in binary form, but also shellcode encoded using “\x” strings via the “-s” parameter. The script was further updated by Patrick Copeland to accept as input shellcode encoded using “%u” strings via the “-u” parameter.
You can download the latest shellcode2exe.py script, written in Python, from the author’s Github repository.