WebAssembly Engine Bugs


Browser Exploitation: A CTF Study Path.

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



Challenges

RITSEC CTF 2021 · difficulty ★★★☆☆ · module: WebAssembly Engine Bugs

WebAssembly.Memory gains a shrink method. Ends in the glibc heap.

Engine: V8 (d8), 8.7.220

Running it

Put your exploit at /home/hacker/exploit.js and run /challenge/run. It passes it to the engine as a file, with the original challenge's flags: d8 exploit.js. The engine runs as an unprivileged user (uid 1001) that cannot read /flag.

Once your code runs inside the engine (shellcode, or a shell it spawns), execute /readflag to print the flag, as in the original challenge.

The original runner printed the flag once /bin/sh was executed; here run /readflag from that shell.

A __free_hook-style ending is sensitive to the exact heap layout, which can change with where the engine's output goes (terminal, pipe or file): if it works under gdb or in your copy but not through /challenge/run, make the exploit groom the heap more robustly.

Debugging it

Debug your own copy (no root needed; --allow-natives-syntax enables %DebugPrint and %SystemBreak, remove those calls before the real run):

mkdir -p ~/dbg && cd ~/dbg && cp -r /challenge/. . && gunzip -fr . && chmod +x d8
./d8 --allow-natives-syntax ~/exploit.js
gdb -q --args ./d8 --allow-natives-syntax ~/exploit.js

Files in /challenge (executables are gzip-compressed): d8.gz, snapshot_blob.bin, v8.diff, v8.patch.

Original challenge

Description

This is a JS engine pwn challenge.

V8 version: 8.7.220

V8 commit: 0d81cd72688512abcbe1601015baee390c484a6a

glibc version: 2.31

OS: Ubuntu 20.04.2 - 64 bit

Provided challenge files: V8 debug and release builds, diff and patch files, challenge setup files, libc.so.6

The server will be running the release build.

Note: My intended solution is not only about 90% reliable so if you are sure it has worked locally, in debug or release, but cannot get it to work remotely, please try to run your exploit many more times. Please talk to me if you think there is an issue.

Give us a link to your exploit and we will run it like ./d8 <file.js>

Note: If you execute /bin/sh the runner will try to print flag for you. If you go any other ways and it works locally but not remotely, please talk to me.

If you have a working exploit locally for babywasm but it does not work remotely when you give the URL, and if you host it from your own server, your server might have blocked our server from downloading it, most likely due to user-agent string. So please find somewhere public like pastebin and post it there unlisted to try again. Thank you!

Points

485

Solves

5

Credits

  • Challenge author(s): flyingpassword, for RITSEC CTF 2021
  • Compiled by: mito753 in Browser-Exploit-Dojo, which also has the original handout, exploits and writeups

Google CTF 2024 · difficulty ★★★☆☆ · module: WebAssembly Engine Bugs

Wasm tables and the types of what is stored in them.

Engine: V8 (d8), 12.8.0

Also uses techniques from: Escaping the V8 Sandbox (06-sandbox).

Running it

Put your exploit at /home/hacker/exploit.js and run /challenge/run. It passes it to the engine as a file, with the original challenge's flags: d8 --sandbox-testing exploit.js. The engine runs as an unprivileged user (uid 1001) that cannot read /flag.

Once your code runs inside the engine (shellcode, or a shell it spawns), execute /readflag to print the flag, as in the original challenge.

The original's flag file is replaced by /readflag: run it from the shell or shellcode your exploit gets.

print is removed from this build: use console.log.

Debugging it

Debug your own copy (no root needed; --allow-natives-syntax enables %DebugPrint and %SystemBreak, remove those calls before the real run):

mkdir -p ~/dbg && cd ~/dbg && cp -r /challenge/. . && gunzip -fr . && chmod +x d8
./d8 --allow-natives-syntax --sandbox-testing ~/exploit.js
gdb -q --args ./d8 --allow-natives-syntax --sandbox-testing ~/exploit.js

Files in /challenge (executables are gzip-compressed): d8.gz, snapshot_blob.bin, v8.patch.

Original challenge

Description

IT'S BOILIN

heat.2024.ctfcompetition.com 1337

Points

320

Solves

16

Credits

  • Challenge author(s): not recorded (credit goes to the Google CTF 2024 organizers)
  • Compiled by: mito753 in Browser-Exploit-Dojo, which also has the original handout, exploits and writeups

DeadSec CTF 2025 · difficulty ★★★☆☆ · module: WebAssembly Engine Bugs

Liftoff returns an i32. What about the other 32 bits?

Engine: V8 (d8), 14.0.0

Also uses techniques from: Escaping the V8 Sandbox (06-sandbox).

Running it

Put your exploit at /home/hacker/exploit.js and run /challenge/run. It passes it to the engine as a file, with the original challenge's flags: d8 --sandbox-testing prelude.js exploit.js. The engine runs as an unprivileged user (uid 1001) that cannot read /flag.

As in the original challenge, the engine itself may read the flag (/flag): the goal is to make it reveal it.

As in the original, the patched sandbox crash filter prints /flag when it detects a V8 sandbox violation.

On the original server /flag was world-readable, so d8.file.read('/flag') was an unintended one-line solve. Here prelude.js (in /challenge) runs first and deletes d8's file and realm builtins, so the intended sandbox violation is needed; the Sandbox API is untouched.

Debugging it

Debug your own copy (no root needed; --allow-natives-syntax enables %DebugPrint and %SystemBreak, remove those calls before the real run):

mkdir -p ~/dbg && cd ~/dbg && cp -r /challenge/. . && gunzip -fr . && chmod +x d8
./d8 --allow-natives-syntax --sandbox-testing prelude.js ~/exploit.js
gdb -q --args ./d8 --allow-natives-syntax --sandbox-testing prelude.js ~/exploit.js

Files in /challenge (executables are gzip-compressed): d8.gz, prelude.js, probe.diff, snapshot_blob.bin.

Original challenge

Description

https://drive.google.com/file/d/16RDUIRb43Zm-J2SdXL4ZOjnCqYck6IZa/view?usp=sharing

V8 Sandbox Is Good Mitigation

https://www.deadsec.xyz/instances/deadv8

Points

194

Solves

34

Credits

  • Challenge author(s): un3xploitable, for DeadSec CTF 2025
  • Compiled by: mito753 in Browser-Exploit-Dojo, which also has the original handout, exploits and writeups

CrewCTF 2025 · difficulty ★★★★☆ · module: WebAssembly Engine Bugs

WasmGC's array.fill and its bounds check.

Engine: V8 (d8), 14.2.0

Running it

Put your exploit at /home/hacker/exploit.js and run /challenge/run. It passes it to the engine as a file, with the original challenge's flags: d8 exploit.js. The engine runs as an unprivileged user (uid 1001) that cannot read /flag.

Once your code runs inside the engine (shellcode, or a shell it spawns), execute /home/pwn/flag_reader to print the flag, as in the original challenge.

Debugging it

Debug your own copy (no root needed; --allow-natives-syntax enables %DebugPrint and %SystemBreak, remove those calls before the real run):

mkdir -p ~/dbg && cd ~/dbg && cp -r /challenge/. . && gunzip -fr . && chmod +x d8
./d8 --allow-natives-syntax ~/exploit.js
gdb -q --args ./d8 --allow-natives-syntax ~/exploit.js

Files in /challenge (executables are gzip-compressed): d8.gz, diff.patch, snapshot_blob.bin.

Original challenge

Description

BRO CTF IS WEEKEND AFTER THIS WDYM LATER

Points

449

Solves

9

Credits

  • Challenge author(s): Linz, for CrewCTF 2025
  • Compiled by: mito753 in Browser-Exploit-Dojo, which also has the original handout, exploits and writeups

ASIS CTF Finals 2025 · difficulty ★★★★★ · module: WebAssembly Engine Bugs

Wasm type canonicalization, and two types that should never be the same.

Engine: V8 (d8), 14.5.0

Running it

Put your exploit at /home/hacker/exploit.js and run /challenge/run. It passes it to the engine as a file, with the original challenge's flags: d8 --no-memory-protection-keys exploit.js. The engine runs as an unprivileged user (uid 1001) that cannot read /flag.

Once your code runs inside the engine (shellcode, or a shell it spawns), execute /home/pwn/flag_reader to print the flag, as in the original challenge.

This machine's CPU may have memory protection keys (PKU), which make V8 write-protect WebAssembly code; --no-memory-protection-keys (not an original flag) restores the original server's behaviour.

Debugging it

Debug your own copy (no root needed; --allow-natives-syntax enables %DebugPrint and %SystemBreak, remove those calls before the real run):

mkdir -p ~/dbg && cd ~/dbg && cp -r /challenge/. . && gunzip -fr . && chmod +x d8
./d8 --allow-natives-syntax --no-memory-protection-keys ~/exploit.js
gdb -q --args ./d8 --allow-natives-syntax --no-memory-protection-keys ~/exploit.js

Files in /challenge (executables are gzip-compressed): d8.gz, diff.patch, snapshot_blob.bin.

Original challenge

Description

You shall not pass the Singleton!

Points

450

Solves

2

Credits

  • Challenge author(s): not recorded (credit goes to the ASIS CTF Finals 2025 organizers)
  • Compiled by: mito753 in Browser-Exploit-Dojo, which also has the original handout, exploits and writeups

RCTF 2025 · difficulty ★★★★★ · module: WebAssembly Engine Bugs

A validator with some checks taken out.

Engine: V8 (d8), 14.4.0

Running it

Put your exploit at /home/hacker/exploit.js and run /challenge/run. It passes it to the engine as a file, with the original challenge's flags: d8 --no-memory-protection-keys exploit.js. The engine runs as an unprivileged user (uid 1001) that cannot read /flag.

Once your code runs inside the engine (shellcode, or a shell it spawns), execute /read_the_flag to print the flag, as in the original challenge.

Debugging it

Debug your own copy (no root needed; --allow-natives-syntax enables %DebugPrint and %SystemBreak, remove those calls before the real run):

mkdir -p ~/dbg && cd ~/dbg && cp -r /challenge/. . && gunzip -fr . && chmod +x d8
./d8 --allow-natives-syntax --no-memory-protection-keys ~/exploit.js
gdb -q --args ./d8 --allow-natives-syntax --no-memory-protection-keys ~/exploit.js

Files in /challenge (executables are gzip-compressed): d8.gz, icudtl.dat, patch.diff, snapshot_blob.bin.

Original challenge

Description

V8 WebAssembly challenge

The attachments can be downloaded via the following two optional links.

Decompression password:RCTF2025
https://pan.baidu.com/s/1rB9WLDdisX2sFNnzxZl_WA?pwd=8tf3
https://drive.google.com/file/d/1-YJayuLKrEDfAD0Brnk9XplIzEBfVlR5/view?usp=sharing

Points

833

Solves

5

Credits

  • Challenge author(s): not recorded (credit goes to the RCTF 2025 organizers)
  • Compiled by: mito753 in Browser-Exploit-Dojo, which also has the original handout, exploits and writeups

30-Day Scoreboard:

This scoreboard reflects solves for challenges in this module after the module launched in this dojo.

Rank Hacker Badges Score