Critical CVE Response

Find Every Copy of Ghostscript Your Apps Run: The Upload2Shell Inventory (CVE-2026-125396)

Dark cyberpunk illustration of a single amber document sliding into a dense stack of identical black machine housings, where one hidden housing deep inside the stack glows orange while cyan traces map the path the document took to reach it.

Five applications, five different upload forms, one result: uid=33(www-data). That line repeats down the evidence table pwn.ai published for Upload2Shell, and it repeats because none of the five applications owns the bug. Ghostscript does, and not one of them tells you it is running.

The flaw is CVE-2026-125396, a use-after-free in the Type 1 font loader that lets a crafted document cross the -dSAFER sandbox and run commands as the rendering process. Artifex tracks it as bug 709684. The helper at fault lives in Resource/Init/gs_fonts.ps: .putgstringcopy needed the privileged .forceput store and performed a copy without validating operand types first, so a global dictionary could hold a reference to a local object that a later restore had already freed. The VulnCheck advisory scores it 8.5 under CVSS 4.0 with a local attack vector. Upstream fixed it in Ghostscript 10.08.0 on September 8, 2026. The CVE record was published on November 9. The news coverage arrived this week. Those three dates are the whole problem.

The local attack vector is an accounting artifact. -dSAFER is a set of checks inside the PostScript interpreter rather than a kernel-enforced syscall filter, so corrupting interpreter memory weakens the checks from the inside, and the crafted file gets there through whatever feature accepts documents from strangers. pwn.ai confirmed command execution through ten application paths, most of them signed-out: a Forminator 1.55.1 public PDF form, the Essential Addons for Elementor 6.7.0 login widget upload field, anonymous PDF upload to MediaWiki 1.46.0 with PdfHandler, an open DokuWiki, a Roundcube 1.7.2 message the recipient merely opened, an anonymous IPP job to a shared Debian 13 CUPS queue, and WordPress Core itself at 10 trials out of 10 wherever Imagick and Ghostscript are both present. WordPress shipped its own fix as CVE-2026-65640 in 7.0.4 on August 12; Roundcube's attachment hardening is CVE-2026-114727, from October 19.

Here is the relevance verdict, because it is narrower than the headline suggests. This reaches you only if something in your environment renders documents or images that arrive from outside, and that renderer hands PostScript-family content to Ghostscript. In practice that means a website or portal that makes thumbnails and previews of uploads, a webmail server that renders attachments, a document-management or wiki system, or a print queue that accepts jobs without authentication. If your site accepts no uploads, or accepts them and stores them untouched, you are outside this. The same applies if Ghostscript is not installed anywhere along the path, which is a question worth answering rather than assuming. As of this morning CVE-2026-125396 is absent from the CISA Known Exploited Vulnerabilities catalog, which stands at 1,790 entries, and the researchers report no exploitation in the wild. The published proof of concept stops at the memory manipulation and never runs a command.

Where -dSAFER stopped being a boundary

Ken Sharp, the Artifex developer who handled the fix, called the vulnerable internal step an ancient piece of code well known to be a vulnerability and difficult to remove. The first commit added the missing operand checks. A later change moved the helper out of PostScript into C so it no longer depends on .forceput at all. That second commit is the reason the fix is a version bump rather than a configuration flag.

The design lesson is worth more than the bug. Every control that says "safe mode" and runs inside the same address space as the parser it protects has this property: a memory bug in the parser is a bug in the control. Ghostscript has now had three documented -dSAFER bypasses in 2026. If your architecture depends on -dSAFER alone to make untrusted document rendering safe, you are depending on there being no fourth. Add an operating-system boundary underneath it. pwn.ai's own Plesk test is the demonstration: an enforced AppArmor profile stopped the compromised interpreter from starting a shell, and the chain ended there.

The enterprise answer is an SBOM. Yours is four commands.

A large bank answers "where does Ghostscript run" from a software inventory it already maintains: an SBOM per build, a CMDB that knows which hosts run which services, and a scanner that reports package versions per image. That machinery costs a team and a year. For a company with one web server, one mail server and a print queue, the same question is answerable before lunch, and the answer is what decides whether you have anything to do.

Run this on every host that processes files from outside. The last block matters most, because the thing that calls Ghostscript is almost never Ghostscript.

# 1. Is it installed, and at what version?
gs --version 2>/dev/null
dpkg-query -W -f='${Package} ${Version}\n' 'ghostscript*' 'libgs*' 2>/dev/null
rpm -q ghostscript ghostscript-core libgs 2>/dev/null

# 2. Are there copies the package manager does not know about?
find / -xdev -type f \( -name 'gs' -o -name 'gsc' -o -name 'gswin*c.exe' \) \
     -not -path '/proc/*' 2>/dev/null
find / -xdev -name 'gs_fonts.ps' -not -path '/proc/*' 2>/dev/null

# 3. Which libraries on this host will hand it a PostScript-family file?
magick -list delegate 2>/dev/null | grep -iE '^(ps|eps|pdf)'
python3 -c 'from PIL import EpsImagePlugin; print("Pillow EPS:", EpsImagePlugin.has_ghostscript())' 2>/dev/null
vips -l 2>/dev/null | grep -i magick

# 4. Container and application bundles carry their own copy
docker ps --format '{{.Image}}' | sort -u | while read -r i; do
  echo "== $i"; docker run --rm --entrypoint sh "$i" -c 'gs --version 2>/dev/null' 2>/dev/null
done

Step three is the step people skip. ImageMagick, Pillow, libvips and the Qt EPS plugin all inspect file content rather than trusting the extension, so a file named invoice.png that contains PostScript still reaches the interpreter. Several of pwn.ai's paths fire only on pixel decoding, which means an upload validator that calls open() and checks dimensions has already triggered the render it was meant to gate.

The host package version is not the version your app runs

Two traps sit on either side of the version number, and they point in opposite directions.

The first is backporting. USN-8949-1 fixed seven Ubuntu releases on October 21, and the fixed builds read 10.06.0~dfsg-3ubuntu1.2 on 26.04 LTS, 10.02.1~dfsg1-0ubuntu7.10 on 24.04 LTS and 9.55.0~dfsg1-0ubuntu5.15 on 22.04 LTS. Every one of those is numerically below 10.08.0 and every one of them is patched. Debian's tracker entry runs the same way for trixie, fixed at 10.05.1~dfsg-1+deb13u2 with the current build at +deb13u3, while bookworm was still listed vulnerable at 10.0.0~dfsg-11+deb12u8. Compare against your distribution's fixed build, never against the upstream number.

The second trap is bundling, and it is the one that bites small environments. pwn.ai's Plesk Obsidian 18.0.79 case study reached command execution through a Roundcube thumbnail path running Ghostscript 9.54.0 as uid=995(roundcube_sysuser) - a copy four major versions behind whatever the host package says. Container images, control panels, Python wheels and vendor appliances all ship their own interpreter, and upgrading the host leaves them exactly as they were. Ask the service, not the host:

# What does the running process actually load?
for p in $(pgrep -f 'gs|convert|magick|roundcube|php-fpm'); do
  printf '%s %s\n' "$p" "$(tr '\0' ' ' < /proc/$p/cmdline)"
  grep -o '/[^ ]*libgs[^ ]*' /proc/$p/maps 2>/dev/null | sort -u
done

# Bundled copies inside images, by SBOM rather than by guesswork
syft packages docker:your-image:tag -o table 2>/dev/null | grep -i ghostscript

# WordPress: the two conditions that make Core exploitable
wp eval 'var_dump(extension_loaded("imagick"));'
wp plugin list --status=active --field=name | grep -iE 'forminator|essential-addons'

Switch off the delegates nobody asked for

Patching closes this bug. Removing the path closes the next one too, and most small stacks never needed the path. ImageMagick's policy file is the highest-value edit available here, because it is one file and it governs every caller on the host, including the ones you have forgotten about.

The four edits worth making today

  • Deny the PostScript-family coders in ImageMagick. Add the rules below to /etc/ImageMagick-7/policy.xml (or -6), then confirm with magick -list policy that your file is the one being read. A policy that is not loaded is not a control.
  • Require authentication on print queues. The CUPS chain depended on an anonymous IPP submission. Check grep -nE 'AuthType|Allow|Order' /etc/cups/cupsd.conf and close any queue that accepts jobs from the network without a credential.
  • Validate real file type before rendering, not after. Reject on content sniffing first, then generate the thumbnail. The Roundcube path exists because the render happened as part of deciding what the file was.
  • Confine the renderer. Run aa-status or getenforce and find out whether anything stands between your interpreter and /bin/sh today. For most small environments the honest answer is nothing.
<!-- /etc/ImageMagick-7/policy.xml : deny what delegates to Ghostscript -->
<policymap>
  <policy domain="delegate" rights="none" pattern="gs" />
  <policy domain="coder" rights="none" pattern="PS" />
  <policy domain="coder" rights="none" pattern="PS2" />
  <policy domain="coder" rights="none" pattern="PS3" />
  <policy domain="coder" rights="none" pattern="EPS" />
  <policy domain="coder" rights="none" pattern="PDF" />
  <policy domain="coder" rights="none" pattern="XPS" />
</policymap>

# Prove it took effect, from the account the web server runs as
sudo -u www-data magick -list policy | grep -A2 -iE 'coder|delegate'
sudo -u www-data magick eps:- /tmp/t.png < /dev/null   # expect: not authorized

If a business process genuinely needs PDF thumbnails, keep PDF and deny the rest, then put the confinement underneath. Partial beats theoretical.

Ghostscript should never be a parent process

The detection here is unusually clean. In normal operation the interpreter reads a file and writes an image. It has no reason to start another program. Any process whose parent is gs is either a misconfiguration or the end of someone's exploit chain, which makes a single rule worth more than a package of signatures.

<!-- Sysmon for Linux: alert on any child of the interpreter -->
<Sysmon schemaversion="4.90">
 <EventFiltering>
  <RuleGroup groupRelation="or">
   <ProcessCreate onmatch="include">
    <ParentImage condition="end with">/gs</ParentImage>
    <ParentImage condition="end with">/gsc</ParentImage>
   </ProcessCreate>
  </RuleGroup>
 </EventFiltering>
</Sysmon>

# auditd fallback: record program starts by the web account, then read the parents
auditctl -a always,exit -F arch=b64 -S execve -F uid=33 -k rh_webexec
ausearch -k rh_webexec -ts today -i | grep -E 'ppid=|comm='

Pair it with a retrospective pass over the upload directories: files written by the web account outside the usual media paths, and any shell or interpreter binary with a creation time inside a request window. The fix shipped on September 8 and the CVE arrived on November 9, so the quiet interval worth examining is longer than the news cycle.

Find the copies before you patch the one you know about

Start with the inventory, because the patch is only as good as the list it is applied to. Walk the hosts that accept files from outside, enumerate every Ghostscript binary and bundled library including the ones inside containers and control panels, compare each against your distribution's fixed build rather than the upstream version, and then take away the delegates nobody needed. If you run a WordPress site with a public file-upload form, that site is the first host on the list, not the last.

We publish the tooling we use for this kind of inventory work on GitHub, free and without a signup. If you would rather someone else walk the upload paths and tell you which ones end at a renderer, that is an afternoon of work and a short conversation.

Want the inventory tooling we use?

We build and publish open-source security tooling for exactly this kind of work - finding what is actually installed and actually reachable, rather than what the asset list claims. Browse the repositories on GitHub, or book a session and we will walk your upload and print paths with you.