Buffer Overflow Vulnerability in Ghostscript Affects Multiple Alpine Versions
Summary
ALPINE-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 interpreter for the PostScript language and for PDF. It is widely used for processing and rendering documents in various formats. The vulnerability in question affects several versions of Ghostscript packaged in Alpine Linux, specifically versions 3.18 to 3.22. This vulnerability could potentially allow an attacker to exploit the software through crafted DOCX files, leading to unexpected behavior or crashes.
Vulnerability Detail
An issue was discovered in Artifex Ghostscript before version 10.05.0. The vulnerability arises from a text buffer overflow in the DOCXWRITE TXTWRITE device, which can be triggered by sending long characters to the file located at devices/vector/doc_common.c. This flaw could lead to arbitrary code execution or denial of service, posing a significant risk to systems utilizing affected versions of Ghostscript.
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 avoid processing DOCX files with Ghostscript until the package is updated. Additionally, restricting access to the Ghostscript interpreter can mitigate the risk of exploitation.
Conclusion
The buffer overflow vulnerability in Ghostscript poses a significant risk to users of Alpine Linux versions 3.18 to 3.22. It is crucial to update to the patched versions to mitigate potential exploitation. Users are encouraged to monitor their applications for vulnerabilities using tools like Vulert.
See every vulnerability recorded for ghostscript →
FAQ
The vulnerability is a buffer overflow that can be triggered by long characters in DOCX files, potentially leading to arbitrary code execution.
Affected versions include Ghostscript before 10.05.0 across Alpine versions 3.18 to 3.22.
You can use Vulert to monitor and alert for open-source vulnerabilities in your software. Visit Vulert Scanner to check your application without requiring access to the code.
If immediate updates are not possible, consider restricting access to the Ghostscript interpreter and avoid processing DOCX files.
Detailed information can be found in the CVE report for ALPINE-CVE-2025-27831, which outlines the specifics of the vulnerability.
References
Related vulnerabilities
Recent vulnerabilities recorded for ghostscript.