WebAssembly is a second compiler pipeline inside V8, with its own validator, baseline compiler (Liftoff), optimizing compiler and, with WasmGC, its own type system. Bugs here give type confusions between Wasm and JavaScript values or memory-safety bugs in Wasm's runtime. Build modules by hand with wasm-module-builder.js (from the V8 source tree) and learn the binary format.
Where to start
Write a few modules by hand first: read the text format, then build the same module with wasm-module-builder.js (load it into d8) and dump the bytes. For each challenge, decide which stage the patch touches (decoder/validator, Liftoff, the optimizing tier, the runtime, or WasmGC type canonicalization). Use --liftoff-only or --no-liftoff to pin a function to one tier. Most bugs end as confusion between a Wasm reference and a number, or between two Wasm struct types, and from there you build the same addrof/fakeobj as module 01.
Reading
- Understanding WebAssembly text format (MDN): modules, functions, memories and tables, readably.
- WebAssembly compilation pipeline: lazy compilation, Liftoff and tier-up in V8, with the flags that control them.
- Liftoff: a new baseline compiler for WebAssembly in V8: how the baseline tier emits code and handles values, relevant to DeadV8.
- wasm-module-builder.js: the helper V8's own tests use to build modules from JavaScript.
- WebAssembly GC proposal overview: structs, arrays, subtyping and recursive type groups behind WasmGC bugs.
- CVE-2024-2887: A Pwn2Own Winning Bug in Google Chrome (Manfred Paul, ZDI): a real WasmGC type-section bug and its exploitation.
- Let the Cache Cache and Let the WebAssembly Assemble (Black Hat USA 2024): Wasm type canonicalization and how it goes wrong.
Challenges
30-Day Scoreboard:
This scoreboard reflects solves for challenges in this module after the module launched in this dojo.
| Rank | Hacker | Badges | Score |