Skip to content
shellcodes

How to decode and disassemble shellcode

Turn raw shellcode bytes back into assembly — decode hex and escape formats, disassemble with Capstone, and spot bad characters before you run it.

Published on 2 min read

Never run bytes you have not read — especially bytes you did not write. Decoding and disassembling shellcode tells you what it actually does and surfaces problems before they cost you an exploit attempt. For background, see what shellcode is.

Why decode shellcode

Three reasons:

  • Trust — an example off the internet might do more than it claims.
  • Debugging — your own payload "doesn't work" and you need to see what assembled.
  • Bad-char hunting — find forbidden byte values before delivery, not after.

Common encodings

Shellcode travels in several skins. You usually decode to raw bytes first:

FormatLooks like
Escaped hex\x31\xc0\x50…
C array0x31, 0xc0, 0x50…
Plain hex31c05068…
Base64McBQaC8v…

Strip the wrapper, get the bytes, then disassemble.

Disassembling to mnemonics

Raw bytes mean nothing until you turn them back into instructions. A disassembler decodes them to assembly so \x31\xc0 reads as xor eax, eax. The Shellcodes converter does this with Capstone mnemonics and picks up where one instruction ends and the next begins — which is how you catch a payload that does something other than advertised.

Reading the bytes

The disassembly tells you the logic; a hex view tells you about the bytes themselves — embedded strings, suspicious values, and forbidden characters. What to look for before you copy anything is in what the hex viewer tells you.

One trap worth calling out: disassemble in the wrong CPU mode and you get plausible-looking garbage. The same bytes decode differently as 32-bit and 64-bit, so an x64 payload read as x86 produces instructions that are real but wrong. Always set the architecture to match the payload before you trust a single line of the output.

Decode it now

Paste an escaped or hex blob into the Shellcodes converter to normalize the format and disassemble it. Confirm it matches your intent, check it against your bad-char set, and only then run it — inside an isolated lab you control. Authorized testing only: responsible use.

Related articles

Annotated shellcode examples for Linux x86 and x64 — execve /bin/sh and reverse TCP — with the bytes, the disassembly, and the gotchas.
How Linux shellcode works — syscalls, registers, and position-independent code — and how to assemble, encode, and test it safely.
Compare ways to generate shellcode — msfvenom, hand-rolled assembly, and a browser-based generator — with the trade-offs and when to use each.