CVE-2019-25059
📋 TL;DR
Artifex Ghostscript through version 9.26 contains a vulnerability in its .completefont handling that could allow arbitrary code execution. This affects systems using Ghostscript for PDF/PostScript processing, particularly web applications that process user-uploaded files. The vulnerability exists due to an incomplete fix for CVE-2019-3839.
💻 Affected Systems
- Artifex Ghostscript
📦 What is this software?
Ghostscript by Artifex
⚠️ Risk & Real-World Impact
Worst Case
Remote code execution with the privileges of the Ghostscript process, potentially leading to complete system compromise.
Likely Case
Denial of service or limited code execution in sandboxed environments.
If Mitigated
No impact if proper input validation and sandboxing are implemented.
🎯 Exploit Status
Exploitation requires processing a malicious PDF/PostScript file. No public exploit code is known.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 9.27 and later
Vendor Advisory: http://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=430e219ea17a2650577d70021399c4ead05869e0
Restart Required: Yes
Instructions:
1. Update Ghostscript to version 9.27 or later. 2. For Linux: Use package manager (apt-get upgrade ghostscript, yum update ghostscript). 3. For Windows: Download latest installer from Artifex website. 4. Restart services using Ghostscript.
🔧 Temporary Workarounds
Disable PS/PDF processing
allTemporarily disable Ghostscript processing of untrusted files
# Configure applications to reject PDF/PS files
# Use alternative PDF processors
Sandbox Ghostscript
linuxRun Ghostscript in a container or with reduced privileges
docker run --security-opt no-new-privileges ghostscript
chroot /safe/path gs
🧯 If You Can't Patch
- Implement strict input validation to reject suspicious PDF/PostScript files
- Isolate Ghostscript processes using containerization or virtualization
🔍 How to Verify
Check if Vulnerable:
Check Ghostscript version: gs --version. If version is 9.26 or earlier, system is vulnerable.
Check Version:
gs --version
Verify Fix Applied:
After update, verify version is 9.27 or later: gs --version
📡 Detection & Monitoring
Log Indicators:
- Ghostscript crashes
- Unusual process spawning from gs process
- High memory usage by Ghostscript
Network Indicators:
- Unexpected outbound connections from Ghostscript process
SIEM Query:
process_name:gs AND (event_type:crash OR parent_process:unusual)
🔗 References
- http://git.ghostscript.com/?p=ghostpdl.git%3Ba=commit%3Bh=430e219ea17a2650577d70021399c4ead05869e0
- https://lists.debian.org/debian-lts-announce/2022/05/msg00000.html
- http://git.ghostscript.com/?p=ghostpdl.git%3Ba=commit%3Bh=430e219ea17a2650577d70021399c4ead05869e0
- https://lists.debian.org/debian-lts-announce/2022/05/msg00000.html