Ghostscript Document Conversion Suite Affected by Critical RCE Attack
![32.Lock Code Circular Esm W900](/images/articles/1200x667/32.Lock_Code_Circular-esm-w900.webp)
Recently, open-source security was rocked by the discovery of an alarming Remote Code Execution (RCE) vulnerability within the Ghostscript document conversion toolkit—CVE-2024729510. Ghostscript is the engine behind many other Linux applications, making Ghostscript flaws like this one especially severe and impactful.
This particular vulnerability can compromise countless Linux systems worldwide. To help you understand and protect against this threat, I'll walk you through how this flaw works, its impact, and practical strategies for mitigating your risk.
What Is CVE-2024-29510?
CVE-2024-29510 is an RCE vulnerability that affects all versions of Ghostscript up to 10.03.0. Ghostscript is a crucial part of modern computing - rendering files for LibreOffice, GIMP, Inkscape, and Scribus while powering printing services via CUPS.
Ghostscript software contains a flaw that allows an attacker, using specially crafted Postscript files, to bypass safety checks provided by its dSAFER sandbox, a safety measure designed to stop unsafe operations when converting documents. Although enabled by default to prevent security breaches, attackers can alter strings related to uni print device arguments after the sandbox has started, execute commands without permission, and perform file I/O operations without security monitoring.
What Is the Impact of This RCE Bug?
Exploiting this flaw could allow attackers to execute arbitrary commands, access sensitive files, and potentially gain control of affected systems. As a result, the efficacy of Ghostscript as a security measure is severely undermined, raising severe concerns for web applications or services using Ghostscript in document conversion or preview applications or previews indirectly or directly.
Can you imagine converting your Postscript documents into PDFs and getting hacked? Attackers are exploiting this bug in the wild by masking malicious Postscript files as harmless-appearing JPGs and passing them along to be processed by Ghostscript's vulnerable component. This allows attackers to gain shell access and subsequently compromise your entire system.
You can check if your systems are vulnerable to this flaw by running this Postscript file with the command:
ghostscript -q -dNODISPLAY -dBATCH CVE-2024-29510_testkit.ps
Brief History of Ghostscript RCE Vulnerabilities
Ghostscript has been vulnerable to Remote Code Execution attacks in the past. CVE-2023-36664, for instance, was identified and patched, also concerning handling maliciously crafted files. Although efforts were undertaken to eliminate security holes posed by these RCE flaws, CVE-2024-29510 indicates the continuing struggle to ensure robust protection measures remain in place.
Practical Mitigation Measures for Linux Admins
To combat the imminent risk presented by CVE-2024-29510, system administrators and users alike should immediately take various proactive and reactive steps.
Ghostscript released an update, version 10.03.1, that resolves CVE-2024-29510 and must be applied as soon as possible to mitigate risk. Depending on your distribution, additional patched versions may also be made available and must be swiftly applied as quickly as possible. Debian, Fedora, and Ubuntu have released security patch updates to mitigate this flaw.
- Patch Application: If upgrading is not feasible due to compatibility or other considerations, apply any available patches from your Linux distribution or software vendor to close any existing security gaps.
- Vulnerability Scanning: Scan your systems to identify whether they are susceptible to the CVE-2024-29510 vulnerability. This step is essential to understanding your exposure.
- Isolation of Services: Where possible, isolate services reliant upon Ghostscript from external networks and non-essential internal systems to limit its spread in an attack scenario.
- Usage Audit: Conduct an audit to identify where Ghostscript is utilized within your organization and evaluate if its presence is necessary in each context or if other options should be explored if its associated risk proves too great.
- Implement Regular Monitoring and Logging: For applications using Ghostscript, regular monitoring and logging practices should be used to detect abnormal behaviors that might indicate exploitation attempts.
- Incident Response: Craft an incident response plan specific to any possible Ghostscript-related breaches, as quick containment and remediation efforts can help lessen the impact of successful exploit attempts.
- Security Awareness: Inform end-users about the risks of opening documents from untrustworthy sources and provide them with guidelines on recognizing any possible phishing attempts or malware-infected files.
Ghostscript released an update, version 10.03.1, that resolves CVE-2024-29510 and must be applied as soon as possible to mitigate risk. Depending on your distribution, additional patched versions may also be made available and must be swiftly applied as quickly as possible.
Our Final Thoughts on Addressing This Ghostscript RCE Flaw
The discovery of CVE-2024-29510 in Ghostscript underscores the ongoing challenge of software security and the necessity of heightened vigilance. While immediate responses include patching affected systems, long-term solutions include regular security audits, rapid patch management, and building a culture of safety within all operational practices. Taking these proactive steps will allow administrators to safeguard their infrastructure against future security threats such as this latest Ghostscript vulnerability as well.