Buffer Overflow Vulnerability in Ghostscript DOCXWRITE TXTWRITE Device
Summary
CVE-2025-27831: An issue was discovered in Artifex Ghostscript before 10.05.0. Affects ghostscript versions < 10.05.0. Fixed in 10.05.0. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Ghostscript is an open-source interpreter for the PostScript language and for PDF. It is widely used for processing and rendering documents in various formats. The software is integral to many applications that require document manipulation and rendering. However, it has been found to have a vulnerability that can lead to severe security issues if exploited.
Vulnerability Detail
An issue was discovered in Artifex Ghostscript before version 10.05.0, specifically within the DOCXWRITE TXTWRITE device. The vulnerability arises from a text buffer overflow that occurs when long characters are processed in the devices/vector/doc_common.c file. This can lead to potential arbitrary code execution, allowing attackers to exploit the overflow and execute malicious code on affected systems.
How To Fix
Minimum fixed version
10.05.0
This is the first release that contains the fix.
sudo apk add --upgrade ghostscript
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, users can limit the input size of documents processed by Ghostscript to prevent buffer overflow. However, this is not a permanent solution and updating the software is strongly recommended.
Conclusion
The vulnerability identified in Ghostscript poses significant risks due to the potential for arbitrary code execution through a buffer overflow. Users are strongly advised to update to the latest version to mitigate these risks. Additionally, utilizing tools like Vulert can help in monitoring and managing vulnerabilities effectively.
See every vulnerability recorded for ghostscript →
FAQ
The vulnerability is a buffer overflow that can occur when processing long characters in the DOCXWRITE TXTWRITE device, potentially leading to arbitrary code execution.
You can check your version of Ghostscript by running 'gs --version' in your terminal. If it is below 10.05.0, it is affected by this vulnerability.
If exploited, this vulnerability can allow attackers to execute arbitrary code on the affected system, leading to data breaches or system compromise.
Yes, you can use Vulert, which monitors and alerts for open-source vulnerabilities in your software using just a manifest file like package-lock.json. You can check your application for vulnerabilities without any signup at the Vulert playground.
If an immediate update is not possible, consider implementing input size restrictions as a temporary workaround, but prioritize updating to the patched version as soon as feasible.
References
Related vulnerabilities
Recent vulnerabilities recorded for ghostscript.