Upload2Shell: Critical Ghostscript Flaw Lets Attackers Execute Commands Remotely

A newly discovered vulnerability in Ghostscript—dubbed “Upload2Shell” and tracked as CVE-2026-125396—allows attackers to run commands on WordPress, Roundcube webmail, and Linux print servers by exploiting routine file processing. The issue impacts Ghostscript versions before 10.08.0, and doesn’t require direct exposure of Ghostscript itself when services like previews or thumbnails feed files into it.

The Mechanism: How Ghostscript’s Type 1 Font Loader Is Exploited

Ghostscript renders PDFs and PostScript documents—a system which executes document-contained instructions. To restrict what those instructions can do, it provides a sandbox mode using the “‐dSAFER” flag. Upload2Shell undermines that protection through a use-after-free bug inside Ghostscript’s Type 1 font loader.

Specifically, the loader fails to verify the data type before performing an operation that could trigger an error. If that error occurs, it can lead to a write in protected memory—something attackers can control. Research shows this flaw lets them bypass the safety checks while Ghostscript is still running in “‐dSAFER” mode, allowing command execution with whatever permissions the renderer process has—not elevated root privileges.

Real-world Impact: WordPress, Roundcube, CUPS & More

Multiple services are exposed thanks to this flaw combined with common tools like ImageMagick or Imagick. On WordPress, media preview features reach into Ghostscript via Imagick; users with upload privileges (like Authors) or untrusted public upload forms were shown to be vulnerable. Fixes in WordPress core (version 7.0.4 and backported releases) have addressed these issues.

Roundcube webmail (version 1.7.2) was shown to allow remote attackers to deliver malicious attachments that generate thumbnails via ImageMagick, which in turn pass the content to Ghostscript. The webmail recipient only needs to view the message—no download or click required. Execution happens under the web server’s account (e.g. www-data), not the user’s device.

Shared print servers also pose a risk. On Debian 13, a poorly configured CUPS setup that accepts print jobs over the network without authentication sends documents to Ghostscript for rendering. Researchers were able to create files written by the print service account (‘lp’) as proof of code execution.

Patches & Mitigations: What To Do Now

The upstream vulnerability has been patched in Ghostscript version 10.08.0. Some Linux distributions have applied equivalent remediations to earlier versions; for example, Debian 13 includes the fix in its package version “10.05.1~dfsg-1+deb13u2.”

Administrators should check every service that uses Ghostscript—especially those wrapped inside containers or bundles—and ensure each copy is updated. On WordPress sites, both core and renderer components need updating; public upload forms should be reviewed. If patches can’t be applied immediately, disable automatic previews for uploads from untrusted sources.

For print servers, require authentication for shared queues, restrict network access, isolate renderers, and limit service account permissions. Trace the specific worker processes that handle previews, thumbnails or printing to verify they use a secure version of Ghostscript.

Analysis:Upload2Shell strikes at the heart of how document rendering is often hidden—and trusted—in many web platforms and services. It underscores the risk of chaining tools like ImageMagick and Ghostscript together without fully understanding how sandboxing protections can fail. What makes this flaw especially dangerous is how automatic workflows—thumbnails, previews, print queues—can serve as attack vectors, even when end users never directly interact with unsafe code. Going forward, project maintainers should treat every automatic file rendering path as a potential risk zone, and security reviews must include memory errors in auxiliary components like font loaders. Monitoring deployments for Ghostscript version usage, container bundling, and configuration defaults will be key to preventing real-world exploitation of Upload2Shell.