Skip to content
RCE Write-up Advanced

Exploit Archeology - Exploiting an old unknown Server Side Browser

An API endpoint rendered user-supplied HTML and executed JavaScript using an outdated WebKit engine (circa Safari 8). The author developed a full remote code execution exploit by chaining a use-after-free in JSArray::sortCompactedVector with JIT compilation to achieve shellcode execution.

Alex Chapman Follow

Published on blog.ajxchapman.com

I was recently hacking on a Bug Bounty target and identified an interesting API endpoint which would render user supplied HTML, and execute any included JavaScript. Exploiting Server Side Browser bugs has been a focus of mine for the past couple of years, so I set out to exploit this newly identified feature.

Alex Chapman (@ajxchapman), on blog.ajxchapman.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely a use-after-free vulnerability in WebKit's JSArray::sortCompactedVector function, combined with the engine's JIT compiler leaving executable memory writable.

Impact

An attacker could achieve remote code execution on the server hosting the vulnerable browser, but the bug bounty program stated the vulnerability was in a third-party service, not their own.

What the attacker needed

API endpoint that renders user HTML and runs JS; Outdated WebKit engine (circa Safari 8); Ability to send HTML to the endpoint

How it was found

  1. Send HTML with an image tag pointing to a controlled server to read the User-Agent header.
  2. Use JavaScript feature detection to identify the browser engine and approximate version.
  3. Test a known PoC for the JSArray::sortCompactedVector use-after-free to confirm the target crashes.
  4. Set up a local PhantomJS build with debugging symbols to develop the exploit.
  5. Build read, write, and addrOf primitives from the corrupted array and a Float64Array.
  6. Force JIT compilation of a function, overwrite its instructions in memory, and call it to execute shellcode.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A server-side browser is a program on a website's server that loads web pages, often to take screenshots or generate previews. If that browser is old and has known bugs, an attacker can send it a malicious web page that takes control of the server. Here, the old browser was a version of WebKit from around 2014, and the attacker found a memory corruption bug that let them run their own code on the server.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by Alex Chapman

View all

1 more disclosed report, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.