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. Upload2Shell, tracked as CVE-2026-125396 https://www.cve.org/CVERecord?id=CVE-2026-125396 , is a use-after-free in the Type 1 font loader 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 https://pwn.ai/upload2shell/research.html , 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 loader and a Qt install with the KImageFormats EPS plugin both reached Ghostscript, so check the loaders 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 https://pwn.ai/upload2shell/research.html and the upstream fix https://github.com/ArtifexSoftware/ghostpdl/commit/1484854e0c8ddfda1baa4ad4cd965b8a9790aa81 . We have not reproduced it in a lab. The font helper Ghostscript implements parts of its font loading 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 loader’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 https://github.com/ArtifexSoftware/ghostpdl/commit/e0421767e13627e75055bb44cb01486887c2f9e8 , 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 https://pwn.ai/upload2shell 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 a gs process that starts a shell, rather than as an application error. Where Ghostscript is linked in as a library, no separate gs 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 https://cyberdine.ch/news/die-nummer-kam-spaeter 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-loader 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 or rpm -q ghostscript , and compare it with the fixed builds above. - Check every container image that renders files, for example with docker run --rm