CVE-2019-14817

7.8 HIGH

📋 TL;DR

This vulnerability in Ghostscript allows specially crafted PostScript files to bypass the -dSAFER security sandbox. Attackers could gain file system access or execute arbitrary commands on affected systems. Anyone using Ghostscript versions before 9.50 to process untrusted PostScript/PDF files is affected.

💻 Affected Systems

Products:
  • Ghostscript
  • Applications embedding Ghostscript (ImageMagick, LibreOffice, etc.)
  • PDF processing tools using Ghostscript
Versions: All versions prior to 9.50
Operating Systems: Linux, Windows, macOS, Unix variants
Default Config Vulnerable: ⚠️ Yes
Notes: Only vulnerable when processing PostScript/PDF files with -dSAFER flag enabled. Many applications enable -dSAFER by default when using Ghostscript.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full system compromise through arbitrary command execution, potentially leading to data theft, ransomware deployment, or complete system takeover.

🟠

Likely Case

File system access allowing reading of sensitive files, planting backdoors, or limited command execution within the Ghostscript process context.

🟢

If Mitigated

No impact if -dSAFER is not used or if Ghostscript is not exposed to untrusted input.

🌐 Internet-Facing: HIGH if Ghostscript processes user-uploaded files via web applications or APIs.
🏢 Internal Only: MEDIUM for internal document processing systems that handle potentially malicious files.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires delivering a malicious PostScript file to a vulnerable Ghostscript instance. Public proof-of-concept code exists.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Ghostscript 9.50 and later

Vendor Advisory: https://access.redhat.com/errata/RHSA-2019:2594

Restart Required: No

Instructions:

1. Update Ghostscript to version 9.50 or later. 2. For Linux: Use package manager (apt-get upgrade ghostscript, yum update ghostscript). 3. For Windows: Download from ghostscript.com. 4. Restart any services using Ghostscript.

🔧 Temporary Workarounds

Disable PostScript processing

all

Configure applications to disable PostScript processing or use alternative PDF processors

Sandbox Ghostscript execution

linux

Run Ghostscript in a container or with minimal privileges

docker run --read-only -v /tmp:/tmp ghostscript
sudo -u nobody gs -dSAFER ...

🧯 If You Can't Patch

  • Implement strict input validation to reject suspicious PostScript files
  • Isolate Ghostscript processes using SELinux/AppArmor or run in dedicated virtual machines

🔍 How to Verify

Check if Vulnerable:

Check Ghostscript version: gs --version. If version is below 9.50, system is vulnerable.

Check Version:

gs --version

Verify Fix Applied:

After update, run gs --version and confirm version is 9.50 or higher.

📡 Detection & Monitoring

Log Indicators:

  • Unusual Ghostscript process execution patterns
  • Large PostScript file processing errors
  • System commands executed from Ghostscript context

Network Indicators:

  • Unexpected outbound connections from document processing servers
  • File uploads to document processing endpoints followed by command execution

SIEM Query:

process_name:"gs" AND (command_line:"*exec*" OR command_line:"*shell*" OR command_line:"*system*")

🔗 References

📤 Share & Export