Researchers at Wordfence have disclosed a critical heap buffer overflow vulnerability in Ghostscript, the widely used PostScript and PDF interpreter, that can be exploited through specially crafted PDF uploads to achieve unauthenticated remote code execution. The flaw is tracked as CVE-2026-39919 and affects Ghostscript versions 9.21 through 10.07.1.

The vulnerability was found by Wordfence’s Argus AI-powered research system on August 23. Ghostscript is used to render PDFs as images, generate thumbnails, and optimize embedded content. In WordPress, the PHP Imagick extension often calls ImageMagick, which in turn launches Ghostscript to process uploaded PDFs.

A malicious PDF containing a JPEG 2000 image can trigger incorrect handling of low-bit-depth samples and mismatched component resolutions, forcing Ghostscript to write 1,024 bytes into a 256-byte buffer. That overflow corrupts adjacent memory and can lead to code execution.

Broad exposure, inconsistent exploitation

Wordfence tested ten Linux distributions, including Debian, Ubuntu, Fedora, Alpine, and AlmaLinux, along with an official WordPress Docker image, and found the vulnerable code present in all of them. However, successful exploitation proved inconsistent. Across 10,240 attempts in a lab testbed, the researchers could not trigger remote code execution against standard Linux packages, but did succeed against a purpose-built test server after adjusting PDF fonts, language settings, and a core system library.

For exploitation in a WordPress environment, four conditions must align: an attacker must be able to upload a PDF (anonymously or via a low-privileged account), the site must process that PDF for a preview or thumbnail, the processing chain must route through Ghostscript with rendering enabled, and the installed Ghostscript must contain the unpatched decoding code. Wordfence noted that stock WordPress does not allow anonymous Media Library uploads, which limits but does not eliminate risk.

Beyond WordPress, any application that renders attacker-supplied PDFs using affected Ghostscript code could be exposed, with authentication requirements varying by application.

Patch available

Artifex, the maintainer of Ghostscript, released a fix on September 8 in version 10.08.0, with patches backported to older branches. Administrators should confirm their hosting provider has upgraded Ghostscript to 10.08.0 or later, rebuild Docker images using patched base images, and, if patching isn’t immediately possible, block PDF uploads or disable PDF rendering in ImageMagick as a stopgap. Wordfence says it has not observed in-the-wild exploitation of CVE-2026-39919 to date.