Upload2Shell: A Crafted File Can Run Commands on Your Server — Patch Ghostscript

Written by

in

Ghostscript is software most people have never heard of, sitting underneath other programs and quietly turning PDFs and PostScript files into images, previews, and printed pages. This week researchers showed that a flaw in it, nicknamed Upload2Shell, lets a crafted file break out of Ghostscript’s sandbox and run commands on the server doing the rendering. They demonstrated it through WordPress, Roundcube webmail, and a Linux print server — three ordinary features, one broken renderer underneath all of them.

What happened

The flaw is tracked as CVE-2026-125396. Paulos Yibelo and the team at pwn.ai published the research on November 17, with the full technical write-up following on November 21. It is a use-after-free in Ghostscript’s Type 1 font loader: a helper in the font-loading code can be made to fail partway through an operation, and a document can use that failure to complete a privileged write it was never supposed to control. That write alters the state enforcing Ghostscript’s -dSAFER mode — the sandbox meant to keep a document from touching your system — and after that, commands run with the permissions of whatever process was rendering the file.

The CVE record scores it 8.5 under CVSS 4.0 and lists a local attack vector. Do not let that word “local” relax you. It describes the flaw at the interpreter level. The researchers’ point is that network-facing services hand remotely supplied files to that interpreter every day, so the file does the traveling even when the attacker never logs in.

Every upstream Ghostscript release before 10.08.0 is affected. Artifex fixed the flaw in 10.08.0.

Who it affects

Anyone whose server renders files it did not create. The three demonstrations cover most of the ways that happens:

WordPress. On a site using Imagick and ImageMagick for media processing, a crafted file reached Ghostscript through the media preview process. That route required an account with media upload privileges — Authors and above, by default. WordPress tracks its side of the upload issue separately as CVE-2026-65640 and fixed it in 7.0.4, backported to older supported releases including 6.9.7. The researchers also found that certain public upload features in the Forminator and Essential Addons for Elementor plugins reached the renderer without a login, in the configurations they tested. That second part is the one that should get a site owner’s attention.

Roundcube webmail. On Roundcube 1.7.2, the sender needed no account at all. The recipient only had to view the message — no click, no download — because the server generated a thumbnail of the attachment and passed it through ImageMagick to Ghostscript. The commands ran as www-data, the web service account. That demonstration depended on an ImageMagick policy allowing the handoff — exactly the kind of setting most admins have never looked at.

Linux print servers. On Debian 13, a shared CUPS queue accepted print jobs from the network without credentials and sent the document to Ghostscript for conversion. No recipient action at all. The researchers confirmed execution by writing a marker file as lp, the print service account.

How bad is it, really?

Here is what it is not: it is not confirmed to be exploited in the wild. The research describes demonstrations, not attacks, and the flaw is not in CISA’s Known Exploited Vulnerabilities catalog. The commands also run as the rendering service account, not automatically as root.

Here is what it is: a sandbox escape in a component behind uploads, email attachments, and print jobs on a huge number of Linux servers, with working demonstrations through software a lot of us run. And patching it has a trap. Distributions backport the fix into older Ghostscript packages, so a server can be fully patched while gs --version still shows a number below 10.08.0 — Debian 13’s fix shipped in package 10.05.1~dfsg-1+deb13u2. The version number alone misleads in both directions; check your distribution’s package status for this CVE.

What to actually do

1. Update Ghostscript the way your distribution tells you to. Install your distro’s security update, or upstream 10.08.0, and verify against the CVE in your vendor’s tracker — not against the raw version number.

2. Update WordPress too. Apply the core update that carries the CVE-2026-65640 fix, and keep auto-updates on. Then look hard at any plugin that lets the public upload files. A public upload form that feeds the Media Library is the riskiest door in these demonstrations.

3. Find every copy, not just the system one. Updating the host does not patch Ghostscript bundled inside a container or an application. If it renders files, inventory it.

4. Lock down print queues. A shared CUPS queue should require authentication and should not be reachable from networks that have no business printing. Requiring authentication blocked anonymous submission in the researchers’ test — it does not fix the flaw, but it closes the easiest path to it.

5. Give renderers nothing extra. The commands inherit the service account’s access, so that account should reach almost nothing: no write access outside its working directories, no credentials lying around. Isolation turns a renderer bug into a nuisance instead of a breach.

The lesson I take from Upload2Shell is not really about Ghostscript. The dangerous moment is not when a file arrives — in these tests, storing it did nothing. The danger is when your server helpfully renders it. Know which services do that, and patch the pipes, not just the front doors.

Sources: Cyber Security News — Hackers Could Execute Commands on WordPress, Email and Print Servers Through Upload2Shell Flaw, November 22, 2026; pwn.ai — Upload2Shell research by Paulos Yibelo, published November 17–21, 2026; Cyber Kendra — Upload2Shell Ghostscript Bug Turns File Uploads Into Remote Code Execution, November 22, 2026.