Skip to main content
CybersecurityVulnerability Management

Ghostscript Flaw Exposes Servers to Remote Code Execution via File Uploads

Server room with rows of equipment and technicians in background, one server screen prominent.

"An ancient piece of code well known to be a vulnerability, but difficult to eradicate."

So wrote Ken Sharp, the developer who applied the fix, describing the portion of Ghostscript at the centre of a now-patched vulnerability that allowed crafted files to escape the interpreter's sandbox and run commands on servers that processed them. The flaw, tracked as CVE-2026-125396, was fixed in Ghostscript 10.08.0 on September 8; the CVE appeared in public advisories last week with a score of 8.5 out of 10. Security firm pwn.ai demonstrated the exploit chain against a range of popular applications and reported no known cases of the flaw being used in the wild.

CVE-2026-125396: a use-after-free in Ghostscript’s font loader that defeats -dSAFER

The underlying bug is a use-after-free in Ghostscript’s font-loading code. A crafted PostScript or EPS document can exploit that memory corruption to switch off the interpreter's -dSAFER sandbox checks — the safety switch intended to prevent documents from running commands or reaching files. pwn.ai’s proof-of-concept demonstrates the memory manipulation core of the attack: it changes a value inside the running interpreter and then sets it back. That minimal proof-of-concept does not execute shell commands or touch files; on the patched 10.08.0 build it fails before the exploit point.

How routine uploads and previews hand hostile files to Ghostscript

Ghostscript often runs behind the scenes: image and document libraries such as ImageMagick, Pillow, libvips, or a Qt plugin will hand PostScript or EPS content to Ghostscript for rendering even when a file is named .png, .jpg, or .pdf. pwn.ai showed that ordinary features — making a thumbnail, cropping an image, previewing or printing — can start the interpreter. In about ten common applications the firm fed a crafted document and observed a command run on the server, each time as the low-privilege account that performs rendering.

Several exploitation paths required no login: an anonymous print job to a shared Debian 13 print queue; an emailed attachment that Roundcube webmail rendered the moment the recipient opened the message; and public upload forms in the WordPress plugins Forminator and Essential Addons for Elementor. WordPress Core itself required an account with file-upload ability (Authors and higher by default) to reach Ghostscript in the tests pwn.ai conducted.

Patch deployment, WordPress timing, and uneven distribution coverage

Artifex, Ghostscript’s developer, released the fix in version 10.08.0 on September 8 and said it is moving the vulnerable internal step into safer code. WordPress had already closed its own upload path on August 12 in version 7.0.4 under a separate identifier, CVE-2026-65640; WordPress notes that its fix and the Ghostscript fix address different points in the same chain, so applying one does not remove the need for the other.

pwn.ai’s survey of Linux distribution packages shows uneven coverage. As of last week the survey listed Debian 12 (Bookworm) as vulnerable; Amazon Linux 2, 2023, and 2027 Preview as “fix pending”; SUSE Linux Enterprise 12 SP5 and parts of 15, and SUSE Linux Enterprise Server 16.0 and 16.1 as “fix in progress”; and openSUSE Leap 16.0 and 16.1 as affected. The firm did not establish whether current Red Hat, Rocky Linux, AlmaLinux, Oracle Linux, or stable Fedora packages carry the fix. The firm also emphasised that updating the host operating system does not update any separate copy of Ghostscript bundled inside a container image or application; a document worker can continue to run old code after the host package is replaced.

Mitigations observed: authentication, file-type limits, AppArmor, and renderer updates

Until every renderer is updated, exposure can be reduced in multiple ways. pwn.ai recommends requiring authentication on print queues and limiting which file types an image processor accepts. System-level controls can help: in one test an AppArmor profile stopped the compromised interpreter from starting a shell. Crucially, the fix helps only where it reaches the renderer actually in use; administrators must update the Ghostscript instance their application calls, including any copies bundled in containers or application distributions.

What this means for WordPress site operators, Linux distributors, and mail and print service operators

  • WordPress site operators: apply WordPress 7.0.4 to close the platform’s upload path (CVE-2026-65640) and ensure any Ghostscript instance reachable from your site is updated to 10.08.0 or later; both updates are required because they cover different points in the exploitation chain.
  • Linux distributors and packagers: customers rely on you to move fixes into packages and images; the survey shows several releases still marked vulnerable or with fixes pending, and bundled copies in containers will remain a gap unless rebuilt.
  • Mail and print service operators: require authentication on public print queues, patch mail-rendering components such as Roundcube, and limit automatic rendering of attachments — pwn.ai demonstrated unauthenticated paths that reached Ghostscript.

pwn.ai’s disclosure underlines a recurring operational truth: modern servers run long chains of libraries and tools, and a flaw deep in an interpreter can be reached by mundane features such as thumbnails, previews, or print jobs. Artifex’s 10.08.0 fix closes the vulnerability at source; the remaining task is for upstream vendors, packagers, and administrators to ensure the corrected renderer is the one actually used in production. The original report and technical analysis are available at The Hacker News.

https://thehackernews.com/2026/11/researchers-demonstrate-ghostscript.html