Protect.Computer
NEWS

Ghostscript Upload2Shell Flaw Turns File Uploads Into Server RCE

· 3 min read · Malicious byte Device safety
Ghostscript Upload2Shell Flaw Turns File Uploads Into Server RCE

A use-after-free bug in Ghostscript, the interpreter many Linux servers use to turn uploaded PDFs, PostScript files and images into other formats, lets a crafted file escape the program’s -dSAFER sandbox and run commands on the server. The flaw is tracked as CVE-2026-125396 and nicknamed Upload2Shell by pwn.ai, the security firm that found it. Artifex fixed it in Ghostscript 10.08.0 on September 8; The Hacker News reports there have been no reports of it being used in attacks.

The reason it matters is how easily a file reaches Ghostscript. According to pwn.ai, image libraries such as ImageMagick can hand PostScript or EPS content to Ghostscript even when the file is named .png or .jpg, so a thumbnail or crop feature can start the interpreter. The VulnCheck advisory describes the mechanism: a crafted PostScript or PDF document triggers a type error, recovers the privileged .forceput operator through a custom error handler and then causes a use-after-free across save/restore. pwn.ai says it demonstrated command execution, as the low-privilege account that does the rendering, in about ten applications, among them an IPP print job to a shared Debian 13 CUPS queue, an attachment thumbnailed when a Roundcube user opened the email, and public upload forms in the Forminator and Essential Addons for Elementor WordPress plugins. WordPress Core needed an account that can upload files, which Authors and above have by default. The CVE is classified as a local flaw, but pwn.ai’s tests reached Ghostscript from the network.

WordPress closed its own upload path in version 7.0.4 on August 12 under a separate identifier, CVE-2026-65640. The Hacker News notes that the two fixes cover different points in the same chain, so updating one does not replace the other. This is a different flaw from the Ghostscript PDF bug (CVE-2026-39919) we covered in October.

How to check if you’re affected

Affected versions are Ghostscript releases before 10.08.0, per VulnCheck’s advisory. The Hacker News reports a CVSS score of 8.5 from the advisory. Applications are exposed when their upload, preview, thumbnail, print or email-import features end up calling Ghostscript, directly or through a library such as ImageMagick, Pillow, libvips or a Qt plugin.

  • Check the renderer you actually run. The Hacker News says updating the host’s package does not update a separate copy of Ghostscript bundled inside a container image or an application, so a document worker can keep running the old code. (Our own suggestion, not from the sources: gs --version inside each image or worker shows which copy it uses.)
  • Distribution status. pwn.ai says Debian backported the fix into its security package (Debian 13 build 10.05.1~dfsg-1+deb13u3 is marked fixed) and that Ubuntu released fixed packages for seven supported releases on October 21 (USN-8949-1). The Hacker News, citing the firm’s survey as of last week, lists Debian 12 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. Check your distribution’s own tracker for the current state.
  • Application fixes. WordPress 7.0.4 or later closes its upload path (CVE-2026-65640), and pwn.ai says Roundcube restricted unsafe attachment image types under CVE-2026-114727. The pages I read do not state fix status for the Forminator and Essential Addons for Elementor plugins.
  • Until the renderer is updated, The Hacker News says exposure can be reduced by requiring authentication on print queues and limiting which file types an image processor accepts, and that in one test an AppArmor profile stopped the compromised interpreter from starting a shell.

Sources

Related reading