☠️
EXFILTRATING
DATA...
01010111 10110010 00101001 11000110 01101100 10011011 00010001 11100101 01000010 10101111
[ <-- BACK_TO_SEARCH ]

CVE-2025-59798

CVE-2025-59798 Stack Buffer Overflow in Artifex
📅 PUBLISHED: 2025-09-22 00:00 UTC 🔄 UPDATED: 2026-09-23 20:35 UTC
[ OFFICIAL PATCH DEPLOYED ↓ ] FIX: LIKELY — 2 independent sources confirm fix
[ DEFENSE PATCH ↓ ]
💣 PoC: None
👁️
Proof of Concept - Indicates if functional exploit code is publicly available, drastically increasing the risk of immediate attacks.
🎯 EPSS: 0.20%
👁️
0.20% probability
5.0× above the median CVE
Tier: ELEVATED
30-day exploitation window · FIRST.org · updated daily
Country: United States License: Commercial
Patch available — upgrade to latest release
CVSS SEVERITY SCALE
9.0–10.0 CRITICAL
7.0–8.9 HIGH
4.0–6.9 MEDIUM
0.1–3.9 LOW
0.0 NONE
4.3
THREAT LEVEL
■ tracking this CVE ✓ independent patch confirmation ⧗ same-origin mirror (GHSA) ⚠ active exploitation verification policy →

Executive Summary

CVE-2025-59798 is a stack-based buffer overflow vulnerability in Artifex Ghostscript through version 10.05.1. The flaw resides in the pdf_write_cmap function within devices/vector/gdevpdtw.c. An attacker can trigger this vulnerability by providing a specially crafted PDF file that, when processed by Ghostscript, causes a stack-based buffer overflow. This can lead to a denial of service (DoS) condition, potentially crashing the application. The CVSS score is 4.3 (Medium), with a local attack vector and low complexity. No public proof-of-concept (PoC) or exploit code is currently available, and the patch status remains unknown.

⚡ AUTOMATE YOUR CVE INTELLIGENCE

This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.

›Patch confidence — UNVERIFIED to CONFIRMED, cross-referenced NVD + RHSA + Debian
›Exploit & PoC — poc_status, poc_url, has_exploit. Not in NVD.
›Shodan dorks — ready-made queries to find exposed vulnerable systems
›Detection rules — YARA · Wazuh · Elastic (all plans) · Sigma (Pro)
›pending_fields — know exactly which of 7 fields NVD hasn't processed yet
›Free backfill — data incomplete when you paid? Re-check within 30 days = 0 credits
PAYG €0.08/lookup Standard €19/mo (was €29) · 5k credits Pro €65/mo (was €99) · 20k credits FOUNDING PRICE · LOCKED FOR LIFE · ENDS 31 DEC 2026
[ FROM €19/MO ]
Free sandbox key available
No signup required

CVSS Breakdown & Threat Level

  • CVSS Score: 4.3 (Medium)
  • Attack Vector (AV): Local (L) – The attacker must have local access to the system or trick a user into processing a malicious file.
  • Attack Complexity (AC): Low (L) – No special conditions are required to exploit the vulnerability.
  • Privileges Required (PR): None (N) – No authentication is needed.
  • User Interaction (UI): Required (R) – The victim must open the malicious PDF file.
  • Scope (S): Unchanged (U) – The impact is confined to the vulnerable component.
  • Confidentiality (C): None (N) – No data exposure.
  • Integrity (I): None (N) – No data modification.
  • Availability (A): High (H) – The vulnerability can cause a complete denial of service.

Threat Level: Medium. The vulnerability requires user interaction and local access, limiting its exploitability in remote scenarios. However, it can be used in phishing campaigns to crash Ghostscript instances.

Deep Dive & Mechanics

The vulnerability is a classic stack-based buffer overflow in the pdf_write_cmap function. This function is responsible for writing color map (CMap) data during PDF processing. When parsing a specially crafted PDF, the function copies data into a fixed-size stack buffer without proper bounds checking. If the input data exceeds the buffer size, it overwrites adjacent stack memory, including the return address and other critical data.

Root Cause: The lack of input validation on the size of the CMap data before copying it to a stack buffer.

Attack Vector: An attacker crafts a malicious PDF file with an oversized CMap entry. When Ghostscript processes this file (e.g., via gs -sDEVICE=pdfwrite -o output.pdf malicious.pdf), the overflow occurs.

Impact: Successful exploitation can crash the Ghostscript process (DoS). In some cases, it might be possible to achieve arbitrary code execution, but this is unconfirmed due to stack canaries and ASLR.

Vulnerable vs. Patched Code

The vulnerable code is in devices/vector/gdevpdtw.c in the pdf_write_cmap function. The exact vulnerable snippet is not publicly available, but the issue is a missing bounds check on a memcpy or similar operation.

Vulnerable Code (Conceptual):

void pdf_write_cmap(gx_device_pdf *pdev, const pdf_cmap *cmap) {
    char buffer[256];
    // ... some processing ...
    memcpy(buffer, cmap->data, cmap->size); // No size check
    // ... write buffer ...
}

Patched Code (Expected):

void pdf_write_cmap(gx_device_pdf *pdev, const pdf_cmap *cmap) {
    char buffer[256];
    // ... some processing ...
    if (cmap->size > sizeof(buffer)) {
        // Handle error or use dynamic allocation
        return;
    }
    memcpy(buffer, cmap->data, cmap->size);
    // ... write buffer ...
}

Exploitation & Lab Setup

Red Team

Prerequisites:

  • Ghostscript version <= 10.05.1 installed.
  • A tool to craft malicious PDF files (e.g., Python with pdfminer or manual hex editing).

Steps:

  1. Create a valid PDF with a large CMap entry. This can be done by modifying an existing PDF's CMap stream.
  2. Use a tool like pdf-parser.py to identify the CMap object.
  3. Replace the CMap data with a long string (e.g., 1000 'A' characters).
  4. Run Ghostscript on the malicious PDF:
    gs -sDEVICE=pdfwrite -o output.pdf malicious.pdf
    
  5. Observe the crash (segmentation fault).

Note: No public exploit code is available. This is a conceptual demonstration.

Blue Team

Detection:

  • Monitor for crashes of Ghostscript processes.
  • Use file integrity monitoring to detect modified PDF files.
  • Implement user awareness training to avoid opening suspicious PDFs.

Mitigation:

  • Restrict Ghostscript usage to trusted users.
  • Use sandboxing or containerization for PDF processing.
  • Apply the patch when available.

Indicators of Compromise (IOCs)

  • File Hashes: No specific hashes available.
  • Network: No network indicators.
  • Process: Ghostscript process crash (segfault) with error logs containing "buffer overflow" or "stack smashing".
  • File: Malicious PDF files with abnormally large CMap streams.

Detection Engineering

YARA Rule

rule CVE_2025_59798_Ghostscript_CMap_Overflow {
    meta:
        description = "Detects PDF files with oversized CMap streams indicative of CVE-2025-59798"
        author = "Valters IT"
        date = "2025-04-10"
        reference = "CVE-2025-59798"
    strings:
        $cmap_header = "/CMap" ascii wide nocase
        $stream_start = "stream" ascii wide nocase
        $stream_end = "endstream" ascii wide nocase
    condition:
        $cmap_header and $stream_start and $stream_end and
        #stream_start > 1 and
        (uint32be(0) == 0x25504446) // PDF magic number
}

Sigma Rule

title: Ghostscript CMap Buffer Overflow Detection
id: 8a4b3c2d-1e5f-4a7b-9c8d-0e1f2a3b4c5d
status: experimental
description: Detects crashes or errors related to CVE-2025-59798 in Ghostscript logs
author: Valters IT
date: 2025/04/10
logsource:
    product: linux
    service: syslog
detection:
    selection:
        - "ghostscript.*stack smashing detected"
        - "ghostscript.*buffer overflow"
        - "ghostscript.*segfault"
    condition: selection
falsepositives:
    - Legitimate large CMap files (rare)
level: medium

Suricata Rule

alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2025-59798 Ghostscript CMap Overflow Attempt"; flow:to_server,established; content:"/CMap"; nocase; content:"stream"; distance:0; within:100; pcre:"/stream\s*[^\n]{1000,}/smi"; classtype:attempted-dos; sid:1000001; rev:1;)

Remediation & Mitigation

  1. Patch: Apply the official patch from Artifex when released. Monitor the Ghostscript repository for updates.
  2. Workaround: Disable PDF processing with Ghostscript if not needed. Use alternative tools like libreoffice or poppler.
  3. Mitigation: Run Ghostscript in a sandboxed environment (e.g., Docker, seccomp) to limit the impact of a crash.
  4. User Education: Train users not to open PDFs from untrusted sources.
  5. Monitoring: Implement the detection rules above to identify exploitation attempts.

Valters IT
DevSecOps & Cyber Threat Intelligence

◈ SOURCE Analysis & enrichment: valtersit.com/cve/CVE-2025-59798/ · CVE data: NVD/MITRE (public domain) · © 2026 ValtersIT Hub
>_ SYSTEM_CORE: INTEL_ACTIVE
90% TEAM-CURATED // 10% AUTOMATED INGESTION.
ALL PATCH REFERENCES AND VERSION DATA SOURCED FROM NVD + OSV OFFICIAL REGISTRIES.