Secure Bulletin Navigating the cyber sea with knowledge
Home > Articolo > Upload2Shell Flaw Turns Routine Ghostscript File Previews Into a Path to Server Takeover
Upload2Shell Flaw Turns Routine Ghostscript File Previews Into a Path to Server Takeover
Read Time:3 Minute, 57 Second

A newly disclosed flaw in Ghostscript, the open-source engine that countless applications quietly rely on to render PDF and PostScript files, has been shown to grant attackers command execution on WordPress sites, Roundcube webmail servers, and Linux print infrastructure. Researchers Paulos Yibelo and pwn.ai dubbed the issue Upload2Shell and tracked it as CVE-2026-125396, affecting all upstream Ghostscript releases prior to version 10.08.0.

What makes the flaw notable isn’t that Ghostscript itself was exposed to the internet — in every demonstrated case, it wasn’t. Instead, each affected system had its own legitimate feature, a thumbnail generator, a webmail preview, a print spooler, that handed an attacker-controlled file to Ghostscript automatically, with no direct exposure required.

A Rendering Engine That Runs Code by Design

PostScript, the format Ghostscript was originally built to render, is not a passive page description — it’s a full programming language. Rendering a PostScript or PDF file means executing instructions embedded inside it. Ghostscript’s -dSAFER mode exists specifically to sandbox that execution, restricting what a malicious document can touch.

Upload2Shell undermines that sandbox through a use-after-free bug, a class of memory-safety flaw where software continues referencing data after the memory holding it has already been released. The vulnerable code lives in Ghostscript’s Type 1 font loader, which failed to validate incoming data before an operation that could trigger an error. That error path exposed a protected memory write that a malicious document was never supposed to be able to reach — letting researchers tamper with Ghostscript’s own security checks while -dSAFER appeared to remain active throughout.

Three Different Services, One Shared Weak Point

The research team demonstrated the flaw through three independent chains, each reaching the same vulnerable Ghostscript code through a different front door:

  • WordPress: On a site configured with Imagick and ImageMagick, the media library’s own preview pipeline handed uploaded files to Ghostscript. WordPress tracks the core upload issue separately as CVE-2026-65640, already patched in core version 7.0.4 and backported to 6.9.7. Certain public-facing upload fields in the Forminator and Essential Addons for Elementor plugins reached the renderer even without a login in the configurations tested.
  • Roundcube webmail (1.7.2): An attacker needed no account on the target server at all. Simply having a recipient open — not even click or download — a crafted email attachment was enough to trigger thumbnail generation, which passed the file through ImageMagick into Ghostscript. The resulting command execution ran as the web service account, not on the victim’s own device.
  • Linux print servers: On a Debian 13 system, a shared CUPS print queue accepted network print jobs without requiring any credentials, then converted the submitted document through Ghostscript. Researchers confirmed code execution by having the exploit write a marker file as the print service’s own system account.

Requiring authentication blocked the anonymous version of each test, but the researchers stress that doing so only closes one entry point — it doesn’t fix the underlying Ghostscript flaw that all three chains ultimately exploit.

Patch Status: Why the Version Number Alone Isn’t Enough

Ghostscript’s maintainer, Artifex, shipped the fix in version 10.08.0. However, Linux distributions frequently backport security fixes into older version numbers of their own, which means checking the upstream release number isn’t a reliable way to judge exposure. Debian 13, for instance, received the fix inside its own 10.05.1~dfsg-1+deb13u2 build — a version string that looks nothing like “10.08.”

No confirmed real-world exploitation has been reported; the public research describes working demonstrations rather than attacks observed in the wild. That window is unlikely to stay open for long once technical details circulate more widely.

What Administrators Should Do

  • Inventory every service that renders untrusted files — CMS media libraries, webmail thumbnailing, print queues, and document converters — and confirm which specific Ghostscript build each one actually uses.
  • Don’t assume a patched host operating system covers Ghostscript copies bundled inside containers or application packages; check those independently.
  • Apply both the WordPress core fix and the underlying Ghostscript/ImageMagick patches, and audit public forms that funnel uploads into the Media Library.
  • Require authentication on shared print queues and restrict their network reachability.
  • Where patching must wait, temporarily disable automatic preview or thumbnail generation for untrusted file uploads.
  • Give renderer service accounts (such as www-data or lp) only the minimum access they need, since Upload2Shell’s demonstrated commands ran with those accounts’ existing permissions rather than root.

Upload2Shell is a useful reminder that “we don’t expose that service to the internet” is not the same as “that service is unreachable.” Any workflow that automatically processes an untrusted file — even one delivered through an entirely different application — inherits that file-processing engine’s vulnerabilities.

Share: Twitter  |  Facebook  |  LinkedIn
Join the discussion

This is a blog in the Fediverse: you can find this article everywhere with @blog@securebulletin.com and every comment/answer will appear here.

If you want to comment on Upload2Shell Flaw Turns Routine Ghostscript File Previews Into a Path to Server Takeover, use the discussion on Forum.

>> forum community

Comments

Leave a Reply