Critical Ghostscript Flaw Can Enable Unauthenticated RCE Through WordPress PDF Uploads

A critical vulnerability in Ghostscript could allow attackers to execute code remotely by uploading a specially crafted PDF file to vulnerable WordPress sites.

Tracked as CVE-2026-39919, the flaw carries a CVSS 3.1 severity score of 9.8 and affects Ghostscript versions 9.21 through 10.07.1. Artifex fixed the issue in Ghostscript 10.08.0, released on September 8, 2026.

The issue is a heap-based buffer overflow in Ghostscript’s JPEG 2000 image-processing path. A malicious PDF containing a specially formed JPEG 2000 image can cause Ghostscript to write data beyond an allocated memory buffer.

This memory corruption may crash the process or, in certain build-specific conditions, be developed into remote code execution.

Ghostscript Flaw Enables RCE

The vulnerability is not in WordPress itself. However, WordPress can expose the vulnerable Ghostscript component when it generates a preview image for an uploaded PDF.

On affected deployments, the processing chain is:

  • WordPress accepts a PDF upload.
  • The PHP Imagick extension passes the file to ImageMagick.
  • ImageMagick invokes Ghostscript to render a PDF page into an image.
  • Ghostscript processes the embedded JPEG 2000 content and triggers the memory corruption.

Researchers demonstrated unauthenticated remote code execution on a purpose-built WordPress test site where an upload form allowed public PDF submissions and the server automatically created PDF previews.

The exploit ran with the permissions assigned to the web server or Ghostscript process, rather than automatically granting root access.

The risk depends on the exact deployment. A site must allow an untrusted user to upload PDFs, process those files into thumbnails or previews, run a vulnerable Ghostscript package, and have a reachable PDF-rendering path.

Standard WordPress installations do not normally allow anonymous Media Library uploads, but form plugins, membership sites, document portals, and custom upload endpoints may create that exposure.

Administrators should install the Ghostscript update supplied by their Linux distribution or hosting provider. Ghostscript 10.08.0 includes the upstream fix, but distributions may backport the patch while retaining an older displayed Ghostscript version.

Therefore, organizations should verify the complete installed package revision rather than relying only on the output of gs --version.

Container users should rebuild and redeploy applications from an updated base image. Restarting an existing container does not replace its vulnerable Ghostscript package.

Until patching is complete, organizations should stop untrusted users from uploading PDFs or disable PDF reading in ImageMagick’s security policy. Rate limiting and upload limits can reduce exposure but do not eliminate the vulnerability, wordfence said.

The flaw also affects more than WordPress. Any application that sends attacker-controlled PDFs to Ghostscript including document-management platforms, mail gateways, print services, invoice processors, and conversion APIs should be reviewed and patched.

Ghostscript’s -dSAFER mode is not a complete mitigation because it restricts supported document features but does not prevent underlying memory corruption.

Join 16,000+ SOC teams using ANY.RUN to streamline threat investigations and reduce manual effort. Explore for your team 

Varshini
Varshini
Varshini is a Cyber Security expert in Threat Analysis, Vulnerability Assessment, and Research. Passionate about staying ahead of emerging Threats and Technologies..

Trending News

Related Stories