Stack-buffer-underflow in gs_type2_interpret in ghostscript
Summary
OSV-2022-866: Stack-buffer-underflow in gs_type2_interpret. Affects ghostscript versions >= 441c9e3a4ca08fa7f7c00063af33196b0d88ebaf, < 92b792f6a34d2436772dd141760faf925e139c01. Fixed in 92b792f6a34d2436772dd141760faf925e139c01. 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, identified as OSV-2022-866, affects the gs_type2_interpret function in Ghostscript. This function is responsible for interpreting Type 2 fonts, which are commonly used in PostScript and PDF files. The vulnerability can lead to a stack-buffer-underflow, potentially resulting in a crash or arbitrary code execution.
Vulnerability Detail
The stack-buffer-underflow vulnerability in gs_type2_interpret arises from a flaw in the code logic. When processing a Type 2 font, the function fails to properly validate the size of a buffer before copying data into it. As a result, an attacker can craft a malicious font file that triggers a stack-buffer-underflow, leading to memory corruption and potential code execution. This vulnerability can be exploited remotely by enticing a user to open a specially crafted document or font file. Successful exploitation could allow an attacker to execute arbitrary code with the privileges of the Ghostscript process.
How To Fix
Minimum fixed version
92b792f6a34d2436772dd141760faf925e139c01
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
As a workaround, users can consider disabling the processing of Type 2 fonts in Ghostscript. This can be achieved by modifying the configuration or command-line options to exclude Type 2 fonts from being interpreted. However, this workaround may impact the rendering of certain documents or cause compatibility issues, so it should be carefully evaluated before implementation.
Conclusion
In conclusion, the stack-buffer-underflow vulnerability in gs_type2_interpret in Ghostscript can lead to memory corruption and potential code execution. It is crucial to update Ghostscript to a version that includes the fix and consider implementing the recommended workaround if necessary. 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 vulnerability can lead to a stack-buffer-underflow, potentially resulting in a crash or arbitrary code execution. An attacker could exploit this vulnerability to execute arbitrary code with the privileges of the Ghostscript process.
The vulnerability can be exploited remotely by enticing a user to open a specially crafted document or font file that triggers the stack-buffer-underflow.
Yes, the vulnerability has been fixed in Ghostscript. Users should update their installations to a version that includes the fix.
A workaround is to disable the processing of Type 2 fonts in Ghostscript. However, this may impact document rendering and compatibility.
References
Related vulnerabilities
Recent vulnerabilities recorded for ghostscript.