Ghostscript Flaw CVE-2026-39919: How One PDF Can Take Over a Server, and Who Is Really at Risk

A kitten dressed as a little ghost under a white cloth on a desk in a server room, a woman lifting the corner of the cloth

Most people have never installed Ghostscript and have no idea they use it. Yet it sits underneath an enormous number of servers: it is what turns an uploaded PDF into a thumbnail in WordPress, in document management systems, in mail gateways and in “compress your PDF online” services. In September 2026 it received a fix for a flaw that lets a carefully crafted PDF lead to code execution on whatever machine processes the file.

Below is what is known for certain, what is not, how to check your own server, and what the story means for anyone who sends their documents somewhere online to be processed.

The short version

  • The flaw: CVE-2026-39919, a heap buffer overflow in Ghostscript’s JPEG 2000 handling. A PDF with a suitably prepared image is enough to trigger it.
  • Affected versions: 9.21 through 10.07.1 according to the researchers who found it (the CVE record says “before 10.08.0”).
  • The fix: Ghostscript 10.08.0, released on September 8, 2026. Linux distributions backport the fix into older version numbers, so what counts is the full package revision, not what gs --version prints.
  • Severity: 9.8 on CVSS 3.1 according to the CVE record, 7.8 (“Moderate”) according to Red Hat. Both numbers are honest; they describe different scenarios.
  • Attacks in the wild: none confirmed so far. The working exploit was built in a lab and tailored to one specific build.
  • -dSAFER does not protect you. The bug triggers with the sandbox enabled.

What happened

The flaw was found by Wordfence, a WordPress security company, using Argus, its AI-assisted testing system. That was on August 23, 2026, during a security assessment of WordPress 7.1. The tool followed an uploaded file further than the PHP code that accepted it: through the Imagick extension, through ImageMagick, down to Ghostscript and the JPEG 2000 decoder at the very bottom.

Artifex, the company behind Ghostscript, confirmed the report the next day and shipped version 10.08.0 with the fix on September 8. The CVE record was published on September 15. Wordfence published the technical details on October 12, and BleepingComputer and the rest of the trade press picked it up a day later.

How the bug works

You don’t need to know C to follow this. An image is a grid of samples. JPEG 2000 allows the components of an image (brightness and transparency, for example) to have different resolutions, and allows a single sample to take fewer than 8 bits. With 2-bit samples, four of them fit into one byte.

In the example the researchers describe, one row of the image holds 1,024 such samples. Packed, that is 256 bytes, and Ghostscript correctly reserves 256 bytes. But when both of the conditions above occur together, the loop that fills the row writes one whole byte per sample instead of packing four into each byte. 1,024 bytes go into a 256-byte buffer. The extra 768 bytes on every row overwrite memory where Ghostscript keeps its own bookkeeping. And because those bytes come from the image, the person who made the file chooses what they contain.

Wooden mail pigeonholes in an old post office, a kitten in every slot, with kittens spilling onto the floor at the end of the row

That is the classic path from “the program crashed” to “the program did what the attacker told it to”. Modern systems make that path much harder (randomized memory layout and other protections), but they don’t close it completely.

How a PDF reaches Ghostscript in WordPress

WordPress doesn’t draw PDF previews itself. Since version 4.7 it can generate an image of the first page of an uploaded document, and it does that through other programs. The chain looks like this:

WordPress → PHP Imagick extension → ImageMagick → Ghostscript

Ghostscript runs as a separate process, usually under the same account as the web server. It only starts when something asks for a picture of the PDF. A form that saves a file to disk and does nothing else with it never starts it.

An attack along this path needs all four of these to be true at the same time:

  1. someone from outside (anonymously, or with a low-privileged account) can upload a PDF,
  2. the site asks for a preview or thumbnail of that file,
  3. the server has Imagick or another tool that calls Ghostscript for that purpose, and ImageMagick’s policy allows reading PDFs,
  4. the installed Ghostscript does not have the fix.

An important caveat: stock WordPress does not let anonymous visitors upload files to the Media Library. An attacker needs a plugin, a form with an attachment field, or an account that opens that path. Wordfence also checked the official WordPress Docker image: it contained a vulnerable Ghostscript 10.05.1, the Imagick extension and a working PDF preview path. On its own, though, it was not enough for an anonymous attack.

One detail works in the attacker’s favour: when the first preview attempt fails, WordPress automatically tries again with different settings. Three malicious attachments therefore mean six Ghostscript runs. In Wordfence’s test the form still reported a successful upload while Ghostscript crashed quietly in the background.

This is not a bug in WordPress or in the form plugin. They were simply the route the file took to reach Ghostscript.

How dangerous is it, really

This is worth slowing down for, because headlines like “one PDF hijacks your server” are only half true.

Why two different scores. The CVE record gives it 9.8 out of 10 (CVSS 3.1) and 9.3 (CVSS 4.0). Those numbers describe the worst case: a network-facing application that accepts PDFs without a login or any human involvement. Red Hat rates the same flaw 7.8 and calls it “Moderate”, because it scores the scenario in which a user opens a malicious file on their own computer. Neither score is wrong; they answer different questions.

How many attempts, how many successes. Wordfence built two working exploits for its lab build, then ran them 10,240 times across ten other environments: Debian, Ubuntu, Fedora, AlmaLinux, Alpine and the official WordPress container. They did not succeed once. On the build they were made for, they kept working, even after fonts, language settings and one core system library were changed, though not on every attempt.

The conclusion cuts both ways. There is no single file that opens every server in the world. But an attacker doesn’t need a universal file when targeting a specific company, or a hosting platform where hundreds of sites run on an identical system image. The researchers point out that in a similar case involving the libheif library, another team, helped by AI, adapted an exploit to each new target in a day or two.

With what privileges. The attacker’s code runs under the account that processes the PDF, usually the web server’s account. That is not automatically root, but that account can usually read the site’s files, including the configuration holding the database password.

Attacks in the wild: as of this writing, nobody has reported this flaw being exploited outside a lab.

How to check your own server

A woman in glasses at her laptop, a tabby kitten beside her staring at the screen, a magnifying glass on the desk

If you have shell access, start with three questions.

1. Is Ghostscript here at all, and which package revision?

  • Debian and Ubuntu: dpkg -s ghostscript | grep Version
  • Fedora, RHEL, AlmaLinux: rpm -q ghostscript
  • For completeness: gs --version, but that number alone settles nothing.

Why isn’t the number enough? Ubuntu 22.04 fixed the flaw in package 9.55.0~dfsg1-0ubuntu5.14, which still answers “9.55.0” when asked for its version. Debian 13 has the fix in 10.05.1~dfsg-1+deb13u2 (advisory DSA-6516-1). Red Hat shipped fixes for RHEL 10, 9 and 8 between October 1 and 6. According to Debian’s tracker, Debian 12 (bookworm) is still marked as vulnerable. Always compare against your distribution’s advisory.

There is a trap in the other direction too: the 10.08.0 release candidate reports itself as 10.08.0 and does not contain the fix. That is exactly what Wordfence’s own test machine was running. If you built Ghostscript from source, make sure you have the final release.

2. Does PHP have Imagick? php -m | grep -i imagick. In the WordPress dashboard: Tools → Site Health → Info → Media Handling. That is only a starting point: it shows whether Imagick recognises PDF, but says nothing about whether Ghostscript is patched.

3. Can ImageMagick read PDFs? convert -list format | grep -i pdf (on ImageMagick 7: magick -list format). The letters rw next to PDF mean the path to Ghostscript is open.

Containers: a restart is not enough. Pull an updated base image, rebuild without cached layers and redeploy.

Shared hosting: you usually can’t check this yourself. Ask your provider two questions: does the Ghostscript package on its servers include the fix for CVE-2026-39919, and are PDFs uploaded by customers turned into previews anywhere on its systems.

If you can’t update right away

  • Stop accepting PDFs from anonymous visitors and low-privileged accounts. A file that never reaches the server never reaches Ghostscript.
  • Disable PDF reading in ImageMagick’s policy. In policy.xml (usually under /etc/ImageMagick-6/ or /etc/ImageMagick-7/), add <policy domain="coder" rights="none" pattern="{PS,PS2,PS3,EPS,PDF,XPS}" /> inside the <policymap> section. Side effect: WordPress will stop generating PDF thumbnails.
  • Limit files per submission and rate-limit uploads. That reduces the number of attempts an attacker gets, but fixes nothing.
  • Isolate document conversion in a separate service with no access to site secrets and no unnecessary network connections. That limits the damage, but is not a fix either.

What not to do: don’t treat -dSAFER as protection. Ghostscript’s sandbox restricts what a document can do through documented PostScript features. It does not prevent memory corruption, and in testing the bug triggered with the sandbox on. No WordPress plugin can fix this, because Ghostscript comes from the operating system or the container image, not from WordPress.

Don’t confuse this flaw with CVE-2026-65640. That is a different issue: remote code execution in WordPress via an uploaded PostScript file, which also passes through Imagick and Ghostscript, but requires an account allowed to upload files (usually Author or above). It was fixed in WordPress 7.0.4, with backports down to the 4.7 branch.

This is not just a WordPress problem

WordPress is one of many routes a stranger’s PDF can take to Ghostscript. The same applies to document management systems, print servers, invoice processing, preview generators, mail gateways that scan attachments and file conversion APIs. The question is always the same: does this software render PDFs that came from someone else?

Searching your own application’s code for the word “Ghostscript” may turn up nothing. ImageMagick or another library usually sits in between, and Ghostscript is only called by that.

What this means for sending PDFs online

This story has another side that gets less attention. A “compress PDF”, “PDF to image” or “merge PDFs” service in the browser is exactly the kind of server described above: it accepts files from strangers and runs them through tools that take them apart and put them back together. You don’t know what it uses, in which version, or whether it updated after September 8. What you do know is that your file sits, at least for a while, on the same machine as files from thousands of other people, some of which may be crafted.

That doesn’t mean every online service is full of holes. It means that when you upload a contract, an ID scan or medical results, you hand them to a place whose security you can’t verify. There is more on this in the article on the risks of online PDF tools.

In fairness, local processing is not immune by definition. If you compress PDFs yourself with Ghostscript, as in the PDF compression guide, update it to 10.08.0 or later. The advantage of working offline lies elsewhere: the document never leaves your computer, and you decide which software version handles it, not someone you have never met.

If you regularly merge, split, encrypt or convert PDFs to Word, you can do it without uploading them anywhere. PDF Manipulator is free, runs on Windows and Linux, and every file stays on your computer.

Sources

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top