Threat reportVulnerabilityTL-2026-3398
Critical Ghostscript Heap Buffer Overflow in JPEG 2000 Output Adapter Enables RCE via Malicious PDFs (CVE-2026-39919)
CVE-2026-39919 is a heap-based buffer overflow in Ghostscript's JPEG 2000 output adapter (base/sjpx_openjpeg.c), triggered by PDFs embedding JPEG 2000 images with mismatched component subsampling, and can lead to remote code execution. All Ghostscript versions before 10.08.0 are affected; a functional PoC was demonstrated against a WordPress -> Imagick -> ImageMagick -> Ghostscript chain, but no in-the-wild exploitation or CISA KEV listing is stated in the sources. First disclosed .
Key facts
| Identifiers | TL-2026-3398, CVE-2026-39919, CVE-2026-65640 |
|---|---|
| Severity | CRITICAL |
| CVSS | 9.8 (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H) |
| First disclosed | |
| Exploitation status | Public proof-of-concept exploit for a linked CVE |
| EPSS | CVE-2026-65640: 1.9% (80.1th percentile); CVE-2026-39919: 0.8% (58.1th percentile) |
| Affected products | Artifex Software Ghostscript; Debian ghostscript package; Red Hat ghostscript on Enterprise Linux 8, 9, 10 |
| Weaknesses (CWE) | CWE-122 |
| Tools | ImageMagick, Imagick |
| MITRE ATT&CK techniques | T1036.008 Masquerade File Type, T1059 Command and Scripting Interpreter, T1190 Exploit Public-Facing Application, T1203 Exploitation for Client Execution, T1204.002 User Execution: Malicious File, T1587.004 Exploits, T1588.005 Obtain Capabilities |
| Motivation | UNKNOWN |
| Target sectors | technology, media-publishing, government administration, finance, business-services |
| Target regions | Global |
| Detection rules | 9 (1 shown free) |
| Sources | 10 cited sources |
Detection coverage
As of 2026-10-14, Threadlinqs Intelligence publishes 9 detection rule(s) for TL-2026-3398 across Splunk SPL, Microsoft KQL and Sigma, covering 18 indicator(s) of compromise. The whole corpus is readable without an account. Every threat comes with one complete detection in Splunk SPL, Microsoft KQL and Sigma, free for everyone; a free account adds daily TL Creds to unlock the rest. Paid plans add a larger daily allowance, correlation and the MCP server. Threadlinqs MCP server · View plans.
Free detection: Shell or Download Tool Spawned by Ghostscript / ImageMagick (CVE-2026-39919 Post-Exploitation) [SPL]
Detects gs, convert, magick, identify or mogrify spawning a shell, downloader, interpreter or netcat-style binary. After a successful CVE-2026-39919 heap overflow in the Ghostscript JPEG 2000 adapter, code execution inside the rendering process typically spawns sh/bash, curl/wget or a scripting runtime in the context of the web user (e.g. www-data). The normal ImageMagick delegate chain (convert -> sh -c 'gs -sDEVICE=...') is excluded.
- Languages: Splunk SPL, Microsoft KQL, Sigma
- ATT&CK: T1059, T1059.004, T1203
- Data sources: sysmon_for_linux, microsoft_defender_for_endpoint_linux, linux_process_creation
- Severity: critical
- Confidence: high
Splunk SPL
index=linux sourcetype="sysmon:linux" EventID=1 earliest=-24h
| eval parent_name=lower(replace(ParentImage,"^.*/","")), child_name=lower(replace(Image,"^.*/",""))
| where match(parent_name,"^(gs|ghostscript|convert|magick|identify|mogrify)(-im[0-9]+.*)?$")
| where match(child_name,"^(sh|bash|dash|zsh|curl|wget|nc|ncat|socat|python[0-9.]*|perl|php[0-9.]*|ruby|busybox)$")
| where NOT (match(child_name,"^(sh|dash|bash)$") AND match(CommandLine,"(-sDEVICE|-dBATCH|ghostscript)"))
| stats count min(_time) as first_seen max(_time) as last_seen values(CommandLine) as child_cmd values(ParentCommandLine) as parent_cmd by host User parent_name child_name
| convert ctime(first_seen) ctime(last_seen)
| eval detection="TL-2026-3398 CVE-2026-39919 post-exploitation child process of Ghostscript/ImageMagick"Microsoft KQL
DeviceProcessEvents
| where Timestamp > ago(24h)
| where InitiatingProcessFileName in~ ("gs", "ghostscript", "convert", "magick", "identify", "mogrify", "convert-im6.q16", "convert-im7.q16")
| where FileName in~ ("sh", "bash", "dash", "zsh", "curl", "wget", "nc", "ncat", "socat", "python", "python3", "perl", "php", "ruby", "busybox")
| where not (FileName in~ ("sh", "bash", "dash") and ProcessCommandLine has_any ("-sDEVICE", "-dBATCH", "ghostscript"))
| project Timestamp, DeviceName, AccountName, InitiatingProcessFileName, InitiatingProcessCommandLine, FileName, ProcessCommandLine
| extend Detection = "TL-2026-3398 CVE-2026-39919 post-exploitation child process of Ghostscript/ImageMagick"Sigma
title: Shell or Download Tool Spawned by Ghostscript / ImageMagick (CVE-2026-39919 Post-Exploitation)
id: 3a7c1e52-8d4b-4f0a-9b36-5e2d71c4a002
status: experimental
description: Detects a shell, downloader or interpreter spawned by Ghostscript or ImageMagick, indicating code execution after CVE-2026-39919 exploitation via a malicious PDF.
references:
- https://services.nvd.nist.gov/rest/json/cves/2.0?cveId=CVE-2026-39919
- https://github.com/ArtifexSoftware/ghostpdl/commit/0a8bf88e39db07b0751a58d6ec1cf992073e4dc1
- https://bugs.ghostscript.com/show_bug.cgi?id=709666
author: Threadlinqs Team
date: 2026-10-13
tags:
- attack.execution
- attack.t1059
- attack.t1059.004
- attack.t1203
- cve.2026.39919
logsource:
category: process_creation
product: linux
detection:
selection_parent:
ParentImage|endswith:
- '/gs'
- '/ghostscript'
- '/convert'
- '/magick'
- '/identify'
- '/mogrify'
- '/convert-im6.q16'
- '/convert-im7.q16'
selection_child:
Image|endswith:
- '/sh'
- '/bash'
- '/dash'
- '/zsh'
- '/curl'
- '/wget'
- '/nc'
- '/ncat'
- '/socat'
- '/python'
- '/python3'
- '/perl'
- '/php'
- '/ruby'
- '/busybox'
filter_delegate:
Image|endswith:
- '/sh'
- '/bash'
- '/dash'
CommandLine|contains:
- '-sDEVICE'
- '-dBATCH'
- 'ghostscript'
condition: selection_parent and selection_child and not filter_delegate
falsepositives:
- Custom ImageMagick delegates that legitimately invoke shells
- Administrators testing conversions interactively
level: critical
Known false positives:
- Custom ImageMagick delegates in policy/delegates.xml that legitimately shell out
- Administrators debugging conversions interactively under a gs or convert parent
Tuning notes: Sysmon for Linux sourcetype (sysmon:linux) is an assumption; adjust to your TA. Extend the child list with your environment's interpreters. The delegate exclusion keys on -sDEVICE/-dBATCH/ghostscript in the shell command line, so tighten it to your exact delegate string if attackers could embed these tokens. Escalate immediately when the user is a web service account.
- Burst of Web-Server-Driven PDF Rendering via ImageMagick / [indicator] (CVE-2026-39919 Exploit Attempts) [KQL] · unlock with TL Creds
- Script or Web Shell Written to WordPress Uploads Directory After Renderer Compromise (CVE-2026-39919 Persistence) [KQL] · unlock with TL Creds
- Reverse Shell Command Lines from Web Service Account or Renderer Process (CVE-2026-39919 C2) [KQL] · unlock with TL Creds
- ImageMagick Forced PostScript/PDF Coder on Image-Extension File (Masqueraded Payload to [indicator]) [Sigma] · unlock with TL Creds
- Payload Download by Web Service Account into Temp or Piped to Shell (CVE-2026-39919 Ingress Tool Transfer) [Sigma] · unlock with TL Creds
- DNS Query to Out-of-Band Interaction or Tunnelling Service (CVE-2026-39919 Blind RCE Callback) [Sigma] · unlock with TL Creds
- [indicator] / ImageMagick Crash in JPEG 2000 Decoder Path (CVE-2026-39919 Exploitation) [SPL] · unlock with TL Creds
- Outbound Network Connection from [indicator] / ImageMagick Process (CVE-2026-39919 C2 / Payload Retrieval) [SPL] · unlock with TL Creds
Indicators of compromise
As of 2026-10-14, Threadlinqs Intelligence tracks 18 indicators of compromise for TL-2026-3398.
Technical analysis
CVE-2026-39919 (CWE-122) is a heap-based buffer overflow in the JPEG 2000 output adapter of Ghostscript (Artifex Software), implemented in base/sjpx_openjpeg.c. When the components of a JPEG 2000 image declare different subsampling factors, the non-samescale, sub-byte-depth output path allocates a row buffer sized for packed output but writes a full byte for each output column regardless of bit depth. The overflow corrupts the internal chunk-allocator (memory-management) metadata, which can be leveraged for code execution. The trigger is a crafted PDF containing a JPEG 2000 image with sub-byte sample precision and differing component resolutions.
The flaw was reported by Alex Thomas of Wordfence (Wordfence Threat Intelligence / Wordfence Argus) during a WordPress 7.1 security assessment. The vulnerability was published on 2026-09-15 (NVD, VulnCheck, Red Hat) with a CVSS v3.1 score of 9.8 (AV:N/AC:L/PR:N/UI:N) and CVSS v4.0 score of 9.3. Ghostscript 10.08.0 (released 2026-09-08) contains the fix. The upstream patch (commit 0a8bf88e, authored by Ken Sharp) touches only base/sjpx_openjpeg.c: it rejects unsupported bit depths (only 1, 2, 4, 8 and 16 are accepted), corrects the inner sampling loop to count samples rather than bytes, and adds a bounds check before reading component data so reads cannot run past the image width. Wordfence's public write-up and the GBHackers report followed on 2026-10-13.
The demonstrated attack chain runs through WordPress document handling: a malicious PDF with an embedded JPEG 2000 image is uploaded to the Media Library, WordPress calls Imagick to generate a preview, ImageMagick invokes Ghostscript to render the first page, the overflow triggers during image processing, and the resulting memory corruption yields code execution. Any service that accepts PDFs from untrusted parties and renders them with Ghostscript is relevant: upload forms, document portals, invoice-processing systems, print services, mail gateways, preview generators and file-conversion APIs. Wordfence reported a functional RCE on a purpose-built WordPress deployment, but also noted that its proof-of-concept exploits were build-specific: files developed for one Ghostscript environment did not work unchanged across ten Linux package environments. This reduces universal reliability, although attackers can adapt payloads for common hosting environments.
The sources do not report in-the-wild exploitation, attributed threat actors, or CISA KEV listing, and no network or file IOCs have been published. Separately, WordPress 7.0.4 (2026-08-13) fixed the distinct CVE-2026-65640 (CVSS 8.8), in which an Author-level user uploads a PostScript payload disguised as a PNG that ImageMagick passes to Ghostscript; it is a related WordPress/Imagick/Ghostscript attack surface, not the same vulnerability. Distributions have shipped fixes (Debian DSA-6516-1, fixed trixie package 10.05.1~dfsg-1+deb13u3, forky/sid 10.08.0~dfsg-2; Red Hat RHSA-2026:76877 / 74457 / 74464 for EL8/9/10).
MITRE ATT&CK techniques by tactic:
Defense Evasion
T1036.008 Masquerade File Type
Execution
T1059 Command and Scripting Interpreter; T1203 Exploitation for Client Execution; T1204.002 User Execution: Malicious File
Initial Access
T1190 Exploit Public-Facing Application
Resource Development
Remediation
Patches
- Ghostscript 10.08.0 (upstream fix commit 0a8bf88e39db07b0751a58d6ec1cf992073e4dc1)
- Debian DSA-6516-1 (trixie 10.05.1~dfsg-1+deb13u3; forky/sid 10.08.0~dfsg-2)
- Red Hat RHSA-2026:76877 (EL8), RHSA-2026:74457 (EL9), RHSA-2026:74464 (EL10)
Immediate actions
- Upgrade Ghostscript to 10.08.0 or later (or the distribution-patched package) on every host that renders untrusted PDFs
- Suspend or quarantine untrusted PDF uploads until patched
- Disable PDF rendering in the ImageMagick security policy (policy.xml) where PDF previews are not required
- Inventory systems that call Ghostscript indirectly (WordPress Imagick, ImageMagick, mail gateways, print and conversion services)
Workarounds
- Avoid use of the JPEG 2000 output adapter until the package is updated
- Block ImageMagick PDF/PS/EPS coders via policy.xml
- Disable PDF previews in the Imagick/WordPress image pipeline
Longer-term hardening
- Run document conversion in isolated, minimally-privileged services or sandboxes
- Rebuild containers from updated base images and follow vendor restart guidance
- Restrict who can upload files that reach ImageMagick/Ghostscript and apply the WordPress 7.0.4+ fix for the related CVE-2026-65640
Affected and fixed versions
- Artifex Software — Ghostscript
Vulnerable versions: all versions before 10.08.0
Fixed in: 10.08.0 - Debian — ghostscript package
Vulnerable versions: 10.0.0~dfsg-11+deb12u8 (bookworm); 10.05.1~dfsg-1+deb13u1 (trixie)
Fixed in: 10.05.1~dfsg-1+deb13u3 (trixie security); 10.08.0~dfsg-2 (forky/sid) - Red Hat — ghostscript on Enterprise Linux 8, 9, 10
Vulnerable versions: pre-erratum builds
Fixed in: RHSA-2026:76877; RHSA-2026:74457; RHSA-2026:74464
Timeline
Last updated · 2 updates · revalidated 2× · latest source
- WordPress 7.0.4 fixes the related CVE-2026-65640 (CVSS 8.8), where a PostScript payload disguised as a PNG reaches Ghostscript through Imagick/ImageMagick
- Wordfence researchers report the JPEG 2000 heap overflow to Artifex Software (Ghostscript bug 709666).
- Artifex confirms the vulnerability.
- Ghostscript 10.08.0 released, containing the fix to locked-ioc-1 (commit 0a8bf88e by Ken Sharp)
- Debian Security Tracker records CVE-2026-39919 (DSA-6516-1) listing bookworm 10.0.0~dfsg-11+deb12u8 and trixie 10.05.1~dfsg-1+deb13u1 as vulnerable, with fixes in trixie 10.05.1~dfsg-1+deb13u3 and forky/sid 10.08.0~dfsg-2; the tracker cites fix commit 8ddaa67d and Ghostscript bug 709666
- CVE-2026-39919 published (CVSS v3.1 9.8 / v4.0 9.3); VulnCheck advisory and Red Hat Bugzilla entry created; upstream bug 709666 referenced
- SecurityOnline publishes analysis noting -dSAFER does not mitigate the flaw and that no in-the-wild exploitation is confirmed (EPSS 0.8%).
- Red Hat Bugzilla 2537359 opened to track the flaw for Fedora (rawhide), assigned to Zdenek Dohnal with Medium priority; no fixed version listed at that time
- Red Hat Bugzilla record last modified; RHSA-2026:76877, RHSA-2026:74457 and RHSA-2026:74464 listed for EL8, EL9 and EL10
- Wordfence publishes its research and GBHackers reports the flaw: functional RCE shown on a purpose-built WordPress site via Imagick -> ImageMagick -> Ghostscript; PoCs were build-specific across ten Linux package environments
Update history
- 2026-10-14 — Ghostscript heap buffer overflow RCE via crafted PDF (JPEG 2000) uploads - CVE-2026-39919: What changed No field escalation. Severity (CRITICAL), exploitability (POC_PUBLIC) and CVSS (9.8) are unchanged. The report lists status PATCHED, but the existing ACTIVE status is kept because the change is not an evidenced escalation.
- 2026-10-13 — CVE-2026-39919: Ghostscript JPEG 2000 Heap Buffer Overflow Enables Code Execution via Malicious PDF: What changed No severity, exploitability or status change. Additive context only. New indicators (5) Indicator values are withheld at this access level. New MITRE (1) Added T1204.002 (User Execution: Malicious File).
Sources cited
- NVD - CVE-2026-39919 NVD (NIST) · Advisory · 2026-09-15
- VulnCheck Advisory: Ghostscript < 10.08.0 Heap Buffer Overflow via JPEG 2000 Output Adapter vulncheck.com · Advisory · 2026-09-15
- Debian Security Tracker - CVE-2026-39919 security-tracker.debian.org · Advisory · 2026-09-15
- Ghostscript Bugzilla 709666 bugs.ghostscript.com · Vendor report · 2026-09-15
- Ghostscript/GhostPDL 10.08.0 release GitHub · Vendor report · 2026-09-08
- Red Hat Bugzilla 2533857 - CVE-2026-39919 ghostscript: Heap buffer overflow via JPEG 2000 output adapter bugzilla.redhat.com · Vendor report · 2026-09-15
- Red Hat Bugzilla 2537359 - CVE-2026-39919 ghostscript [fedora-all] bugzilla.redhat.com · Vendor report · 2026-09-21
- ghostpdl fix commit 0a8bf88e (base/sjpx_openjpeg.c) GitHub · Code repository · 2026-09-08
- Critical Ghostscript Vulnerability Lets Malicious PDFs Trigger Remote Code Execution (GBHackers) gbhackers.com · News · 2026-10-13
- WordPress 7.0.4 Patches Remote Code Execution Vulnerability (related CVE-2026-65640, SecurityWeek) SecurityWeek · News · 2026-08-13
Previous and next in vulnerability
Drafted by the Threadlinqs research pipeline from 10 sources; published ; last updated .