GhostScript CVE 2026-125396: "Upload2Shell"
Here's the NVD page for the CVE with some additional useful context . Comments
Ghostscript has been hit with a critical security flaw affecting its Type 1 font loader. The vulnerability, tracked as CVE-2026-125396, enables attackers to execute arbitrary commands on the system, a technique dubbed "Upload2Shell." This occurs due to a use-after-free bug that provides a write-what-where primitive, allowing attackers to manipulate memory locations and execute commands.
The issue stems from the .putgstringcopy function in Ghostscript's font handling code. This helper function, which deals with font dictionaries in PostScript, was intended to be read-only but ended up being executed during font loading operations. Attackers can craft a malicious document and upload it, triggering the vulnerable code path.
This document can contain a PostScript file that leverages the .putgstringcopy function to write arbitrary data to protected memory areas, effectively bypassing Ghostscript's -dSAFER sandbox designed to restrict the functionality of untrusted code.
The exploit works by altering the interpreter's execution environment, allowing attackers to run commands with the privileges of the Ghostscript rendering process. This can lead to full system compromise, as the affected service account may have access to sensitive files and system resources. Notably, the vulnerability does not require an initial file upload to a server; a crafted file can be passed through any image-processing application that internally uses Ghostscript, such as PHP's ImageMagick bindings, Python's ImageIO, or Java's ImageIO.
The vulnerability was disclosed to Artifex, the maintainers of Ghostscript, and efforts are underway to patch the issue. However, due to the nature of PostScript's Turing-complete nature, the impact of this vulnerability is profound. It underscores the need for careful handling of file uploads and document rendering processes, as seemingly innocuous file formats like .pdf can be manipulated to execute malicious code.
Rewritten by urgent.news; may contain errors — check the original.