Home CVECVE-2026-39919: Ghostscript Flaw Lets Malicious PDFs Execute Code on Your Server

CVE-2026-39919: Ghostscript Flaw Lets Malicious PDFs Execute Code on Your Server

by Knowledge Base Linux
CVE-2026-39919 Ghostscript PDF heap overflow illustration

Your server probably runs Ghostscript even if nobody on your team has ever typed its name. It silently renders the PDF thumbnails behind WordPress media libraries, document portals, invoice systems and conversion APIs — and CVE-2026-39919, a heap buffer overflow in its JPEG 2000 decoder, lets a crafted PDF corrupt memory and execute code in that hidden layer. Wordfence researchers turned CVE-2026-39919 into unauthenticated remote code execution on a live WordPress test server. The fix has been out since September 8, 2026: Ghostscript 10.08.0.

CVE-2026-39919 at a Glance

CVE-2026-39919 is a heap-based buffer overflow in Ghostscript’s JPEG 2000 (JPX) decoding path, scored CVSS 9.8 (Critical) under v3.1 and 9.3 under v4.0. When a PDF contains a JPEG 2000 image whose components use sub-byte sample precision with mismatched component resolutions, the output adapter allocates a buffer sized for the packed data but then writes a full byte per output column — in the researchers’ proof of concept, roughly 1,024 bytes into a 256-byte buffer — overwriting heap memory-management metadata that Ghostscript later trusts. The overflow triggers even when Ghostscript runs with -dSAFER, the sandbox flag administrators rely on for processing untrusted files. The vulnerable code exists in Ghostscript 9.21 through 10.07.1, where the OpenJPEG-based decoder is present. The flaw was discovered by Wordfence Threat Intelligence using its Argus AI-assisted research system during a WordPress 7.1 security assessment, reported to Artifex on August 23, 2026, and fixed sixteen days later in 10.08.0. Wordfence published its full write-up on October 12. The company says it has not observed exploitation in the wild — but it also demonstrated that a 1,029-byte PDF uploaded to a WordPress site was enough to run code as the web server user on its purpose-built test system. Exploit reliability varies across distribution builds (fonts, locale and library versions all matter), which is a caveat about consistency, not safety.

Isolating document conversion to reduce CVE-2026-39919 risk illustration

Am I Affected by CVE-2026-39919?

The right question is not “do we use Ghostscript?” but “does anything on this server render PDFs it did not create?” Check the version, then trace the chain:

gs --version
which gs

Anything below 10.08.0 (and at or above 9.21) is in the affected range. The classic exposure path on web servers is: a user uploads a PDF → the application (WordPress with the Imagick PHP extension, for example) asks ImageMagick for a preview → ImageMagick delegates PDF rendering to Ghostscript. You can see whether ImageMagick is allowed to do that:

convert -list policy | grep -i pdf

Sites that accept PDFs from anonymous visitors, customers or low-privilege contributors are the priority, followed by mail gateways, print services and shared-hosting or container base images — one stale Ghostscript in a shared image exposes every tenant built on it. If you run WordPress in containers, as in our WordPress with Docker Compose guide, remember the vulnerable component lives in the image, not in WordPress — no plugin update will ever fix CVE-2026-39919.

How to Patch CVE-2026-39919 Step by Step

Step 1 — Upgrade the Ghostscript package on every host that processes documents. On Debian/Ubuntu:

sudo apt update
sudo apt install --only-upgrade ghostscript libgs10

On RHEL-family systems:

sudo dnf update ghostscript

Confirm your distribution’s package actually contains the 10.08.0 fix (distros sometimes backport it under an older version number — check the package changelog if the version surprises you).

Step 2 — Rebuild container images from updated bases and redeploy document-processing workers; images are where old Ghostscript versions go to live forever.

Step 3 — Verify:

gs --version

Temporary Mitigations for CVE-2026-39919

If patching has to wait, cut the most common delivery path by disabling PDF rendering in ImageMagick’s policy. In /etc/ImageMagick-6/policy.xml (path varies by version), ensure a rule like this exists:

<policy domain="coder" rights="none" pattern="PDF" />

PDF thumbnails will stop generating until you patch — an acceptable trade for most sites. Additionally: stop accepting PDF uploads from untrusted users where the business allows it, and isolate conversion into a separate, locked-down service that can read nothing else on the host and reach nothing on the network. Isolation limits the blast radius of CVE-2026-39919; it is not a fix.

Detection Notes

With no confirmed in-the-wild exploitation, detection is about crash telemetry and hygiene: look for gs or convert crashes and worker segfaults correlated with PDF uploads, and for unexpected processes spawned by the web server account shortly after document processing. Audit every system — including CI image builders and mail servers — for Ghostscript versions, because the vulnerable component hides behind two or three layers of other software. Wordfence’s own CVE-2026-39919 research write-up is the definitive technical reference.

Conclusion

CVE-2026-39919 is the supply-chain lesson of the month: the riskiest code on your server may be a decoder you never installed on purpose, three layers below your application. Update Ghostscript to 10.08.0 everywhere, disable ImageMagick’s PDF coder until you do, and inventory what else your upload pipeline quietly executes.

You may also like

KbLinux

Typically replies within a day

Hello, Welcome to the site. Please click below button for chatting me through Telegram.