Heap-use-after-free vulnerability in ghostscript

ghostscript Updated 02 Oct 2025

Summary

02/05/2021
HIGH
Yes i
High
Not published

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 ↓

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

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 →

Share this vulnerability

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.

Related vulnerabilities

Recent vulnerabilities recorded for ghostscript.

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 →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback