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

CVE-2025-59800

CVE-2025-59800 Heap Buffer Overflow in Artifex
📅 PUBLISHED: 2025-09-22 00:00 UTC 🔄 UPDATED: 2026-09-23 10:16 UTC
[ PATCH UNDER REVIEW ↓ ] Remains UNDER REVIEW until an independent source confirms the 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.18%
👁️
0.18% probability
4.4× above the median CVE
Tier: ELEVATED
30-day exploitation window · FIRST.org · updated daily
Country: United States License: Commercial
VULNERABLE: version not auto-detected — verify your deployed version locally
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-59800 is a heap-based buffer overflow vulnerability in Artifex Ghostscript, affecting versions through 10.05.1. The flaw resides in the ocr_begin_page function within devices/gdevpdfocr.c, where an integer overflow leads to a heap-based buffer overflow in the ocr_line8 function. This vulnerability can be triggered when processing a specially crafted PDF file, potentially allowing an attacker to achieve arbitrary code execution or cause a denial of service. The CVSS score is 4.3 (Medium), and the EPSS probability is 0.0%, indicating low exploitation activity in the wild. No public proof-of-concept or exploit code is currently available.

⚡ 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

Supply Chain & Package Security

This vulnerability is not related to NPM, PyPI, Go, or Ruby packages. It affects the Ghostscript software package, which is commonly distributed through operating system package managers (e.g., apt, yum) and is used as a dependency in various document processing pipelines.

CVSS Breakdown & Threat Level

  • CVSS Score: 4.3 (Medium)
  • Attack Vector: Local (AV:L)
  • Attack Complexity: Low (AC:L)
  • Privileges Required: None (PR:N)
  • User Interaction: Required (UI:R)
  • Scope: Unchanged (S:U)
  • Confidentiality Impact: Low (C:L)
  • Integrity Impact: Low (I:L)
  • Availability Impact: Low (A:L)

The threat level is considered medium due to the requirement for user interaction (opening a malicious file) and the local attack vector. However, successful exploitation could lead to arbitrary code execution within the context of the Ghostscript process.

Deep Dive & Mechanics

The vulnerability is located in the OCR (Optical Character Recognition) functionality of Ghostscript, specifically in the ocr_begin_page function in devices/gdevpdfocr.c. The function processes image data for OCR and uses integer arithmetic to calculate buffer sizes. An integer overflow occurs when the calculated size wraps around to a small value, leading to the allocation of an undersized heap buffer. Subsequently, the ocr_line8 function writes data into this buffer, causing a heap-based buffer overflow.

The vulnerable code path is triggered when Ghostscript processes a PDF file that contains an image with manipulated dimensions or color depth, causing the size calculation to overflow. The overflow can corrupt adjacent heap memory, potentially leading to code execution or a crash.

Vulnerable vs. Patched Code

The vulnerable code in devices/gdevpdfocr.c (version 10.05.1 and earlier) performs an integer multiplication without overflow checking:

// Vulnerable code (simplified)
int size = width * height * bytes_per_pixel;
unsigned char *buffer = (unsigned char *)gs_alloc_bytes(mem, size, "ocr_line8");

A patched version would include overflow checks and use safe arithmetic functions:

// Patched code (hypothetical)
size_t size;
if (gs_mul_overflow(width, height, &size) ||
    gs_mul_overflow(size, bytes_per_pixel, &size)) {
    // Handle overflow error
    return gs_error_rangecheck;
}
unsigned char *buffer = (unsigned char *)gs_alloc_bytes(mem, size, "ocr_line8");

Exploitation & Lab Setup

Red Team

No public exploit code is available. To develop a proof-of-concept, an attacker would need to craft a PDF file with an image that has dimensions causing an integer overflow in the OCR buffer size calculation. The following steps outline a potential approach:

  1. Create a PDF with an embedded image.
  2. Set the image width and height to values such that width * height * bytes_per_pixel overflows to a small number.
  3. Include a large amount of image data that will overflow the undersized buffer.
  4. Use heap spraying techniques to place shellcode at a predictable memory location.

Lab Setup:

  • Install Ghostscript 10.05.1 on a Linux VM.
  • Use a debugger (e.g., GDB) to analyze the crash.
  • Generate a malicious PDF using a scripting language (e.g., Python with reportlab).

Blue Team

Detection:

  • Monitor for crashes or abnormal terminations of Ghostscript processes.
  • Use file scanning to detect PDFs with unusually large image dimensions.
  • Implement behavioral detection rules for heap corruption.

Hunting:

  • Search for PDF files with image dimensions exceeding 65535 pixels in width or height.
  • Look for Ghostscript processes that allocate and then overflow heap buffers.

Indicators of Compromise (IOCs)

  • File Hashes: No known malicious files at this time.
  • Process Anomalies: Ghostscript process crashes with segmentation faults.
  • Network Indicators: None (local vulnerability).
  • Registry/File System: Modified PDF files with manipulated image dimensions.

Detection Engineering

YARA Rule

rule CVE_2025_59800_Ghostscript_OCR_Overflow {
    meta:
        description = "Detects PDF files potentially exploiting CVE-2025-59800"
        author = "Valters IT"
        date = "2025-04-10"
        reference = "CVE-2025-59800"
    strings:
        $pdf_header = "%PDF"
        $image_stream = /\/Subtype\s*\/Image/
        $width = /\/Width\s+\d{5,}/
        $height = /\/Height\s+\d{5,}/
    condition:
        $pdf_header at 0 and $image_stream and $width and $height
}

Sigma Rule

title: Ghostscript OCR Heap Overflow Attempt
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects potential exploitation of CVE-2025-59800 via Ghostscript crash
author: Valters IT
date: 2025-04-10
logsource:
    category: process_creation
    product: linux
detection:
    selection:
        Image: /ghostscript
        CommandLine|contains: 'ocr'
    condition: selection
falsepositives:
    - Legitimate OCR processing of large images
level: medium

Suricata Rule

alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2025-59800 Ghostscript OCR Overflow Attempt"; flow:to_server,established; content:"%PDF"; http_client_body; content:"/Subtype /Image"; http_client_body; pcre:"/\/Width\s+\d{5,}/"; pcre:"/\/Height\s+\d{5,}/"; classtype:attempted-admin; sid:1000001; rev:1;)

Remediation & Mitigation

  1. Patch: Apply the official patch from Artifex when available. Monitor the Ghostscript release page for updates.
  2. Workaround: Disable the OCR device in Ghostscript if not needed:
    gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dNoOCR -sOutputFile=output.pdf input.pdf
    
  3. Mitigation: Use input validation to reject PDFs with image dimensions exceeding reasonable limits (e.g., width > 10000 or height > 10000).
  4. Detection: Implement the YARA, Sigma, and Suricata rules provided above.
  5. User Education: Train users to avoid opening PDFs from untrusted sources.

Valters IT
DevSecOps & Cyber Threat Intelligence

◈ SOURCE Analysis & enrichment: valtersit.com/cve/CVE-2025-59800/ · 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.