Skip to content
RCE Write-up Advanced

Researchers Demonstrate Ghostscript Sandbox-Escape RCE via Crafted File Uploads in Popular Apps

A use-after-free in Ghostscript's font-loading code lets a crafted document disable the -dSAFER sandbox and run commands on the server. Attackers could reach it through ordinary upload, preview, print, and email features in about ten applications, sometimes without logging in.

[email protected] (The Hacker News) Follow

Published on thehackernews.com

{{media:0}}

The Hacker News, on thehackernews.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 in Ghostscript's font-loading code that lets a crafted document bypass the -dSAFER sandbox checks.

Impact

A crafted file could run commands on the server as the low-privilege rendering account, and some paths needed no login, though an AppArmor profile stopped a shell in one test.

What the attacker needed

A crafted document; an app that passes files to Ghostscript; sometimes no login needed; otherwise an upload-capable account

The fix

Ghostscript was fixed in version 10.08.0, and WordPress closed its own upload path in 7.0.4; both updates are needed because they cover different points in the chain.

How it was found

  1. Create a crafted document that exploits the font-loading use-after-free.
  2. Deliver it through an application feature that passes files to Ghostscript, such as an upload, preview, print job, or email attachment.
  3. Open or process the file so the application's image or document library hands it to Ghostscript.
  4. The crafted document disables the -dSAFER sandbox and runs a command as the low-privilege rendering account.

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.

Ghostscript is a program that turns PDFs and images into other formats, and it runs on many servers. A bug in it lets a specially made file break out of the safety box that is meant to stop files from running commands. Because many apps pass uploaded files to Ghostscript without saying so, a normal upload or email attachment can trigger it.

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 [email protected] (The Hacker News)

View all

5 more disclosed reports, 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.