Heap-buffer-overflow in ghostscript: pdfi_repair_file
Summary
OSV-2021-1682: Heap-buffer-overflow in pdfi_repair_file. Affects ghostscript versions >= 75fbddf52051987287e62d13c659eb73ba16982f, < 1ae55674f6d68eb6215d7d0f82610f636d81ad3d. Fixed in 1ae55674f6d68eb6215d7d0f82610f636d81ad3d. 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, identified as OSV-2021-1682, is a heap-buffer-overflow issue in the pdfi_repair_file function of Ghostscript. This function is responsible for repairing PDF files by reading and processing their cross-reference tables. The vulnerability can be triggered when parsing a specially crafted PDF file, leading to a heap-buffer-overflow write of 4 bytes.
Vulnerability Detail
The vulnerability originates from a heap-buffer-overflow write of 4 bytes in the pdfi_repair_file function. When processing a PDF file, the function pdfi_read_xref_stream_dict is called, which in turn calls pdfi_read_xref. This chain of function calls can be exploited by an attacker by providing a maliciously crafted PDF file. The consequences of this vulnerability can range from a denial-of-service condition to potential remote code execution, depending on how the attacker leverages the heap-buffer-overflow. The vulnerability has been assigned a severity rating of HIGH.
How To Fix
Minimum fixed version
1ae55674f6d68eb6215d7d0f82610f636d81ad3d
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
There is no known workaround for this vulnerability. It is crucial to apply the fix provided by updating Ghostscript to a patched version.
Conclusion
In conclusion, the vulnerability identified as OSV-2021-1682 in Ghostscript's pdfi_repair_file function is a heap-buffer-overflow issue that can lead to various security risks. It is crucial for users to update their installations of Ghostscript to a patched version that includes the fix for this vulnerability. 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.
The impact of this vulnerability can range from a denial-of-service condition to potential remote code execution, depending on how the attacker leverages the heap-buffer-overflow.
To fix this vulnerability, update your installation of Ghostscript to a patched version that includes the fix for this issue.
No, there is no known workaround for this vulnerability. It is crucial to apply the fix provided by updating Ghostscript to a patched version.
You can find more information about this vulnerability in the OSS-Fuzz report linked in the details section of this report.
References
Related vulnerabilities
Recent vulnerabilities recorded for ghostscript.