Skip to content

WABT - WebAssembly Binary Toolkit Cheatsheet

WABT - WebAssembly Binary Toolkit Cheatsheet

WABT (pronounced “wabbit”) is the reference WebAssembly Binary Toolkit — a suite of command-line tools for working with wasm at a low level. It converts between the binary .wasm format and the human-readable .wat text format, disassembles and dumps modules, validates them, produces a C-like decompilation, and interprets/executes wasm. It is the foundational toolbox for both wasm development and reverse engineering.

Installation

PlatformCommand
macOS (Homebrew)brew install wabt
Debian/Ubuntusudo apt install wabt
Arch Linuxsudo pacman -S wabt
npmnpm install -g wabt
From sourcebuild with CMake from the WebAssembly/wabt repo
Verifywat2wasm --version

The Core Tools

ToolConverts / does
wat2wasmText .wat → binary .wasm
wasm2watBinary .wasm → text .wat (disassemble)
wasm-objdumpDump sections, opcodes, symbols
wasm-decompileProduce readable C-like pseudocode
wasm-validateValidate a module
wasm-interpInterpret/run a module (stack machine)
wasm2cConvert wasm → C source
wasm-stripRemove sections (e.g. names) from a module

Text ↔ Binary

# Assemble text to binary
wat2wasm module.wat -o module.wasm

# Disassemble binary to text (the RE starting point)
wasm2wat module.wasm -o module.wat

# Keep debug names / custom sections while disassembling
wasm2wat --generate-names module.wasm
OptionEffect
-o FILEOutput file
--generate-namesSynthesize names for unnamed funcs/locals
--enable-FEATURETurn on a wasm proposal (e.g. --enable-threads)
-vVerbose

Inspecting a Module (objdump)

# Full section + disassembly dump
wasm-objdump -x module.wasm      # headers/sections
wasm-objdump -d module.wasm      # disassemble code
wasm-objdump -s module.wasm      # section contents (hex)
FlagShows
-hSection headers
-xDetails of all sections
-dDisassembled function bodies
-sRaw section contents
-j SECTIONLimit to one section

Decompiling (Readable Output)

# C-like decompilation — much easier to read than WAT
wasm-decompile module.wasm -o module.dcmp

wasm-decompile reconstructs structured control flow and typed locals, making it a fast way to understand what a module does during triage.

Validate & Run

CommandPurpose
wasm-validate module.wasmConfirm the module is well-formed
wasm-interp module.wasm --run-all-exportsExecute exported functions
wasm2c module.wasm -o module.cEmit C for compilation/analysis

Reverse-Engineering Workflow

# 1) Disassemble with names
wasm2wat --generate-names target.wasm -o target.wat

# 2) Dump imports/exports to understand capabilities
wasm-objdump -x target.wasm | grep -E "import|export"

# 3) Get readable pseudocode
wasm-decompile target.wasm -o target.dcmp

# 4) Hunt for strings/URLs in data sections
wasm-objdump -s target.wasm | less

Feature Flags (Proposals)

FlagEnables
--enable-threadsThreads/atomics
--enable-simdSIMD
--enable-bulk-memoryBulk memory ops
--enable-reference-typesReference types
--enable-allAll supported proposals

Use these when a module uses newer wasm features and the default tools reject it.

ToolRole
WABTConvert/inspect/validate/decompile wasm
diswasmHigher-level pseudocode decompiler
wasm-toolsRust low-level manipulation
BinaryenCompiler/optimizer toolchain (wasm-dis, wasm-opt)

Resources