Ghostscript CVE-2026-125396 lets crafted uploads run code; fix is 10.08.0
Ghostscript versions before 10.08.0 contain a flaw, CVE-2026-125396, that lets a crafted PostScript or PDF document switch off the interpreter's -dSAFER sandbox and run commands with the privileges of whatever process called Ghostscript. On a typical web server that is www-data or the site's PHP user. Paulos Yibelo of pwn.ai, who named the bug Upload2Shell, published a technical write-up and a proof of concept dated November 21, 2026. Artifex fixed the bug in Ghostscript 10.08.0 on September 8, but several Linux distributions still had no fixed package as of mid-November.
The CVE was published on November 9. VulnCheck and Ubuntu score it 8.5 (High) under CVSS 4.0, and Red Hat rates it Important at 7.8 under CVSS 3.1. The vector is listed as local, because the attacker has to get a file processed. In practice that is a file upload, an email attachment, or a print job. No exploitation in the wild has been reported, and the bug was not in CISA's Known Exploited Vulnerabilities catalog as of November 21.
How a disguised upload reaches Ghostscript
The bug sits in .putgstringcopy in gs_fonts.ps, part of the Type 1 font loader. That procedure calls the privileged .forceput operator without checking operand types. A document can trigger a type error, recover .forceput through its own error handler, and cause a use-after-free across save and restore. From there it clears the path-control flag that -dSAFER depends on, so running Ghostscript in safe mode does not protect a vulnerable build.
Most servers never call gs directly. They reach it through image libraries. ImageMagick, PHP's Imagick extension, Pillow, libvips and CUPS filters all hand PostScript, EPS and PDF content to Ghostscript. They decide based on the file's contents, not its name, so a PostScript file renamed to .jpg or .pdf still ends up in the interpreter when the application generates a thumbnail or preview.
Applications pwn.ai compromised in testing
- WordPress 7.0.2 with Forminator 1.55.1: a signed-out visitor submitted a public PDF upload form set to store files in the Media Library.
- WordPress 7.0.2 with Essential Addons for Elementor Lite 6.7.0: a signed-out visitor used a Login/Register widget with a custom upload field and registration enabled.
- WordPress core: a user with the
upload_filescapability (Author and above by default) on a site running Imagick and Ghostscript. WordPress closed this core path in 7.0.4 on August 12 under CVE-2026-65640, with backports to older branches. - Roundcube 1.7.2: a disguised image attachment ran a command as
www-datawhen the recipient viewed the message, without opening the attachment. This requires an ImageMagick configuration that allows the Ghostscript delegate. - CUPS on Debian 13: an anonymous print job to a shared queue ran code as
lp.
The researchers also reached MediaWiki with PdfHandler, DokuWiki, Mayan EDMS and ResourceSpace. The plugin tests ran on WordPress 7.0.2, and none of the sources say whether the 7.0.4 core change blocks those routes. Treat a patched Ghostscript or a restrictive ImageMagick policy as the fix.
Fixed package versions by distribution
- Upstream: Ghostscript 10.08.0.
- Debian 13 (trixie): 10.05.1~dfsg-1+deb13u2 or later, from DSA-6516-1 on September 25.
- Debian 12 (bookworm): 10.0.0~dfsg-11+deb12u9, from DLA-4914-1 on November 17. Until that date bookworm was listed as vulnerable.
- Ubuntu 24.04 LTS: 10.02.1~dfsg1-0ubuntu7.10. Ubuntu 22.04 LTS: 9.55.0~dfsg1-0ubuntu5.15. Both come from USN-8949-1 (October 21), which fixed a font-operand bug credited to Yibelo before the CVE number existed. pwn.ai and Ostorlab treat these builds as fixed, but Ubuntu's own CVE page still shows "Needs evaluation" for every release.
- Amazon Linux 2, 2023 and 2027 Preview: fix pending as of November 12.
- SUSE Linux Enterprise and openSUSE Leap: several branches affected or in progress.
- RHEL, AlmaLinux, Rocky and Oracle Linux: Red Hat rates the bug Important, but none of the sources we checked confirmed a released fixed build.
Distributions backport fixes into older version numbers, so gs --version alone does not tell you whether a server is patched. Compare the package version against the list above or search the package changelog for the CVE.
Commands to find Ghostscript on a server
# Debian and Ubuntu
dpkg-query -W -f='${Version}\n' ghostscript libgs10 libgs9 2>/dev/null
# RHEL, AlmaLinux, Rocky
rpm -q ghostscript
rpm -q --changelog ghostscript | grep -i CVE-2026-125396
# Does ImageMagick hand files to Ghostscript?
convert -list delegate | grep -i gs # ImageMagick 6
magick -list delegate | grep -i gs # ImageMagick 7
# Does PHP have Imagick loaded?
php -m | grep -i imagick
# Copies inside containers are not patched by the host
docker exec <container> sh -c 'command -v gs && gs --version'
Containers and application images that bundle their own Ghostscript need to be rebuilt and redeployed. Updating the host package does nothing for them.
ImageMagick policy and upload restrictions
Where a fixed package is not yet available, block ImageMagick from calling Ghostscript. Edit /etc/ImageMagick-6/policy.xml (or the ImageMagick-7 path) and add these lines inside <policymap>:
<policy domain="delegate" rights="none" pattern="gs" />
<policy domain="coder" rights="none" pattern="{PS,PS2,PS3,EPS,EPSI,EPT,PDF,XPS}" />
Confirm the policy loaded with convert -list policy, then restart PHP-FPM or Apache so long-running Imagick processes pick it up. The coder line disables PDF thumbnails in the WordPress Media Library and PDF previews in Roundcube. Most small business sites will not miss them.
The policy covers ImageMagick only. Pillow, libvips, CUPS filters and scripts that run gs directly are not affected by it. For those, the remaining measures are:
- Require authentication on CUPS queues shared over the network, or stop sharing them.
- Audit public upload fields in form and page-builder plugins. Remove any that accept PDF or arbitrary files without a business need.
- Check a file's real type with
file --mime-typebefore generating a preview, and reject PostScript and EPS outright. - Run document conversion as an unprivileged user under an AppArmor or seccomp profile that cannot start a shell. In one of the researchers' tests, an AppArmor profile stopped the interpreter from spawning one.
- Search upload and spool directories for the string
%pipe%, which Ghostscript payloads use to run commands. A match is a lead to investigate, not proof of compromise.
At Falcon Internet we apply the ImageMagick policy above as a stopgap on managed servers whenever a Ghostscript fix lags behind public disclosure.