cd /news/ai-safety/upload2shell-ghostscript-sandbox-esc… · home › topics › ai-safety › article
[ARTICLE · art-174637] src=equixly.com ↗ pub= topic=ai-safety verified=true sentiment=↓ negative

Upload2Shell: Ghostscript sandbox escape turns file uploads into RCE

Pwn.ai disclosed Upload2Shell, tracked as CVE-2026-125396, a use-after-free in Ghostscript's Type 1 font loader that lets a crafted document disable the interpreter's -dSAFER sandbox and run commands as the rendering process. pwn.ai reports command execution through file uploads, email attachments and print jobs in Debian 13 CUPS, Roundcube, WordPress, MediaWiki and six other applications, with no account needed on the target in seven of the ten documented paths; the flaw scores 8.5 under CVSS 4.0 with a local attack vector. Artifex fixed the issue in Ghostscript 10.08.0 on September 8, 2026, and pwn.ai found no reports of exploitation in the wild as of November 23.

recommendation

Upgrade Ghostscript to 10.08.0 or the distribution's fixed package and rebuild any container image bundling it; until then, disable ImageMagick's PS, EPS, PDF and XPS coders and require authentication on shared CUPS queues.

more in playbook: Securing agents and AI tools
by read14 min views6 publishedNov 23, 2026
Upload2Shell: Ghostscript sandbox escape turns file uploads into RCE
Image: Equixly (auto-discovered)

Upload2Shell, tracked as CVE-2026-125396, is a use-after-free in the Type 1 font of Ghostscript, the PostScript and PDF interpreter that ImageMagick, Pillow, CUPS, and many document pipelines call to render files. According to the write-up from pwn.ai, which named the flaw, a crafted document can use it to switch off Ghostscript’s -dSAFER sandbox from inside the interpreter and run commands as the rendering process. pwn.ai reports command execution through file uploads, email attachments, and print jobs in Debian 13 CUPS, Roundcube, WordPress, MediaWiki, and six other applications. Artifex fixed the flaw in Ghostscript 10.08.0 on September 8, 2026.

The CVE scores 8.5 under CVSS 4.0 with a local attack vector, because Ghostscript only reads files that another program hands it. In seven of the ten paths pwn.ai documents, the attacker needed no account on the target. pwn.ai has published a proof of native memory control, and we found no reports of exploitation in the wild as of November 23.

The fix is in Ghostscript, so it has to reach every copy that renders untrusted files, including the ones bundled in container images and hosting stacks. Upgrading the application that accepts the upload does not replace the interpreter underneath it.

Vulnerability details #

TL;DR #

  • Ghostscript before 10.08.0 lets a crafted PostScript file turn off its own -dSAFER sandbox and run commands as the process that renders it. pwn.ai reports command execution through ten applications, seven of them without an account on the target.
  • The file does not need a PostScript name. A .jpg attachment or a.png upload whose bytes are PostScript reaches Ghostscript through ImageMagick or Pillow when the application builds a thumbnail or preview.
  • Upgrade Ghostscript to 10.08.0 or your distribution’s fixed package, then rebuild any container image that bundles it. Debian 12 now has a fix through Debian LTS.
  • Update WordPress to 7.0.4, 6.9.7, or a listed backport, and Roundcube to 1.6.20, 1.7.5, or later, which carry the CVE-2026-114727 fix. Both close an application route to Ghostscript.
  • Until every copy is patched, disable the PS, EPS, PDF, and XPS coders in ImageMagick’s policy where you do not need them, and require authentication on shared CUPS queues.

Who is not affected by Upload2Shell #

A system is out of scope when no attacker-supplied file reaches a vulnerable Ghostscript. Based on the tests in the pwn.ai write-up, that covers:

  • Image handling through PHP GD, OpenCV, prebuilt Sharp, Jimp, Java ImageIO, or Go’s standard image decoders, none of which started Ghostscript for the same PostScript inputs.
  • Applications that only copy or store uploaded files without rendering, resizing, or previewing them.
  • Python code that calls Pillow’s Image.open() to identify a file but never loads its pixels.
  • Hosts and images running Ghostscript 10.08.0 or a distribution package that carries the fix, where pwn.ai’s proof fails.

libvips and Qt applications depend on how they were built. In pwn.ai’s tests, a libvips build with the magickload and a Qt install with the KImageFormats EPS plugin both reached Ghostscript, so check the s and plugins actually installed before ruling them out.

Ghostscript can also be linked into ImageMagick as a library rather than run as a separate gs command, so the absence of a gs binary on the path is not proof that a host is safe.

What is Upload2Shell? #

Upload2Shell is a flaw in the way Ghostscript loads Type 1 fonts, and it affects any application that passes files it did not create to Ghostscript, directly or through a library. PostScript is a full programming language, so rendering a PostScript file means running a program written by whoever sent it. Ghostscript’s -dSAFER mode restricts that program’s file access and command execution, but those restrictions are checks inside the interpreter, not a kernel-enforced filter like seccomp. A memory corruption bug inside the interpreter can therefore disable them.

Most applications never call Ghostscript by name. They call an image or document library that often chooses a handler from the file’s bytes rather than its name and passes PostScript and PDF to Ghostscript. pwn.ai traced these routes in its tests on Ubuntu 24.04, including with PostScript content saved under a .png name:

CUPS reaches Ghostscript by a third route. A PostScript print job passes through the gstopdf filter, which runs the system Ghostscript with -dSAFER as the lp user.

Upload2Shell is one of several Ghostscript flaws pwn.ai found and reported to Artifex during the same audit. Its separate findings at Dropbox and other production services whose names pwn.ai redacted have different root causes and are not covered here.

Technical analysis #

The flaw lets a document borrow a privileged write from Ghostscript’s own font code and use it to break the interpreter’s memory rules. The analysis below follows the pwn.ai write-up and the upstream fix. We have not reproduced it in a lab.

The font helper

Ghostscript implements parts of its font in PostScript. One helper, .putgstringcopy, has to write into protected font dictionaries, so it uses .forceput, an internal operator that ordinary documents cannot call. The helper copies a string and then performs the privileged store, but it never checked that its operands had the expected types.

From a type error to a privileged write

A font loaded from the document can see the ’s operand stack while it runs. pwn.ai’s proof swaps the expected filename string for an array, so the copy step fails with a typecheck error. The document’s own error handler then rearranges the stack and returns, and execution resumes at .forceput with a dictionary, key, and value the attacker chose. The document never calls the hidden operator by name.

The dangling reference

PostScript keeps local and global memory apart. A save records local state, and a later restore frees local objects created since then, while global objects can survive. A surviving global dictionary must never point at a local object, because that object will be freed.

The recovered .forceput breaks that rule. It stores a local object into systemdict, which outlives the restore, leaving a reference to freed memory. When the interpreter reuses that allocation for new objects, the stale reference and the new object point at the same bytes. pwn.ai used that overlap to read and write native memory and follow Ghostscript’s internal pointers to the structure that holds its path-control state. The offsets it reports are specific to the tested x86-64 build, but the addresses come from live interpreter references, so the proof does not depend on guessing a fixed address.

Turning off -dSAFER from inside

With native write access, the proof clears the flag that enables path control, changing its bytes from 1,0,0,0 to 0,0,0,0. It also uses the privileged store to widen the file-writing allowlist and unlock file permissions that -dSAFER sets. -dSAFER is still on the command line, but the checks behind it are off, and the document can open a pipe to a shell command. In the Debian CUPS test, that command ran on the print server as uid=7(lp).

The fix

Artifex’s first commit, included in 10.08.0, checks the operands before the copy can fail, which removes the error path that exposed .forceput. A second commit, made after the 10.08.0 release, moves the helper into C so it no longer depends on .forceput at all. pwn.ai reports that on 10.08.0 its proof fails before the pointer write.

Which products are affected? #

Applications in which pwn.ai reports command execution through Upload2Shell, from its evidence index as updated on November 18, 2026:

Google’s image and document pipeline also reached Ghostscript 10.05.0 from a signed-out request, and pwn.ai’s proof read a file on the worker. Google mitigated that path on November 10.

pwn.ai traced further routes in source code or up to the point where Ghostscript starts, without a command-execution proof: Gradio, InvokeAI, AUTOMATIC1111 Stable Diffusion WebUI, ComfyUI, Frappe and ERPNext, Home Assistant, CVAT, Paperless-ngx, and django-filer. Self-hosted AI image tools on that list often run without a login, so treat any internet-facing instance on a host with Ghostscript installed as potentially exposed.

Ghostscript packages, as of the dates shown:

Debian’s tracker records deb13u2, from DSA-6516-1 on September 25, as the first Debian 13 build with the fix, and deb13u3 from October 10 as the current one. A distribution package also says nothing about the Ghostscript inside an application bundle: Plesk shipped 9.54.0 in the tested release, and container images keep whatever version they were built with.

What is the impact of Upload2Shell? #

The worst case is code execution as the account that renders the file. None of the documented paths where pwn.ai names the account ran as root, despite at least one headline promising a root shell, but the accounts involved still reach a great deal. In its local WordPress renderer test, pwn.ai wrote a PHP file as www-data. On a typical host, that account can place files the web server will run and read the database credentials in wp-config.php. On a CUPS print server, the lp account gives a foothold on the host itself, and in Mayan EDMS the command ran as the application’s container user, which would typically be able to read the documents the system stores.

The delivery routes widen the set of people who can attack. On an affected Roundcube server, a user only has to open an email for the server to render its attachment, so anyone who can send mail to the organization can reach the renderer. Public WordPress forms and open wikis accept files from visitors with no account at all.

Two further consequences follow from the way the flaw is scored and reached:

  • The CVE carries a local attack vector, so vulnerability scanners and risk registers that rank by CVSS may place it below network-facing bugs. Only WordPress and Roundcube have issued application CVEs, both scored with a network attack vector.
  • Ghostscript runs as a short-lived child process in most of these paths. A failed exploitation attempt is likely to show up as a crashed or unusually long-running gs process, or ags process that starts a shell, rather than as an application error. Where Ghostscript is linked in as a library, no separategs process appears.

The scoring problem cuts the other way on Ubuntu. Ubuntu shipped its fix in USN-8949-1 before the CVE existed, labeled “No CVE number,” and the Swiss host Cyberdine reported that Ubuntu’s own CVE page still listed every release as needing evaluation. Scanners that match CVE IDs may therefore flag patched Ubuntu hosts, so check the package changelog for the font- fix rather than the CVE status page.

Which actions should security teams take? #

1. Upgrade Ghostscript everywhere it renders untrusted files

Install Ghostscript 10.08.0 or your distribution’s fixed package. Artifex, the distributions, and pwn.ai all give this as the remediation for the root flaw.

  • Update the system package through your distribution, and confirm the fixed build rather than the upstream version number, since backports keep older version strings.
  • Rebuild container images after the base image is updated. Images pinned to an older tag or digest keep the vulnerable interpreter.
  • Restart long-running processes that load ImageMagick or Ghostscript as a library, such as PHP-FPM workers using Imagick, so they pick up the new code.
  • For bundled stacks such as Plesk, install the vendor’s update rather than replacing its Ghostscript by hand.
  • Update WordPress to 7.0.4, 6.9.7, or a listed backport, and Roundcube to 1.6.20, 1.7.5, or later, which include the CVE-2026-114727 fix.

On Debian 12, install 10.0.0~dfsg-11+deb12u9 from the LTS update DLA-4914-1, which also fixes three other 2026 Ghostscript CVEs.

2. Reduce exposure until you can patch

No single setting closes every route, but these measures cut the documented ones:

  • In ImageMagick, disable the PostScript and PDF coders in policy.xml wherever the application does not need them. The DokuWiki and Roundcube paths both required a permissive policy.
  • In Python code, restrict the formats Pillow will open, for example with Image.open(f, formats=["PNG", "JPEG", "GIF", "WEBP"]) , so EPS content is rejected before any pixels are loaded.
  • Require authentication on shared CUPS queues, or stop sharing printers beyond trusted networks.
  • Turn off anonymous uploads in MediaWiki and DokuWiki, and remove upload fields from public WordPress forms and registration widgets until Ghostscript is fixed.
  • Check a file’s real content before any thumbnail or preview step, and reject the types you do not need. Roundcube’s fix, for example, stops passing EPS and SVG content to ImageMagick when it resizes images.
  • Run rendering workers under AppArmor, SELinux, or seccomp with no network access and no application secrets. In the Plesk test, an enforced AppArmor profile blocked the shell.

A starting ImageMagick policy entry:

The policy blocks legitimate PDF thumbnails too, so test it against your own previews before rolling it out.

3. Find exposed instances

No indicators of compromise or detection signatures have been published. To find Ghostscript in scope:

  • Check the installed package on each host, for example with dpkg -l ghostscript orrpm -q ghostscript , and compare it with the fixed builds above.
  • Check every container image that renders files, for example with docker run --rm <image> gs --version , because a host update does not reach the image.
  • List ImageMagick’s PostScript handling with magick -list format | grep -iE 'ps|pdf' (orconvert -list format on ImageMagick 6) to see whether it will pass those formats to Ghostscript.
  • Search your code for Imagick::readImage , Pillow calls that load pixels afterImage.open ,imageio.imread , and libvips thumbnailing applied to uploaded files.
  • Prioritize internet-facing webmail, WordPress sites with public upload forms, open wikis, shared print servers, and self-hosted AI image tools, then internal document systems.

For detection, alert on gs processes started by a web, mail, or print account that spawn a shell or write outside their temporary directory. Repeated gs crashes tied to uploads from one source are a stronger lead than a single failure.

Timeline #

pwn.ai says the Debian CUPS chain will be the first full case study and proof of concept in its series, with the other application write-ups to follow.

Why this keeps happening below the application #

Upload2Shell follows several remote code execution flaws in widely deployed server software that we have covered this month: CVE-2026-119618 in Apache HTTP Server, Java4Shell in the JDK, nginx2root in nginx, Ruby2Shell in the Ruby interpreter, and CVE-2026-115560 in PHP. Like Java4Shell and Ruby2Shell, it sits in a routine step applied to incoming data, here a thumbnail, preview, or print conversion, that the application calls without treating it as a security boundary.

Ghostscript adds a twist of its own, and the font code is familiar ground: iTnews notes that Artifex fixed a related flaw in the same font-handling file in 2018, found by Tavis Ormandy of Google through fuzzing, and that Artifex says it is working to remove the privileged operation behind this class of bug. Ghostscript’s sandbox is a set of checks inside the same interpreter that runs the attacker’s program, so any memory corruption bug in that interpreter can switch the sandbox off. That is the pattern behind CVE-2024-29510, which BleepingComputer reported as exploited in July 2024 using EPS files disguised as JPG images, and Debian’s tracker lists further Ghostscript code-execution fixes in 2026, including CVE-2026-39919 and CVE-2026-101258.

Tracking adds the same problem we described for Ruby2Shell, from a different direction. There the flaw had no CVE at first; here the CVE exists but describes a local attack, so tools that rank by CVSS vector see a library bug that needs a user to open a file. For flaws in renderers and runtimes, the reliable check is an inventory of what each service actually runs on the files it accepts, the point we also made for PHP2Shell about distribution backports.

How Equixly helps #

Upload2Shell is reached through ordinary upload, attachment, and import endpoints, so the first job is knowing which of them face the internet and which accept files from people without an account. Equixly maps the web applications and APIs that attackers can reach and records how each endpoint behaves, including the endpoints that accept files. Combined with your inventory of Ghostscript versions, that shows which upload and preview routes to fix first. For applications reachable only from your internal network, Equixly runs its tests through Space Link, a container you deploy inside that network.

Once pwn.ai publishes its application proofs, the same testing can check whether a file sent through your endpoints still reaches a vulnerable renderer and whether the upgrade closed the route. For the difference between a version match and a confirmed exposure, see Penetration testing vs. vulnerability scanning.

Book a demo to see how Equixly maps your exposed applications and APIs and tests them after you patch.

── more in #ai-safety 4 stories · sorted by recency
── more on @pwn.ai 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/upload2shell-ghostsc…] indexed:0 read:14min 2026-11-23 · —