Lion Cipher Lab
Read a WebAssembly module as text: find what it imports, what it exports, and the string hidden in its memory
- AppSec / DevSecOps
- Intermediate
- ~50 min
- Free · no account required
Why it matters
WebAssembly lets code written in languages like C, C++ and Rust run in a browser and in server-side runtimes at close to native speed. That is useful, and it also means opaque binary modules arrive on pages and in packages, and an analyst sometimes has to say what one does. The good news is that wasm is designed so that this is easier than for a native program: the code is organised into typed functions, control flow is structured, and every module declares exactly what it imports and exports. This lab builds a small module on purpose and then reads it three ways (as text, as a table of…
What you'll learn
- explaining what WebAssembly is and why it is easier to analyse than a native binary
- writing a small module in the WebAssembly text format (WAT) and assembling it with wat2wasm
- listing a module's imports and exports and what each one means for the host
- reading stack-machine instructions such as local.get, i32.const and i32.add
- finding a hard-coded string in a data segment of linear memory
- taking a .wasm file apart with wasm2wat and wasm-objdump (headers, details, disassembly, raw sections)
- running a module end to end with node's WebAssembly API and a small import object
- knowing what static reading cannot tell you
Steps in this lab
- What WebAssembly is, in four ideas
- Install WABT and check Node
- Write a small module in the text format
- Assemble it and look at every byte
- Triage the file: headers, then imports and exports
- Find the hard-coded string in the data segment
- Read the code: disassembly and the round trip back to text
- Run it end to end with Node
- Change it and watch the behaviour change
- Why wasm is easier to analyse than native code, and where it is not
- Clean up
Open the full interactive lab →