Heap-buffer-overflow in sampled_data_finish in ghostscript
Summary
OSV-2021-803: Heap-buffer-overflow in sampled_data_finish. Affects ghostscript across 2 version ranges.
< 9d6e533f6486fe3fd0a6e29b23d1811361adf904
>= 45e765e59a45b46dcb05e8c729689a7c0574a48c, < 2a3129365d3bc0d4a41f107ef175920d1505d1f7
Fixed in 2a3129365d3bc0d4a41f107ef175920d1505d1f7. 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 for PDF. It is widely used for rendering and converting documents. The vulnerability in question, identified as OSV-2021-803, is a heap-buffer-overflow issue that affects the sampled_data_finish function in Ghostscript. This function is responsible for finalizing sampled data processing. The vulnerability can potentially lead to a crash or enable an attacker to execute arbitrary code.
Vulnerability Detail
The heap-buffer-overflow vulnerability in sampled_data_finish arises from a WRITE operation that exceeds the bounds of the allocated buffer by 16 bytes. This issue was reported through the OSS-Fuzz project, and the crash state indicates that the vulnerability can be triggered during the execution of sampled_data_finish, sampled_data_continue, and interp functions. The severity of this vulnerability is classified as HIGH. The vulnerability was introduced in the codebase between the commits f209fb3a0f50cd0a9974d8627a4ac7f358f60c8a and 470897e484fb0bfaa8553e0ccd5b9db91eda008b. The fix for this vulnerability was implemented in the commits 25b8457be76ba09c2380e5058ca4878e1a7f5ee8 to 9d6e533f6486fe3fd0a6e29b23d1811361adf904.
How To Fix
Minimum fixed version
2a3129365d3bc0d4a41f107ef175920d1505d1f7
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. Additionally, restricting access to the affected functionality or implementing appropriate access controls can help reduce the attack surface.
Conclusion
In conclusion, the heap-buffer-overflow vulnerability in sampled_data_finish in Ghostscript can have serious security implications. It is crucial to update to a fixed version of the package to mitigate the risk. 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 for PDF. It is commonly used for rendering and converting documents.
The heap-buffer-overflow vulnerability in sampled_data_finish can lead to a crash or enable an attacker to execute arbitrary code.
This vulnerability was reported through the OSS-Fuzz project, which focuses on fuzzing open-source software to uncover potential security issues.
The severity of this vulnerability is classified as HIGH.
To fix this vulnerability, it is recommended to update the Ghostscript package to a version that includes the fix. Details on the specific commits can be found in the provided vulnerability details.
References
Related vulnerabilities
Recent vulnerabilities recorded for ghostscript.