The use-after-free | Image: pwn.ai
Researchers at pwn.ai have published full technical details and proof-of-concept code for Upload2Shell, a Ghostscript RCE flaw tracked as CVE-2026-125396. The bug is a use-after-free in Ghostscript’s Type 1 font loader. Through ordinary image uploads, the team reached it in Roundcube, WordPress, MediaWiki, CUPS print servers and Google services.
TL;DR
A crafted document can escape Ghostscript’s -dSAFER sandbox and run commands as the rendering process. Artifex fixed the flaw in Ghostscript 10.08.0 on September 8, 2026, but several Linux distributions still ship vulnerable packages. The PoC is public, while CISA’s ADP record lists exploitation as “none.”
- CVE: CVE-2026-125396
- CVSS: 8.5 (High · CVSSv4)
- Product: ArtifexSoftware ghostpdl
- Affected: < 10.08.0
- Impact: Ghostscript before 10.08.0 -dSAFER Bypass via .putgstringcopy .forceput Recovery
- Status: No confirmed exploitation yet
- Patched in: 10.08.0
- EPSS: 0.3% (30-day)
- Action: Update to 10.08.0 now
Why It Matters
A Public Exploit Path
The Upload2Shell research write-up includes a complete, self-contained PostScript proof. It shows native memory control by swapping one interpreter function for another, then restoring it. The full command-execution chain is described in detail but is not packaged as a single file. Even so, the published material lowers the bar for attackers.
Uploads Reach Ghostscript Without Asking
Applications rarely call Ghostscript directly. Instead, image libraries hand it files behind the scenes. The researchers say “almost every application we tested with file uploads could be tricked into passing a file with a trusted extension to Ghostscript.” For example, Pillow, Imagick, libvips and Qt’s EPS plugin all started Ghostscript. They did so even when PostScript arrived named as a .png or .pdf.
As a result, “a feature as routine as cropping an image or generating a preview could expose the interpreter.” That makes this Ghostscript RCE a supply chain problem, not just a single-product bug.
Real Products, Real Commands
The team ran commands in several tested products:
- Roundcube 1.7.2: an outside sender emailed a disguised attachment, and simply viewing the message triggered the command.
- WordPress 7.0.2: signed-out visitors reached the path through Forminator and Essential Addons for Elementor upload forms.
- Debian 13 CUPS: an anonymous print job to a shared queue ran a command as the lp user.
- MediaWiki, DokuWiki, Mayan EDMS and ResourceSpace: uploads or imported email reached the renderer.
The researchers also reached Google Docs, Chat, Drive and Gmail processing, plus Dropbox and other redacted services. However, they note that some of those findings have separate root causes.
How the Attack Works
A Privileged Font Helper
Ghostscript writes part of its font loader in PostScript. One helper needed a privileged internal operation to update protected font dictionaries. Yet it did not check its inputs first. A crafted font could make an earlier step fail. A custom error handler could then reuse the pending privileged write.
From Use-After-Free to Commands
That write let the document keep a reference to memory after it was freed. When the interpreter reused that memory, the attacker gained what the team calls “a write-what-where primitive.” With it, the proof switched off Ghostscript’s file-path controls in memory. In other words, “-dSAFER was still on the Ghostscript command line” but no longer enforced.
Why the CVSS Score Looks Low
The CVE rates the flaw 8.5 under CVSS 4.0 with a local attack vector. However, the researchers argue the real-world reach is remote. CUPS, Roundcube and WordPress all delivered the document over the network.
Patched Upstream, Not Everywhere
The upstream fix has existed since September. Still, every unpatched distribution or bundled renderer keeps this Ghostscript RCE reachable. Attackers now have the research and the PoC to aim at those gaps.
Affected Versions
- Ghostscript before 10.08.0
- Debian 12 (Bookworm): listed as vulnerable as of November 12
- Amazon Linux 2, 2023 and 2027 Preview: fix pending
- Several SUSE Linux Enterprise and openSUSE Leap branches: affected or in progress
The researchers could not confirm the fix status for RHEL, Rocky Linux, AlmaLinux, Oracle Linux or stable Fedora.
Patch and Mitigation
Update to Ghostscript 10.08.0 or a vendor build with the backported fix. For example, Ubuntu’s USN-8949-1 covers seven releases, and Debian 13 fixed it in 10.05.1~dfsg-1+deb13u2.
Check Every Copy
Patching the host is not always enough. The team warns that “updating the host operating system does not update a separate copy of Ghostscript inside an existing container image or application bundle.” So rebuild containers and check bundled renderers too.
Close the Routes
- Update WordPress to 7.0.4 or a patched branch, which addresses CVE-2026-65640.
- Require authentication on shared CUPS queues.
- Disable PostScript, EPS and PDF coders in ImageMagick policy if you do not need them.
- Check a file’s real type before generating thumbnails or previews.
- Prevent rendering processes from starting a shell.
Support Our Threat Intelligence
Find our vulnerability reports and weekly recaps helpful? Support our work today and unlock a 100% ad-free reading experience!