Back
23/11/2026
Upload2Shell (CVE-2026-125396): the file upload that escapes the Ghostscript sandbox
A crafted upload, email or print job can make Ghostscript run commands on your server. Where it hides, which distros are fixed, and what to do now.
A user uploads a profile picture. A customer emails a PDF. Someone sends a job to the shared office printer. None of these looks like a security event, yet on many servers each one can end with a file being handed to Ghostscript, a PostScript and PDF interpreter that most teams never knowingly installed. A flaw researchers call Upload2Shell (CVE-2026-125396) lets a crafted file break out of Ghostscript’s sandbox and run commands on the server. Ghostscript fixed it on 8 September 2026, but many systems are still exposed, because the vulnerable copy often lives inside a container image or a bundled application rather than in the host’s package list. This post explains how the attack works, how files reach Ghostscript without anyone calling it, where the patch has and has not landed, and what to do now.
Key takeaways
- Upload2Shell is a flaw in Ghostscript before version 10.08.0. A crafted PostScript, EPS or PDF file can switch off the -dSAFER sandbox and run commands as the account that renders the file.
- Applications rarely call Ghostscript directly. ImageMagick, Pillow, some libvips builds and print systems pass files to it in the background, for example when they create a thumbnail or a preview.
- Researchers demonstrated command execution in ten applications, including CUPS print servers, Roundcube webmail, MediaWiki, DokuWiki and WordPress with two popular plugins.
- Debian has fixed its supported releases, and Ubuntu shipped a fix on 21 October. Amazon Linux and most SUSE releases were still waiting for a fix at the time of writing, and Red Hat had not published an assessment.
- Updating the host does not fix Ghostscript inside container images or bundled applications. Those must be rebuilt or updated separately.
What happened
Ghostscript runs untrusted documents inside a sandbox mode called -dSAFER, which is meant to stop a file from running commands or reading and writing files on the server. Researchers at pwn.ai found a way to switch that sandbox off from inside a document.
The bug is in a font-handling routine, .putgstringcopy, in Ghostscript’s gs_fonts.ps. The routine uses a privileged internal operator without first checking what it has been given. A crafted font can trigger an error at the right moment, take over the error handler and reach that privileged operator. From there, the attacker causes a use-after-free: Ghostscript keeps using memory it has already released. That gives the attacker enough control to turn off the sandbox’s checks and run a command.
The command runs as whichever account is rendering the file. In the researchers’ tests that was the lp print account on a CUPS server, www-data on web applications, and the application user inside a container. That is a low-privilege account, but it can usually read the application’s files, configuration and database credentials, and it gives an attacker a starting point inside the network.
VulnCheck, which assigned the CVE, rates it 8.5 under CVSS 4.0 and classifies the attack as local. The researchers’ own results show why that label is misleading in practice: they reached Ghostscript over the network through print jobs, email attachments and web uploads. Ghostscript’s developer Ken Sharp, quoted by The Hacker News, called the vulnerable step “an ancient piece of code well known to be a vulnerability, but difficult to eradicate.” As of 22 November there were no public reports of attacks using this flaw.
How uploads reach Ghostscript without anyone calling it
Very few applications use Ghostscript on purpose. It gets involved because image and document libraries hand certain file types to it automatically. The researchers traced these paths:
- ImageMagick and PHP Imagick. When ImageMagick is asked to read PostScript, EPS or PDF content, it delegates the work to Ghostscript. This is the path used by WordPress, Roundcube thumbnails and many PHP applications.
- Pillow (Python). Opening an EPS file only identifies it, but loading, cropping or creating a thumbnail of it starts Ghostscript. Libraries built on Pillow, such as imageio and scikit-image, inherit this.
- libvips. Depending on how it was built, libvips can pass files to ImageMagick, and from there to Ghostscript.
- Other paths. The KImageFormats EPS plugin for Qt and Matplotlib’s EPS handling also call Ghostscript.
- Print servers. CUPS filters convert PostScript print jobs with Ghostscript.
A key detail is that the file name often does not matter. If an application decides what a file is by its contents rather than its extension, a file called photo.jpg that actually contains PostScript can still be passed to Ghostscript. In the researchers’ tests, PHP GD, OpenCV, prebuilt Sharp, Jimp, Java ImageIO and Go’s standard image decoders did not call Ghostscript for these files.
The ten applications demonstrated
pwn.ai published working proofs against ten applications:
| Application | How the file arrives | Login needed? |
|---|---|---|
| CUPS on Debian 13 | Print job sent to a shared network printer queue | No, if the queue accepts anonymous jobs |
| Roundcube 1.7.2 | Email attachment, processed when the message is opened | No for the sender; the recipient opens the mail |
| WordPress + Forminator | Public upload form | No |
| WordPress + Essential Addons for Elementor | Public upload form | No |
| WordPress core | Media upload | Yes, an account that can upload files (Author or higher by default) |
| MediaWiki 1.46.0 + PdfHandler | File upload | Depends on the wiki’s upload settings |
| DokuWiki | Media upload | Depends on the wiki’s upload settings |
| Mayan EDMS 4.11.5 | Document upload | Depends on configuration |
| ResourceSpace 11.0 | Asset upload | Depends on configuration |
| Plesk Obsidian 18.0.79 | Through the bundled Roundcube webmail | No for the sender |
The researchers also report that Google fixed an affected path in its services the week before the write-up. Issues they found at Dropbox and other unnamed services are separate Ghostscript bugs, not this CVE.
WordPress deserves a note of its own. WordPress 7.0.4, released on 12 August 2026, fixed CVE-2026-65640, which blocked the core media upload path used in this research. The same fix was backported to older branches, such as 6.9.7. That update does not fix Ghostscript itself. Plugins with their own upload handling, such as the two above, can still pass files to a vulnerable Ghostscript. Update WordPress and Ghostscript, not one or the other.
The patch gap
Artifex released the fix in Ghostscript 10.08.0 on 8 September 2026. The CVE was published on 9 November, and the full research went public on 21 November. Distribution coverage is uneven. This is the status LOGIQ found on each vendor’s own security tracker on 22 November 2026:
| Distribution | Status on 22 November 2026 |
|---|---|
| Debian 13 (trixie) | Fixed (DSA-6516-1) |
| Debian 12 (bookworm) | Fixed in the security repository (DLA-4914-1, 10.0.0~dfsg-11+deb12u9) |
| Ubuntu 16.04 to 26.10 | Fixed on 21 October in USN-8949-1, where the issue is listed without a CVE number. Ubuntu’s CVE page still says “needs evaluation”. |
| Amazon Linux 2, 2023 and 2027 Preview | Pending fix |
| SUSE Linux Enterprise 12 SP5, 15 SP4 to SP7, 16.0 and 16.1 | In progress (updates in QA) |
| openSUSE Leap 16.0 and 16.1 | Affected |
| openSUSE Tumbleweed | Fixed (10.08.0) |
| Red Hat Enterprise Linux and rebuilds (Oracle Linux, Rocky Linux, AlmaLinux) | No public assessment found |
Many distributions backport the fix into their own older version instead of moving to 10.08.0. So a version number lower than 10.08.0 is not automatically vulnerable. Check your vendor’s advisory for the exact fixed package.
The bigger gap is in containers. A container image carries its own copy of Ghostscript, frozen at the moment the image was built. Running dnf update or apt upgrade on the host does not touch it. The same applies to applications and appliances that ship their own ImageMagick or Ghostscript. An image built in August is still vulnerable today, whatever the host says.
How to check your systems
On a host, check the installed version and the package build:
gs --version
rpm -q ghostscript # RHEL, Oracle Linux, SUSE, Amazon Linux
dpkg -l | grep -i libgs # Debian, Ubuntu
Then check inside each container that handles uploads, previews, email or printing. For a running container:
docker exec <container> gs --version
To see whether ImageMagick will hand PostScript or PDF to Ghostscript, look at its delegates:
convert -list delegate | grep -i -E "ps|eps|pdf"
Finally, list the places where your applications accept files from outside: upload forms, email processing, document management, wikis, print queues and anything that creates previews or thumbnails.
What to do now
- Update Ghostscript. Install 10.08.0 or your distribution’s backported fix. Where no fix is available yet, as on Amazon Linux and most SUSE releases, apply the mitigations in step 4 until it arrives.
- Rebuild container images. Rebuild every image that contains Ghostscript or ImageMagick on a patched base image, then redeploy it. Check your registry for old images that are still running.
- Update bundled applications. For appliances and commercial products with their own document stack, get the update from the vendor. Update WordPress to 7.0.4 or the fixed release for your branch.
- Close the paths you do not need. If your application never needs PostScript, EPS or PDF images, disable those formats in ImageMagick’s
policy.xml. Check a file’s real type before you create a thumbnail of it, and require login on shared print queues. - Contain the renderer. Run conversion and thumbnail jobs under a dedicated low-privilege account, in a separate container where possible. In one of the researchers’ tests, an AppArmor profile stopped the compromised interpreter from starting a shell.
The bottom line
Upload2Shell is a reminder that the attack surface of a web application includes every library that touches a user’s file, not only the code your team wrote. The fix has been available for more than ten weeks, but it only protects the copies of Ghostscript that have actually been updated. Check your hosts, check your container images, and do not assume that one updated package means you are covered.
Need help finding vulnerable Ghostscript copies across your servers and container images? Contact the LOGIQ team.
Sources
- pwn.ai: How We Hacked the Pipes, Upload2Shell research (CVE-2026-125396)
- VulnCheck advisory: Ghostscript before 10.08.0 -dSAFER bypass (CVE-2026-125396)
- The Hacker News: Researchers demonstrate Ghostscript sandbox-escape RCE via crafted file uploads in popular apps
- WordPress security advisory GHSA-8vr3-7mxf-gx8w (CVE-2026-65640)
- Debian security tracker: CVE-2026-125396
- Ubuntu security notice USN-8949-1
- Amazon Linux security center: CVE-2026-125396
- SUSE: CVE-2026-125396
Photo: Jakub Zerdzicki / Pexels
Japan
Korea
China
Taiwan
Vietnam
Thailand
Indonesia
Portugal
Spain
France
Germany
Egypt
Russia