Heap-buffer-overflow in ghostscript: bytes_copy_rectangle_zero_padding
Summary
OSV-2022-1178: Heap-buffer-overflow in bytes_copy_rectangle_zero_padding. Affects ghostscript across 2 version ranges.
>= eb9fc0106d45d1ce81ab2c4ae1a3d6e90a8c0164
>= ee290c1aebaa172c812f21024af2dbf721fa5865, < db34d54064ae35adc78a499c49363a256f5145f6
Fixed in db34d54064ae35adc78a499c49363a256f5145f6. 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-1178, affects the bytes_copy_rectangle_zero_padding function in Ghostscript. This function is responsible for copying rectangular regions of image data, and the vulnerability allows for a heap-buffer-overflow write of 7 bytes.
Vulnerability Detail
The vulnerability arises due to a heap-buffer-overflow write in the bytes_copy_rectangle_zero_padding function. This can be triggered by a maliciously crafted input, leading to potential crashes or arbitrary code execution. The issue was discovered through an OSS-Fuzz report and has been assigned a severity rating of HIGH. The vulnerable code can be found in the Ghostscript repository, specifically in the files affected by the introduced and fixed commits.
How To Fix
Minimum fixed version
db34d54064ae35adc78a499c49363a256f5145f6
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 temporary workaround, users can consider implementing input validation and sanitization measures to mitigate the risk of exploitation. This can involve checking the input size and ensuring it does not exceed the expected bounds before passing it to the vulnerable function.
Conclusion
In conclusion, the heap-buffer-overflow vulnerability in Ghostscript's bytes_copy_rectangle_zero_padding function poses a significant risk to system stability and security. It is crucial to apply the recommended fixes or workarounds to mitigate the potential impact. 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.
This vulnerability can lead to crashes or arbitrary code execution, depending on how it is exploited. It is important to apply the necessary fixes to prevent potential security breaches.
The vulnerability was discovered through an OSS-Fuzz report, which identified a heap-buffer-overflow write in the bytes_copy_rectangle_zero_padding function.
This vulnerability has been assigned a severity rating of HIGH due to its potential impact on system stability and security.
To fix this vulnerability, it is recommended to update Ghostscript to a version that includes the fix commit (db34d54064ae35adc78a499c49363a256f5145f6 or later). Alternatively, users can wait for an official release that includes the fix and update their installations accordingly.
References
Related vulnerabilities
Recent vulnerabilities recorded for ghostscript.