Escaping the V8 Sandbox


Browser Exploitation: A CTF Study Path.

Since 2023 V8 keeps its heap inside a sandbox: an arbitrary read/write inside the cage is no longer code execution. These challenges give you the in-sandbox primitive (often directly, via --sandbox-testing's Sandbox API) and ask you to escape: corrupt trusted pointers, bytecode, code entry points or the native stack until you control rip. Read V8's sandbox design docs first.

Where to start

Read the sandbox README and blog post, then run a recent d8 with --sandbox-testing and use the Sandbox object to corrupt objects by hand. Notice what you can reach: everything inside the cage, but raw pointers to the outside go through tables (external, trusted and code pointer tables) that you can index but not forge. For each challenge, list what still trusts in-cage data (bytecode and its register file, a table index, a length used outside the cage, the native stack) and aim to control rip. Check the V8 version: the 2022 sandbox is much weaker than the 2024 one.

Reading



Challenges

HITCON CTF 2024 Quals · difficulty ★★★★☆ · module: Escaping the V8 Sandbox

The Sandbox testing API, plus one more method that should not be there.

Engine: V8 (d8), 12.8.163

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.

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.patch.

Original challenge

Description


https://storage.googleapis.com/hitcon-ctf-2024-qual-

Points

315

Solves

13

Credits

  • Challenge author(s): ljp_tw, for HITCON CTF 2024 Quals
  • Compiled by: mito753 in Browser-Exploit-Dojo, which also has the original handout, exploits and writeups

DiceCTF 2022 · difficulty ★★★★☆ · module: Escaping the V8 Sandbox

An early sandbox: Array.prototype.setLength gives in-cage R/W; get out.

Engine: V8 (d8), build from DiceCTF 2022 (version not recorded)

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'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 ~/exploit.js
gdb -q --args ./d8 --allow-natives-syntax ~/exploit.js

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

Original challenge

Description

literally 1984.


note: you should read the design doc of The Cage and its code; try to understand how it works, since it'll be hard to solve this challenge by just jit monkeying.

Points

458

Solves

3

Credits

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

Google CTF 2023 · difficulty ★★★★☆ · module: Escaping the V8 Sandbox

Ignition bytecode and the registers it indexes.

Engine: V8 (d8), 11.6.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 /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 ~/exploit.js
gdb -q --args ./d8 --allow-natives-syntax ~/exploit.js

Files in /challenge (executables are gzip-compressed): 0001-Protect-chunk-headers-on-the-heap.patch, d8.gz, snapshot_blob.bin, v8.patch.

Original challenge

Description

My JavaScript code is trapped in a cage and can't get out! Can you help it escape?

v8box.2023.ctfcompetition.com 1337

Points

Unknown

Solves

Unknown

Credits

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

V1T CTF 2026 · difficulty ★★★★☆ · module: Escaping the V8 Sandbox

A PDF-style AcroForm object with reset() and resize().

Engine: V8 (d8), 15.1.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 /readflag to print the flag, as in the original challenge.

The original ran on Ubuntu 24.04: libc offsets in public solves need redoing for this image's glibc 2.31.

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, icudtl.dat, snapshot_blob.bin.

Original challenge

Description

v8.8.8-final-draft-edited-part-8

Server: 

Points

345

Solves

32

Credits

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

TRX CTF 2026 · difficulty ★★★★★ · module: Escaping the V8 Sandbox

Same binary as triforce; this time leave the sandbox.

Engine: V8 (d8), 14.9.0

Also uses techniques from: JIT Compilers: TurboFan and Maglev (03-jit).

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 (environment: FLAG=/flag). 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.

Same d8 as triforce; this time escape the V8 sandbox and execute /readflag. $FLAG names /flag, which the engine cannot read.

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
FLAG=/flag ./d8 --allow-natives-syntax ~/exploit.js
gdb -q -ex 'set environment FLAG=/flag' --args ./d8 --allow-natives-syntax ~/exploit.js

Files in /challenge (executables are gzip-compressed): d8.gz, patch.sh, sbx.patch, triforce.patch.

Original challenge

Description

This has the same remote and attachments as Triforce

Points

477

Solves

4

Credits

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

BackdoorCTF 2024 · difficulty ★★★★★ · module: Escaping the V8 Sandbox

An exposed memory-corruption API on V8 13. One solve during the CTF.

Engine: V8 (d8), 13.3.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 /getflag to print the flag, as in the original challenge.

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 ~/exploit.js
gdb -q --args ./d8 --allow-natives-syntax ~/exploit.js

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

Original challenge

Description

Wasm and JIT are so 2019. Let's isolate them and go back to our roots.

Points

500

Solves

1

Credits

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

GPN CTF 2024 · difficulty ★★★★★ · module: Escaping the V8 Sandbox

The Sandbox API, and a crash filter that rewards a real sandbox violation.

Engine: V8 (d8), 12.7.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 --sandbox-testing --enable-experimental-regexp-engine 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.

As in the original, a detected V8 sandbox violation makes d8 run /bin/sh: from it, execute /readflag. 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 --enable-experimental-regexp-engine ~/exploit.js
gdb -q --args ./d8 --allow-natives-syntax --sandbox-testing --enable-experimental-regexp-engine ~/exploit.js

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

Original challenge

Description

With the last Date not going as planned, you are lucky to get another chance. Make sure to not fuck it up this time.

Points

500

Solves

1

Credits

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

KITCTFCTF 2022 · difficulty ★★★★★ · module: Escaping the V8 Sandbox

--jitless and no Wasm: escape with ROP alone. Zero solves during the CTF.

Engine: V8 (d8), commit 29131d5e3ea9

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 --jitless --no-expose-wasm 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 /catflag 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 --jitless --no-expose-wasm ~/exploit.js
gdb -q --args ./d8 --allow-natives-syntax --jitless --no-expose-wasm ~/exploit.js

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

Original challenge

Description

You managed to get yourself an actual real life d8. A once in a lifetime opportunity. However, the slot machine is keeping you busy. What will you do?

Points

500

Solves

0

Credits

  • Challenge author(s): ju256, for KITCTFCTF 2022
  • 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