Skip to content

Vulnerabilities & Patches

Pwn.ai demonstrates Ghostscript sandbox escape through crafted file uploads

Artifex patched the flaw as Ghostscript 10.08.0 on September 8, but many distributions still ship vulnerable code.

https://breach-signal.com/vulnerabilities/ghostscript-sandbox-escape-cve-2026-125396-patch/

Share

Key facts

  • Security firm pwn.ai demonstrated this week that a crafted file can escape Ghostscript's security sandbox and run commands on the processing server.
  • The flaw is tracked as CVE-2026-125396, was fixed on September 8, and has no reported in-the-wild attacks.
  • This week pwn.ai demonstrated that upload, preview and print functions in roughly ten common applications can be manipulated into sending a malicious file to Ghostscript.
  • Libraries including ImageMagick, Pillow, libvips, and Qt plugins can pass PostScript or EPS content to Ghostscript for rendering even when the file carries a .png, .jpg, or .pdf name.

Security firm pwn.ai showed this week that a malicious file can break out of Ghostscript’s sandbox and execute commands on the server handling it.

The flaw is tracked as CVE-2026-125396 and was fixed on September 8. pwn.ai reports no in-the-wild attacks. Last week, the CVE received an 8.5 out of 10 score in its security advisory.

The underlying bug is a use-after-free in Ghostscript’s font-loading component, a flaw where the program reuses freed memory. Exploiting it lets a crafted document turn off the -dSAFER sandbox checks that normally block commands and file access.

Ghostscript acts as an interpreter on many Linux servers, converting uploaded PDFs, PostScript files and images into other formats, often without the host application calling it directly. This week pwn.ai showed that roughly ten common applications expose upload, preview and print functions that can be abused to send a malicious file to Ghostscript.

A file may keep a .png, .jpg, or .pdf name while ImageMagick, Pillow, libvips, or Qt plugins still pass its PostScript or EPS content to Ghostscript for rendering. Thumbnail creation and picture cropping can start the interpreter, with the path depending on the application’s libraries.

The Ghostscript interpreter handles PostScript and PDF files, rendering PDFs as images, generating thumbnails for previews, and optimizing files by compressing embedded images and removing unneeded font data. The PHP Imagick extension can call ImageMagick to launch Ghostscript during WordPress PDF thumbnail generation.

The firm demonstrated the attack by sending the document through about ten applications and watching a server command execute under the low-privilege rendering account. One no-login path involved an anonymous print job to a shared queue running Debian 13. Another involved an emailed attachment that Roundcube webmail processed when the recipient opened the message.

A published proof-of-concept file demonstrates only the core memory trick. It modifies one value inside the running interpreter, then restores it, without running a shell command or touching host files, and it stops short on the patched 10.08.0 build.

The WordPress plugins Forminator and Essential Addons for Elementor offered public upload forms that required no login. WordPress Core required a file-upload account, a capability held by default by Authors and users in higher roles. Even though the flaw is classified as local, pwn.ai’s tests reached Ghostscript over the network through print jobs, e-mail, and web uploads.

Artifex released fixed Ghostscript version 10.08.0 on September 8 and is moving the vulnerable internal process into more secure code.

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

Ken Sharp, The Hacker News

According to the WordPress release notes, the upload path tracked as CVE-2026-65640 was closed in version 7.0.4, issued August 12. Patching only one leaves the other gap open because each fix shuts a different point of the same chain.

Updating works only if it reaches the specific renderer the application uses. Replacing the host package leaves a Ghostscript copy bundled inside a container image or application untouched, so outdated code may keep running.

Distribution coverage is uneven. The firm’s survey found several distributions still shipping a vulnerable Ghostscript or awaiting a fix as of last week. Debian 12 (Bookworm) appears on the vulnerable list. Fixes remain pending for Amazon Linux versions 2, 2023, and 2027 Preview.

A fix is in progress for SUSE Linux Enterprise 12 SP5 and parts of version 15, and for SUSE Linux Enterprise Server versions 16.0 and 16.1; openSUSE Leap 16.0 and 16.1 are affected.

The firm’s list tracks package status, not an attack path tested for each system. The firm has not confirmed fix status for Red Hat, Rocky Linux, AlmaLinux, Oracle Linux and stable Fedora packages.

Exposure can be reduced until the renderer is updated by requiring print-queue authentication and limiting the file types accepted by image processors. One test showed an AppArmor profile keeping the compromised interpreter from starting a shell.

The firm’s wider investigation reached live services including Google, which repaired the exposed route the previous week. The firm says similar problems reported at Dropbox and other unnamed services are separate Ghostscript bugs, not CVE-2026-125396.

CVE-2026-39919 is a critical heap buffer overflow in the Ghostscript interpreter and rendering engine, and specially crafted PDF files could allow remote code execution through it. Researchers at Defiant’s Wordfence platform discovered the flaw on August 23 using the Argus AI-powered system.

A crafted PDF containing a JPEG 2000 image can cause incorrect low-bit-depth sample handling and mismatched component resolutions. The exploits force Ghostscript to write 1,024 bytes into a 256-byte buffer, damaging adjacent memory and enabling unauthenticated remote code execution on WordPress. Wordfence says any online host running Ghostscript versions 9.21 through 10.07.1 is affected when the payload is adjusted.

The researchers tested ten Linux environments, including Debian, Ubuntu, Fedora, Alpine, and AlmaLinux, along with an official WordPress Docker image snapshot, and found vulnerable code in all of them. They tested two proof-of-concept exploits, and success varied by target environment. In a lab testbed, the researchers ran the exploits 10,240 times against Linux packages without achieving remote code execution. Remote code execution did succeed on a purpose-built test server.

Adjusting the PDF’s fonts, language settings, font configuration, and one core system library made the exploit work, though unreliably. On WordPress, successful exploitation requires an attacker to submit a PDF without authentication or with a limited-privilege account, and the site must process that PDF to generate a preview or thumbnail. Ghostscript must be in the processing chain, software and policy settings must permit PDF rendering, and Ghostscript must contain the unpatched vulnerable decoding code.

Stock WordPress does not allow anonymous Media Library uploads, Wordfence says. Any application rendering attacker-supplied PDFs through affected Ghostscript code may expose the flaw, with authentication needs varying by application.

Version 10.08.0 of Ghostscript was released on September 8. Fixes were backported to older versions, so users should check revision details for patch status. Administrators should confirm with their hosting provider that Ghostscript is upgraded to version 10.08.0 or later, Wordfence says.

Wordfence says Docker users should rebuild and redeploy using an updated, patched base image. Wordfence recommends blocking PDF uploads or disabling PDF rendering in ImageMagick if an upgrade is not possible. Wordfence said it has not yet observed in-the-wild exploitation of CVE-2026-39919.

Was this helpful?

Join the discussion

Please read our Comment Policy before commenting. First-time comments are held for moderation. By posting a comment you agree to our Terms of Use and Privacy Policy, which explain how your name, email address and comment are used.

Your email address will not be published. Required fields are marked *