Ghostscript's Upload2Shell Bug Turns an Uploaded File Into Commands on Your Server, Past -dSAFER. The Fix, 10.08.0, Shipped September 8. Here Is the Check for Any App That Makes Thumbnails.
On November 17, the security firm pwn.ai published its write-up of CVE-2026-125396, a Ghostscript bug it calls Upload2Shell. A crafted document gets past Ghostscript's -dSAFER sandbox and runs commands as whatever user rendered it. The fix is Ghostscript 10.08.0, released on September 8. If any app you run turns an uploaded file into a thumbnail or a preview, the question for today is which Ghostscript that app calls, and the answer may differ between your host and your containers.
What the bug is
The CVE record on OSV describes a use-after-free in Ghostscript's Type 1 font loader and marks every version before 10.08.0 as affected. It carries a CVSS 4.0 score of 8.5, rated High, assigned through VulnCheck. The vector on the record is local, which sounds comforting until you remember how Ghostscript gets its input: something else hands it a file a stranger uploaded.
pwn.ai's write-up, by Paulos Yibelo, says the flaw gives an attacker a memory write, which they use to switch off the path check that -dSAFER relies on. Their words: "-dSAFER was still on the Ghostscript command line; its native file-path check had been disabled in memory." The flag you were told makes untrusted PostScript safe is still set and no longer does anything.
The write-up also credits a model with the discovery: "GPT 5.6 Sol, working with @PaulosYibelo, found the issue." The Hacker News coverage quotes the Ghostscript developer Ken Sharp calling the code involved "an ancient piece of code well known to be a vulnerability, but difficult to eradicate."
Which paths are open to strangers
pwn.ai lists about ten products where it got a command to run. Read that table carefully, because the entries are not equally bad and some summaries have flattened them.
No login was needed for these: an anonymous print job to a shared CUPS queue on Debian 13, a public PDF form built with the Forminator plugin on WordPress, the signed-out register widget in Essential Addons for Elementor when it has an upload field, and MediaWiki or DokuWiki installs configured to let anonymous visitors upload. Roundcube is on the list too. There, someone emails a disguised attachment and the recipient only has to open the message, on a server with a permissive ImageMagick setup. Roundcube shipped its own fix on October 19.
These need an account: WordPress Core, where the attacker needs the upload_files capability (Author and above by default), and ResourceSpace. WordPress fixed its side in 7.0.4 on August 12 under a separate CVE.
One aggregator summary I read called the whole list "unauthenticated." It isn't, and the difference matters when you decide what to patch first. A site with open registration and Author-level uploads is in the first group in practice. A site where you are the only user is not.
pwn.ai says it has published one proof-of-concept file, and that it demonstrates the memory trick only, without running a command. The per-product exploits are unpublished. The Hacker News reports no known attacks so far.
Where the sources disagree
pwn.ai's survey of distributions, taken around November 12, lists Debian 12 as vulnerable. Debian's own tracker, when I checked it today, files the CVE under resolved issues and shows a newer security build for Debian 12 than the survey would imply. I can't reconcile those two from the pages alone, so I'm not going to tell you Debian 12 is fine or broken.
The clearer entries: Debian 13 got fixes through DSA-6516-1 on September 25 with a follow-up build on October 10, and Ubuntu shipped USN-8949-1 on October 21 covering seven releases, according to pwn.ai's timeline. The same survey lists Amazon Linux and parts of SUSE as still pending as of mid November.
Distro packages backport fixes without changing the upstream version number, so gs --version printing 10.05.1 on Debian 13 does not mean you are exposed. Check the package version against your distro's advisory.
The check
This takes me about fifteen minutes per server. Start with whether Ghostscript is there at all.
# on the host which gs && gs --version dpkg -l | grep -i ghostscript # Debian, Ubuntu rpm -qa | grep -i ghostscript # RHEL family, SUSE, Amazon Linux # inside every image you run, because the host update does not reach them for c in $(docker ps -q); do echo "== $c"; docker exec "$c" sh -c 'command -v gs && gs --version' 2>/dev/null done
The container loop is the step people skip. A base image from August carries August's Ghostscript, and apt upgrade on the host leaves it untouched. Rebuild the image and redeploy.
Then check whether ImageMagick will hand files to Ghostscript:
magick -list policy 2>/dev/null || convert -list policy
If your app only needs JPEG, PNG and WebP thumbnails, it has no reason to render PostScript or PDF at all. Disabling those coders in ImageMagick's policy.xml is old, standard advice that predates this bug. It does not come from the pwn.ai write-up, and I'd apply it anyway:
<policy domain="coder" rights="none" pattern="PS" /> <policy domain="coder" rights="none" pattern="PS2" /> <policy domain="coder" rights="none" pattern="PS3" /> <policy domain="coder" rights="none" pattern="EPS" /> <policy domain="coder" rights="none" pattern="PDF" /> <policy domain="coder" rights="none" pattern="XPS" />
A file named photo.jpg that is PostScript inside gets detected by content, which is how a disguised upload ends up in Ghostscript in the first place. With those coders off, ImageMagick refuses it.
Two more things from the write-up. Requiring authentication on the print queue blocked the CUPS path in their test, so if you share a printer from a Linux box, lock the queue. And in one of their tests an enforced AppArmor profile stopped the shell, which is a decent argument for leaving AppArmor on.
Where this could be wrong
Almost every detail about exploitability comes from one firm describing its own research, and I'm reading a long write-up of which I saw only part word for word. The CVE record and the fixed version are independently confirmed. The product-by-product results are not. It's also possible your stack never touches Ghostscript and this costs you fifteen minutes for nothing. I think that's a fine price for knowing.
I could also be underrating the risk. The per-product exploits are unpublished today, and the fix has been public since September, which gives anyone motivated a diff to study.
What I'd actually do
Today: run the check on every server and every image, update the package, rebuild the images. If the app has no use for PDF or PostScript previews, turn those coders off and stop thinking about Ghostscript.
If a customer-facing feature does need PDF previews, I'd move that rendering into its own container with no network access and no secrets mounted, running a patched Ghostscript. Then the next bug in that "ancient piece of code" lands in a box with nothing in it.
Author
Lukas
@lukcombinator