First V8 Bugs: Array OOB to Shellcode


Browser Exploitation: A CTF Study Path.

Your first V8 bugs: a patched builtin or a corrupted array length lets you read and write past the end of a JavaScript array. From there the path is always the same, and worth learning by heart: leak an object's address (addrof), forge a fake object (fakeobj), build an arbitrary read/write, and overwrite code that is about to run (classically the RWX page of a WebAssembly instance) with shellcode. Learn pointer compression and tagged values with %DebugPrint before you start.

Where to start

Start with Baby Browser. Run d8 --allow-natives-syntax, make a few arrays and objects, and %DebugPrint them. Find the map, the elements pointer and the length in memory with gdb (job, x/8gx), and work out how pointer compression turns a 32-bit tagged value into an address. Then write addrof and fakeobj from the OOB, an arbitrary read/write on top of them, and finally overwrite a WebAssembly instance's RWX code. Keep the result as a template: most later challenges only change the first step.

Reading



Challenges

MCTF 2025 Quals · difficulty ★☆☆☆☆ · module: First V8 Bugs: Array OOB to Shellcode

A small patch to array handling that gives a little too much room. The canonical first V8 exploit.

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 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 ~/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

RU:
Почувствуй тепло JS’a (Получение флага через catflag)

EN:
Feel the warmth of JS (Getting the flag via catflag)

Points

4942

Solves

7

Credits

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

RSTCON 2025 CTF · difficulty ★☆☆☆☆ · module: First V8 Bugs: Array OOB to Shellcode

Another patched array operation, from the other direction. Same end-to-end chain as Baby Browser.

Engine: V8 (d8), 13.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'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, snapshot_blob.bin.

Original challenge

Description

V8 Takes too much RAM, so I made a quick change that should help that. If only it would get widely adopted...

Download my project here.

The remote instance is at 

Points

Unknown

Solves

Unknown

Credits

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

PatriotCTF 2024 · difficulty ★☆☆☆☆ · module: First V8 Bugs: Array OOB to Shellcode

An array length that can be changed without the checks it should go through.

Engine: V8 (d8), 11.9.99

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): chall.diff, d8.gz, snapshot_blob.bin.

Original challenge

Description

XSS is hard! Let's get some practice in with a javascript REPL first

(flag is at /flag.txt, d8 is built off tag 11.9.99)

Points

478

Solves

Unknown

Credits

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

SAS CTF 2024 Quals · difficulty ★☆☆☆☆ · module: First V8 Bugs: Array OOB to Shellcode

Two new array methods, readAt and writeAt. Read their bounds checks carefully.

Engine: V8 (d8), 12.0.267.17

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 target was a patched Chromium; the handout's release d8 has the same bug. The original's flag file is replaced by /readflag: run it from the shell or shellcode your exploit gets.

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, pwn.diff, snapshot_blob.bin.

Original challenge

Description

Oh, nice, OOB RW, this can't be tough to exploit, right? Right...?

- We are running modified version of the 
chromium browser. The challenge is to 
exploit introduced vulnerability, to
read contents of /ubercaged/flag.txt.
You can find already prebuilt and

Points

Unknown

Solves

Unknown

Credits

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

DownUnderCTF 2020 · difficulty ★☆☆☆☆ · module: First V8 Bugs: Array OOB to Shellcode

A patched Array.prototype.slice on a V8 from the early pointer-compression era.

Engine: V8 (d8), 8.7.9

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 /chal/flagprinter 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, patch.diff, snapshot_blob.bin.

Original challenge

Description

Why do some people think browser exploitation == web?

Once you get code execution, you can execute /chal/flagprinter to get the flag. No need to get a shell.

V8 commit: 47054c840e26394dea0e36df47884202a15dd16d
V8 version: 8.7.9

Challenge files: https://storage.googleapis.com/files.duc.tf/uploads/pwn/is-this-pwn-or-web/challenge.tar.gz (sha256: e1c70edde66932ca3ee9285fe37c04254ae5a0e00b265c68fe93440bbe3256e8)

Points

498

Solves

10

Credits

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

Infobahn CTF 2025 · difficulty ★★☆☆☆ · module: First V8 Bugs: Array OOB to Shellcode

A custom ArrayMagic builtin. Work out what it does to an array's backing store.

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 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): PATCH.diff, d8.gz, snapshot_blob.bin.

Original challenge

Description

In chaos theory, the butterfly effect is the idea that a tiny change in one state can cause vast differences later.

Points

240

Solves

14

Credits

  • Challenge author(s): Jopraveen, for Infobahn CTF 2025
  • 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