Heap-use-after-free vulnerability in ghostscript
Summary
OSV-2021-237: Heap-use-after-free in sampled_data_sample. Affects ghostscript across 2 version ranges.
< 0bd6877f480a84657696a80adc13f9c5485dd996
>= 45e765e59a45b46dcb05e8c729689a7c0574a48c, < 7861fcad13c497728189feafb41cd57b5b50ea25
Fixed in 7861fcad13c497728189feafb41cd57b5b50ea25. 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 'sampled_data_sample' function within Ghostscript. This function is responsible for processing sampled data, and the vulnerability allows for a heap-use-after-free condition to occur.
Vulnerability Detail
The vulnerability arises due to a heap-use-after-free WRITE 4 error. When the 'sampled_data_sample' function is called, it can lead to a crash state, specifically in the 'sampled_data_continue' and 'interp' functions. This vulnerability can be exploited by an attacker to execute arbitrary code or cause a denial-of-service condition. The severity of this vulnerability is classified as HIGH.
How To Fix
Minimum fixed version
7861fcad13c497728189feafb41cd57b5b50ea25
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 disable the functionality related to the 'sampled_data_sample' function. This can be achieved by modifying the Ghostscript configuration or removing the affected code segment. However, it is strongly advised to update to the latest version as soon as possible.
Conclusion
In conclusion, the 'sampled_data_sample' function in Ghostscript is vulnerable to a heap-use-after-free condition. This can be mitigated by updating to the latest version of Ghostscript or applying a 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.
This vulnerability can allow an attacker to execute arbitrary code or cause a denial-of-service condition.
To fix this vulnerability, update Ghostscript to a version that includes the fix (9.54.0 or later).
A possible workaround is to disable the functionality related to the 'sampled_data_sample' function or remove the affected code segment. However, updating to the latest version is strongly recommended.
The severity of this vulnerability is classified as HIGH.
References
Related vulnerabilities
Recent vulnerabilities recorded for ghostscript.