Stack-buffer-underflow in gs_type2_interpret in ghostscript

ghostscript Updated 02 Oct 2025

Summary

07/10/2022
N/A
Yes i
Unrated
Not published

OSV-2022-1021: Stack-buffer-underflow in gs_type2_interpret. Affects ghostscript versions >= 441c9e3a4ca08fa7f7c00063af33196b0d88ebaf, < b7f934c26b6d139d665ab924167036c74a973360. Fixed in b7f934c26b6d139d665ab924167036c74a973360. 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 documents. The vulnerability in question, identified as OSV-2022-1021, is a stack-buffer-underflow issue that affects the gs_type2_interpret function in Ghostscript. This function is responsible for interpreting Type 2 fonts, which are commonly used in PDF files. The vulnerability can be triggered when processing a specially crafted Type 2 font, leading to a stack-buffer-underflow read of 4 bytes.

Vulnerability Detail

The stack-buffer-underflow vulnerability in gs_type2_interpret can result in the reading of 4 bytes beyond the bounds of the stack buffer. This can potentially lead to memory corruption and arbitrary code execution. An attacker could exploit this vulnerability by crafting a malicious PDF file with a specially crafted Type 2 font and tricking a user into opening it. Successful exploitation of this vulnerability could allow the attacker to execute arbitrary code on the affected system with the privileges of the Ghostscript process.

How To Fix

Minimum fixed version

b7f934c26b6d139d665ab924167036c74a973360

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 workaround, users can consider disabling the processing of Type 2 fonts in Ghostscript. This can be achieved by modifying the Ghostscript configuration file to remove the Type 2 font interpreter. However, this workaround may impact the rendering and processing of certain PDF files that rely on Type 2 fonts.

Conclusion

In conclusion, the stack-buffer-underflow vulnerability in gs_type2_interpret in Ghostscript can be exploited by crafting a malicious PDF file with a specially crafted Type 2 font. This can lead to memory corruption and arbitrary code execution. It is recommended to update Ghostscript to a version that includes the fix for this vulnerability. Alternatively, users can consider disabling the processing of Type 2 fonts as a temporary workaround. 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 documents.

A stack-buffer-underflow vulnerability occurs when a program reads data from a stack buffer beyond its bounds, potentially leading to memory corruption and arbitrary code execution.

This vulnerability can be exploited by crafting a malicious PDF file with a specially crafted Type 2 font and tricking a user into opening it.

Successful exploitation of this vulnerability could allow an attacker to execute arbitrary code on the affected system with the privileges of the Ghostscript process.

Yes, this vulnerability has been fixed in the Ghostscript Git repository in commit b7f934c26b6d139d665ab924167036c74a973360. Users should update their installations to a version that includes this fix.

Related vulnerabilities

Recent vulnerabilities recorded for ghostscript.

How To Fix

Minimum fixed version

b7f934c26b6d139d665ab924167036c74a973360

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