Heap-buffer-overflow in ghostscript: s_hex_process
Summary
OSV-2021-1752: Heap-buffer-overflow in s_hex_process. Affects ghostscript versions >= 2be8b436910cfc8b013a13df000c3c854cf3c5c5, < 067d47b5efa3631ac58a62916136ad21cd9017df. Fixed in 067d47b5efa3631ac58a62916136ad21cd9017df. 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 the PDF file format. It is widely used for rendering and converting documents. The vulnerability in question affects the s_hex_process function within Ghostscript. This function is responsible for processing hexadecimal data. The vulnerability allows for a heap-buffer-overflow, which can lead to a crash or potentially be exploited for arbitrary code execution.
Vulnerability Detail
The vulnerability arises due to a heap-buffer-overflow in the s_hex_process function of Ghostscript. This can be triggered when processing hexadecimal data, leading to a read of one byte beyond the allocated buffer. An attacker could potentially craft a malicious document or input that triggers this vulnerability, causing a crash or enabling the execution of arbitrary code. The impact of this vulnerability can range from denial of service to remote code execution, depending on how it is exploited.
How To Fix
Minimum fixed version
067d47b5efa3631ac58a62916136ad21cd9017df
This is the first release that contains the fix.
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If updating Ghostscript is not immediately feasible, a possible workaround is to avoid processing untrusted or potentially malicious documents or input with Ghostscript. By limiting the exposure to untrusted data, the risk of exploitation can be mitigated.
Conclusion
In conclusion, the vulnerability in Ghostscript's s_hex_process function poses a risk of heap-buffer-overflow, potentially leading to crashes or arbitrary code execution. It is crucial to update Ghostscript to a version that includes the fix or apply the recommended workaround. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for ghostscript →
FAQ
Ghostscript is an open-source interpreter for the PostScript language and the PDF file format. It is commonly used for rendering and converting documents.
The impact of this vulnerability can range from denial of service to remote code execution, depending on how it is exploited.
To fix this vulnerability, it is recommended to update Ghostscript to a version that includes the fix. The fix for this specific vulnerability was implemented in commit 067d47b5efa3631ac58a62916136ad21cd9017df.
If updating Ghostscript is not immediately feasible, a possible workaround is to avoid processing untrusted or potentially malicious documents or input with Ghostscript.
You can find more information about this vulnerability in the OSS-Fuzz report: [link to the report]
References
Related vulnerabilities
Recent vulnerabilities recorded for ghostscript.