Heap-buffer-overflow in gs_type2_interpret in ghostscript
Summary
OSV-2022-751: Heap-buffer-overflow in gs_type2_interpret. Affects ghostscript across 3 version ranges.
< 04b799c66a8993af13c4b9b5fafb3dcfa44a16c5
>= 441c9e3a4ca08fa7f7c00063af33196b0d88ebaf, < 36544f71d8742ba213e6ce003e52a81db3a89ba9
< a6ed2d417205ddf4194a2385402a5c97fe991013
Fixed in 36544f71d8742ba213e6ce003e52a81db3a89ba9. 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-751, is a heap-buffer-overflow issue that affects the gs_type2_interpret function in Ghostscript. This function is responsible for interpreting Type 2 fonts, and the vulnerability allows for a heap buffer overflow during the reading of glyph outlines. This vulnerability can potentially be exploited by an attacker to execute arbitrary code or cause a denial-of-service condition.
Vulnerability Detail
The heap-buffer-overflow vulnerability in gs_type2_interpret arises due to a lack of proper input validation and boundary checks. When processing Type 2 fonts, the function fails to adequately verify the size of the buffer used for glyph outlines, leading to a buffer overflow. This can result in the corruption of adjacent memory regions, potentially allowing an attacker to execute arbitrary code or crash the application. The vulnerability was discovered through an OSS-Fuzz report and has been assigned a medium severity level.
How To Fix
Minimum fixed version
36544f71d8742ba213e6ce003e52a81db3a89ba9
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 the Ghostscript package is not immediately feasible, a possible workaround is to disable the processing of Type 2 fonts. This can be achieved by modifying the Ghostscript configuration file to exclude Type 2 fonts from the list of supported font formats. Here is an example of how to modify the configuration file:
- Open the Ghostscript configuration file (usually located at /etc/ghostscript/ghostscript.conf).
- Locate the section that defines the supported font formats.
- Remove 'Type2' from the list of supported formats.
- Save the changes and restart the Ghostscript service.
Please note that this workaround may impact the rendering of certain documents that rely on Type 2 fonts.
Conclusion
In conclusion, the heap-buffer-overflow vulnerability in gs_type2_interpret in Ghostscript poses a potential security risk due to the lack of proper input validation. It is crucial to update the Ghostscript package to a fixed version or apply the provided workaround to mitigate the vulnerability. For further assistance or support in addressing this vulnerability, 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 allows for a heap buffer overflow, which can potentially be exploited by an attacker to execute arbitrary code or cause a denial-of-service condition.
This vulnerability was identified through an OSS-Fuzz report, which is a continuous fuzzing service provided by Google.
The vulnerability has been assigned a medium severity level.
Yes, updating the Ghostscript package to a fixed version will mitigate the risk of exploitation.
References
Related vulnerabilities
Recent vulnerabilities recorded for ghostscript.