CVE-2024-46956

7.8 HIGH

📋 TL;DR

This vulnerability in Ghostscript allows out-of-bounds memory access in the filenameforall function, which could lead to arbitrary code execution. It affects systems running Ghostscript before version 10.04.0, particularly those processing untrusted PostScript or PDF files.

💻 Affected Systems

Products:
  • Artifex Ghostscript
Versions: All versions before 10.04.0
Operating Systems: Linux, Windows, macOS, Unix-like systems
Default Config Vulnerable: ⚠️ Yes
Notes: Vulnerability triggers when processing files with specific malformed filenames; default installations are vulnerable.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution with the privileges of the Ghostscript process, potentially leading to full system compromise.

🟠

Likely Case

Application crash or denial of service; code execution is possible but requires specific memory layout conditions.

🟢

If Mitigated

Limited impact if Ghostscript runs in sandboxed environments or with reduced privileges.

🌐 Internet-Facing: MEDIUM - Exploitation requires processing malicious files, which could occur via web applications or file upload services.
🏢 Internal Only: MEDIUM - Internal users could exploit via malicious documents; risk depends on document processing workflows.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires crafting a malicious file; no public exploit code is known as of the advisory dates.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 10.04.0

Vendor Advisory: https://github.com/ArtifexSoftware/ghostpdl/blob/master/doc/News.html

Restart Required: No

Instructions:

1. Download Ghostscript 10.04.0 or later from the official website. 2. Compile and install according to system instructions. 3. Verify the update with 'gs --version'.

🔧 Temporary Workarounds

Disable Ghostscript in vulnerable services

linux

Remove or disable Ghostscript from applications that process untrusted files, such as image converters or document viewers.

sudo apt remove ghostscript
sudo yum remove ghostscript

Run Ghostscript in sandboxed mode

all

Use the -dSAFER flag to restrict file system access and reduce exploit impact.

gs -dSAFER -sDEVICE=... input.ps

🧯 If You Can't Patch

  • Restrict Ghostscript to trusted users and limit file processing to known-safe sources.
  • Monitor system logs for crashes or unusual activity related to Ghostscript processes.

🔍 How to Verify

Check if Vulnerable:

Run 'gs --version' and check if the version is below 10.04.0.

Check Version:

gs --version

Verify Fix Applied:

After updating, run 'gs --version' to confirm version 10.04.0 or higher is installed.

📡 Detection & Monitoring

Log Indicators:

  • Segmentation faults or crashes in Ghostscript processes
  • Error messages related to 'filenameforall' or 'zfile.c'

Network Indicators:

  • Unusual file uploads to services using Ghostscript
  • Increased network traffic from document processing systems

SIEM Query:

process_name:"gs" AND (event_type:"crash" OR error_message:"segmentation fault")

🔗 References

📤 Share & Export