Heap-use-after-free vulnerability in ghostscript
Summary
OSV-2022-507: Heap-use-after-free in psi_device_ref_finalize. Affects ghostscript versions >= dd15cd3cd5495800de5ca5c8a152147b485e124f, < b609c25f7f881bea4b10c8e1b9b950b635437320. Fixed in b609c25f7f881bea4b10c8e1b9b950b635437320. 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 is a heap-use-after-free issue, which occurs when a program attempts to access memory that has already been freed. This vulnerability was discovered through the OSS-Fuzz project.
Vulnerability Detail
The heap-use-after-free vulnerability in ghostscript can lead to a crash or potentially be exploited by an attacker to execute arbitrary code. The specific crash state involves the psi_device_ref_finalize function, which is called during garbage collection. The vulnerability was introduced in commit dd15cd3cd5495800de5ca5c8a152147b485e124f and fixed in commit b609c25f7f881bea4b10c8e1b9b950b635437320.
How To Fix
Minimum fixed version
b609c25f7f881bea4b10c8e1b9b950b635437320
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 possible, a possible workaround is to avoid using the specific functionality or feature that triggers the heap-use-after-free vulnerability. This may involve modifying the code or configuration to disable or replace the affected functionality.
Conclusion
The heap-use-after-free vulnerability in ghostscript can have serious consequences, including crashes and potential code execution by attackers. It is crucial to update ghostscript to a version that includes the fix or apply a workaround to mitigate the risk. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for ghostscript →
FAQ
A heap-use-after-free vulnerability occurs when a program attempts to access memory that has already been freed. This can lead to crashes or potentially be exploited by attackers to execute arbitrary code.
This vulnerability was discovered through the OSS-Fuzz project, which performs continuous fuzz testing on open-source software to uncover potential vulnerabilities.
The impact of this vulnerability can vary depending on the context in which ghostscript is used. It can lead to crashes, denial of service, or potentially allow attackers to execute arbitrary code.
Yes, the vulnerability has been fixed in commit b609c25f7f881bea4b10c8e1b9b950b635437320. It is recommended to update ghostscript to a version that includes this fix.
If updating ghostscript is not immediately possible, a possible workaround is to avoid using the specific functionality or feature that triggers the vulnerability. This may involve modifying the code or configuration.
References
Related vulnerabilities
Recent vulnerabilities recorded for ghostscript.