Upload2Shell: a Ghostscript flaw lets attackers run code with a single file upload

CVE-2026-125396, named Upload2Shell, breaks out of the Ghostscript sandbox and lets attackers run code with an uploaded file. The patch is out.

Candados, llaves y nodos de red conectados por líneas luminosas sobre una sala de servidores en tonos azul petróleo y naranja

Ghostscript is the quiet translator of the internet. When a server turns a PDF into an image, builds a thumbnail of an email attachment, or prints a document, this PostScript interpreter is almost always the one doing the work, hidden behind the app that called it and never mentioned. This week the world learned its containment wall had a crack, and that the crack was already fixed: CVE-2026-125396, named Upload2Shell, is a Ghostscript flaw that breaks out of the -dSAFER sandbox and runs commands on whatever server processes a malicious file.

The -dSAFER sandbox is Ghostscript’s one big promise: no matter what PDF or PostScript it handles, even one from a stranger, it cannot touch the file system or run anything. The flaw breaks that promise from the inside. When it loads a Type 1 font, the procedure .putgstringcopy calls .forceput, a privileged operator, without checking the operand type. A crafted document triggers a type error, recovers .forceput through a custom error handler, and chains a use-after-free across save and restore. The result is arbitrary code execution.

What makes this a story is not the technique, it is the path. Ghostscript does not only sit in print jobs: ImageMagick calls it to convert images, and the researchers at pwn.ai had already shown that a file named .png or .jpg can end up routed through it. They confirmed remote execution in about ten applications and traced the route in that many more: WordPress core, Roundcube, Debian’s CUPS, MediaWiki, Forminator, Elementor, DokuWiki, Mayan EDMS and ResourceSpace. In every one of them, an uploaded file or a processed attachment ended up running commands as www-data or lp.

The score puts the severity where it belongs. NVD rates it 8.5 out of 10 on CVSS 4.0 and 7.8 on CVSS 3.1: high, not critical. The distinction matters, because the vector requires someone to process the file, and that is why the number stays below 9. What the number does not tell you is that on a server, that someone is almost always an automated process converting, previewing or printing with no human in the loop. As of now, there is no sign of this being exploited in production.

The story behind the fix matters more than the number. Paulos Yibelo of pwn.ai found the flaw on July 27. He reported it to Artifex, the Ghostscript maintainer, on September 2 as bug 709684, and the fix landed on September 8 inside Ghostscript 10.08.0. The CVE was not published until November 10. Same old pattern: the fix existed since September, but the world only learned this week what it was actually covering.

The fix has made its way downstream. Debian folded it into the security package for its 13 branch (10.05.1~dfsg-1+deb13u3) and Ubuntu published advisory USN-8949-1 on October 21 with patched versions for seven releases. Beyond the interpreter itself, several applications closed their own front door: WordPress did it in August with CVE-2026-65640, and Roundcube in October with CVE-2026-114727.

One thing you do not want to miss: this is not solved with an apt update. Ghostscript rides inside container images, inside stacks like Plesk, and inside applications that bundle their own copy. Updating the system package does not touch those internal copies. You have to inventory where the interpreter runs, update it, and restart the service. If an application does not need to convert PDF or PostScript, disabling the ImageMagick delegate or removing Ghostscript closes the whole route.

The name follows the Shell family of vulnerabilities, and the lesson is the same one Java4Shell and Ruby2Shell left behind: a general-purpose interpreter hiding under innocent-looking features turns any file upload into attack surface. The difference between a hacker who finds flaws and a white hat who reports them is what each one does with the discovery. Your job is the same as always: know what processes your files and run it with least privilege. Leave Ghostscript unpatched and you are up against an execution path that is already documented.