Heap-use-after-free vulnerability in ghostscript
Summary
OSV-2021-717: Heap-use-after-free in real_param. Affects ghostscript across 2 version ranges.
>= bbdfaa56b00f2ba556476f0265e65e4ad370f641, < ad4d12f6d848ebfde2485fd6c806901b7497a1c2
>= e63504054baea4275af88e95418b5282c4394685, < fe8965b8a179c083060b66a7db13cad171ff470b
Fixed in fe8965b8a179c083060b66a7db13cad171ff470b. 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 PDF files. This vulnerability affects the 'real_param' function in Ghostscript, which is responsible for handling certain parameters. The vulnerability allows an attacker to exploit a heap-use-after-free issue, potentially leading to arbitrary code execution or a denial of service attack.
Vulnerability Detail
The vulnerability occurs due to a use-after-free bug in the 'real_param' function. This bug can be triggered by passing specially crafted parameters to Ghostscript, causing it to access memory that has already been freed. An attacker can exploit this vulnerability to execute arbitrary code or crash the application, potentially leading to a remote code execution or a denial of service attack.
How To Fix
Minimum fixed version
fe8965b8a179c083060b66a7db13cad171ff470b
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 restrict access to Ghostscript and ensure that it is not exposed to untrusted inputs. Additionally, it is recommended to monitor for any suspicious activity or unexpected crashes related to Ghostscript.
Conclusion
The heap-use-after-free vulnerability in Ghostscript can be exploited to execute arbitrary code or crash the application. It is crucial to update Ghostscript to the latest version that includes the fix for this vulnerability. If immediate updating is not possible, restricting access to Ghostscript and monitoring for any suspicious activity can serve as temporary workarounds. 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 PDF files.
A use-after-free vulnerability occurs when a program continues to use a memory address after it has been freed. This can lead to memory corruption and potentially allow an attacker to execute arbitrary code or crash the application.
This vulnerability can be exploited by passing specially crafted parameters to Ghostscript, causing it to access freed memory. An attacker can use this to execute arbitrary code or crash the application.
Yes, this vulnerability has been fixed in versions fe8965b8a179c083060b66a7db13cad171ff470b and later. Users should update their installations to a version that includes the fix.
If updating Ghostscript is not immediately possible, a possible workaround is to restrict access to Ghostscript and ensure that it is not exposed to untrusted inputs. Additionally, it is recommended to monitor for any suspicious activity or unexpected crashes related to Ghostscript.
References
Related vulnerabilities
Recent vulnerabilities recorded for ghostscript.