CVE-2021-45944
Medium · 5.5CVSS
5.5
EPSS
1.4%
Published
Jan 1, 2022
CISA due date
—
Cloudanix analysis
A bug in the software that turns document files into printable pages can make that software crash when it receives certain unusual files, potentially interrupting printing or document-conversion tasks.
- Exploitation
- Requires User Interaction
- Attacker needs
- User Interaction
- Complexity
- Low
- Impact
- Denial Of Service
- Component
- Library
- Class
- Use After Free
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Use-after-free in sampled_data_sample (called from sampled_data_continue and interp) allows memory corruption during PostScript/PDF interpretation in Ghostscript 9.50-9.53.3, resulting in application crash.
Why it matters to the business
Systems that render or convert documents using Ghostscript may experience sudden failures when handling certain files, disrupting print, conversion, or preview workflows with no data theft risk but possible operational downtime.
How an attack unfolds
An attacker creates a specially crafted PostScript or PDF file that exercises the sampled data path; when the file is opened or processed by an affected Ghostscript instance the use-after-free is triggered, causing the interpreter to crash.
How to fix it
Upgrade Ghostscript to a version newer than 9.53.3 on all affected hosts; rebuild or reinstall any packages that statically link the vulnerable library; test document processing pipelines with the updated binary.
How to confirm the fix worked
Run 'gs --version' and confirm the installed release is newer than 9.53.3; re-process a known-triggering test file and verify the interpreter no longer crashes; scan build artifacts for references to the vulnerable sampled_data functions.
Typical attack path
- Craft malicious PostScript or PDF input that reaches sampled_data_sample via sampled_data_continue
- Deliver the file to the target (email, web download, shared storage)
- Victim or automated process opens the file with Ghostscript 9.50-9.53.3
- Interpreter follows the sampled data execution path and triggers the dangling reference
- Process crashes, producing denial of service
How to detect it
Search application and system logs for Ghostscript segmentation faults or abrupt exits while processing PDF or PostScript files; inspect core dumps or crash reports that reference sampled_data_sample or sampled_data_continue; correlate file-processing timestamps with process termination events.
What your security team should do
- Prioritize patching of any internet-facing or high-volume document-processing servers within 30 days
- Add Ghostscript version checks to configuration-management and vulnerability-scanning policies
- Restrict Ghostscript execution to trusted input sources where possible
- Monitor vendor advisories for downstream packages that embed Ghostscript
The record
Ghostscript GhostPDL 9.50 through 9.53.3 has a use-after-free in sampled_data_sample (called from sampled_data_continue and interp).
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Debian:10 | ghostscript | 0 | 9.27~dfsg-2+deb10u5 |
| Debian:11 | ghostscript | 0 | 9.53.3~dfsg-7+deb11u2 |
| Debian:12 | ghostscript | 0 | 9.54.0~dfsg-5 |
| Debian:13 | ghostscript | 0 | 9.54.0~dfsg-5 |
| Debian:9 | ghostscript | 0 | 9.26a~dfsg-0+deb9u8 |
| Mageia:8 | ghostscript | 0 | 9.53.3-2.2.mga8 |
| SUSE:Enterprise Storage 6 | ghostscript | 0 | 9.52-161.1 |
| SUSE:Enterprise Storage 7 | ghostscript | 0 | 9.52-161.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP1-LTSS | ghostscript | 0 | 9.52-161.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSS | ghostscript | 0 | 9.52-161.1 |
| SUSE:Linux Enterprise Module for Basesystem 15 SP3 | ghostscript | 0 | 9.52-161.1 |
| SUSE:Linux Enterprise Real Time 15 SP2 | ghostscript | 0 | 9.52-161.1 |
| SUSE:Linux Enterprise Server 12 SP5 | ghostscript | 0 | 9.52-23.48.1 |
| SUSE:Linux Enterprise Server 15 SP1-LTSS | ghostscript | 0 | 9.52-161.1 |
| SUSE:Linux Enterprise Server 15 SP2-LTSS | ghostscript | 0 | 9.52-161.1 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP5 | ghostscript | 0 | 9.52-23.48.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP1 | ghostscript | 0 | 9.52-161.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP2 | ghostscript | 0 | 9.52-161.1 |
| SUSE:Linux Enterprise Software Development Kit 12 SP5 | ghostscript | 0 | 9.52-23.48.1 |
| SUSE:Package Hub 12 SP1 | htmldoc | 0 | 1.8.28-9.1 |
| Ubuntu:18.04:LTS | ghostscript | 0 | 9.26~dfsg+0-0ubuntu0.18.04.15 |
| Ubuntu:20.04:LTS | ghostscript | 0 | 9.50~dfsg-5ubuntu4.5 |
| Ubuntu:Pro:16.04:LTS | ghostscript | 0 | 9.26~dfsg+0-0ubuntu0.16.04.14+esm1 |
| openSUSE:Leap 15.3 | ghostscript | 0 | 9.52-161.1 |
| openSUSE:Tumbleweed | ghostscript | 0 | 9.54.0-3.1 |
Related vulnerabilities
- CVE-2023-38559 A buffer overflow flaw was found in base/gdevdevn.c:1973 in devn_pcx_write_rle() in… Also affects ghostscript
- CVE-2016-7976 The PS Interpreter in Ghostscript 9.18 and 9.20 allows remote attackers to execute… Also affects ghostscript
- CVE-2013-5653 The getenv and filenameforall functions in Ghostscript 9.10 ignore the "-dSAFER"… Also affects ghostscript
- CVE-2009-3560 The big2_toUtf8 function in lib/xmltok.c in libexpat in Expat 2.0.1, as used in the… Also affects ghostscript
- CVE-2009-3720 The updatePosition function in lib/xmltok_impl.c in libexpat in Expat 2.0.1, as used in… Also affects ghostscript
- CVE-2008-0411 Stack-based buffer overflow in the zseticcspace function in zicc.c in Ghostscript 8.61… Also affects ghostscript
- CVE-2024-46956 An issue was discovered in psi/zfile.c in Artifex Ghostscript before 10.04.0. Also affects ghostscript
- CVE-2024-46955 An issue was discovered in psi/zcolor.c in Artifex Ghostscript before 10.04.0. Also affects ghostscript