Critical Ghostscript flaw lets attackers hijack servers via PDF uploads
Translated by a model; the original is in Russian.
Researchers at Wordfence (part of Defiant) have disclosed a critical vulnerability, CVE-2026-39919, in the Ghostscript interpreter and rendering engine. The heap buffer overflow can lead to remote code execution through a maliciously crafted PDF file.
Ghostscript is a PostScript and PDF interpreter that renders documents as images, generates preview thumbnails, and optimizes files by compressing embedded images and stripping unnecessary font data. That very processing chain turned out to be the weak point.
How the attack works
When generating a PDF thumbnail, WordPress can call the PHP Imagick extension, which invokes ImageMagick, which in turn launches Ghostscript. A PDF containing a JPEG 2000 image triggers incorrect handling of low-bit-depth samples and mismatched component resolutions. As a result, Ghostscript writes 1,024 bytes into a 256-byte buffer, corrupting adjacent memory and enabling unauthenticated code execution.
The flaw was found on August 23 using Argus, an AI-powered system, which also helped the team build two working exploits.
Scope of the problem
All Ghostscript versions from 9.21 through 10.07.1 are affected. The researchers tested ten Linux environments — including Debian, Ubuntu, Fedora, Alpine, and AlmaLinux — plus an official WordPress Docker image, and found the vulnerable code in every one.
Reliability of exploitation varies by environment. On a lab testbed the exploits were run against Linux packages 10,240 times without achieving code execution, yet they succeeded on a purpose-built test server. Success required tuning the PDF's fonts, language settings, font configuration, and one core system library — and even then it was not reliable.
For WordPress, four conditions must hold: the ability to upload a PDF (anonymously or with a low-privileged account), processing that generates a preview, a processing chain that reaches Ghostscript, and the presence of the unpatched code. Notably, a stock WordPress install does not allow anonymous Media Library uploads.
What to do
Artifex, the maintainer of Ghostscript, shipped a fix on September 8 in version 10.08.0, and the patches were backported to older branches. WordPress administrators should confirm with their hosting provider that version 10.08.0 or later is installed. Docker users are advised to rebuild images on an updated base. If upgrading is not possible, block PDF uploads or disable PDF rendering in ImageMagick.
So far Wordfence has seen no in-the-wild exploitation of the vulnerability.
Source: Bleeping Computer
Comments
Sign in, to comment.