CVE-2024-46956
NoneCVSS
—
EPSS
0.4%
Published
Nov 10, 2024
CISA due date
—
Cloudanix analysis
A bug in widely used document-processing software can let attackers take over computers simply by making them open a specially crafted file.
- Exploitation
- Requires User Interaction
- Attacker needs
- User Interaction
- Complexity
- Moderate
- Impact
- Remote Code Execution
- Component
- Application
- Class
- Memory Corruption
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Out-of-bounds data access in the filenameforall operator in psi/zfile.c allows memory corruption that can be leveraged for arbitrary code execution.
Why it matters to the business
Attackers can fully compromise systems that process untrusted PostScript, PDF, or EPS files with Ghostscript, resulting in data theft, ransomware deployment, or persistent access without user interaction.
How an attack unfolds
An attacker crafts a malicious input file containing a filenameforall call with specially chosen parameters that trigger an out-of-bounds access during directory enumeration. The corrupted memory state is then used to redirect control flow and execute attacker-supplied code within the Ghostscript interpreter process.
How to fix it
Upgrade Ghostscript to a build containing commit df8f4966577fff70320be2eb33cb55eb15d05d52 (equivalent to version 10.04.0 or later). Rebuild and redeploy any downstream packages or containers that embed Ghostscript. Where immediate patching is impossible, restrict Ghostscript invocation to trusted input sources only.
How to confirm the fix worked
Confirm the installed Ghostscript binary reports version 10.04.0 or newer, or verify the source tree contains commit df8f4966577fff70320be2eb33cb55eb15d05d52. Re-test with known filenameforall edge-case inputs to ensure the out-of-bounds condition no longer occurs.
Typical attack path
- Deliver a malicious PostScript/PDF/EPS file to a target that invokes Ghostscript (email attachment, web upload, print spooler, document converter).
- Ghostscript parses the file and reaches the filenameforall operator with attacker-controlled parameters.
- Out-of-bounds access occurs during internal file-name enumeration, corrupting memory.
- Attacker payload in the corrupted memory is executed, granting code execution inside the Ghostscript process.
- Further actions such as dropping malware, establishing C2, or lateral movement follow from the compromised host.
How to detect it
Review process execution logs, crash dumps, and application error logs for Ghostscript invocations that terminate abnormally or access unexpected files. Correlate with file-creation events following Ghostscript execution and inspect any newly spawned processes or network connections originating from the interpreter.
What your security team should do
- Immediately update all Ghostscript installations and rebuild dependent packages to the fixed commit.
- Inventory every system or container that invokes Ghostscript for document processing and prioritize patching by exposure level.
- Add Ghostscript version checks to build pipelines and container scanning tools.
- Monitor for new public exploits and raise EPSS-based alerting thresholds once exploit maturity increases.
The record
An issue was discovered in psi/zfile.c in Artifex Ghostscript before 10.04.0. Out-of-bounds data access in filenameforall can lead to arbitrary code execution.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| AlmaLinux:8 | ghostscript | 0 | 9.27-16.el8_10 |
| AlmaLinux:8 | ghostscript-doc | 0 | 9.27-16.el8_10 |
| AlmaLinux:8 | ghostscript-tools-dvipdf | 0 | 9.27-16.el8_10 |
| AlmaLinux:8 | ghostscript-tools-fonts | 0 | 9.27-16.el8_10 |
| AlmaLinux:8 | ghostscript-tools-printing | 0 | 9.27-16.el8_10 |
| AlmaLinux:8 | ghostscript-x11 | 0 | 9.27-16.el8_10 |
| AlmaLinux:8 | libgs | 0 | 9.27-16.el8_10 |
| AlmaLinux:8 | libgs-devel | 0 | 9.27-16.el8_10 |
| AlmaLinux:9 | ghostscript | 0 | 9.54.0-18.el9_6 |
| AlmaLinux:9 | ghostscript-doc | 0 | 9.54.0-18.el9_6 |
| AlmaLinux:9 | ghostscript-tools-dvipdf | 0 | 9.54.0-18.el9_6 |
| AlmaLinux:9 | ghostscript-tools-fonts | 0 | 9.54.0-18.el9_6 |
| AlmaLinux:9 | ghostscript-tools-printing | 0 | 9.54.0-18.el9_6 |
| AlmaLinux:9 | ghostscript-x11 | 0 | 9.54.0-18.el9_6 |
| AlmaLinux:9 | libgs | 0 | 9.54.0-18.el9_6 |
| AlmaLinux:9 | libgs-devel | 0 | 9.54.0-18.el9_6 |
| Alpine:v3.18 | ghostscript | 0 | 10.04.0-r0 |
| Alpine:v3.19 | ghostscript | 0 | 10.04.0-r0 |
| Alpine:v3.20 | ghostscript | 0 | 10.04.0-r0 |
| Alpine:v3.21 | ghostscript | 0 | 10.04.0-r0 |
| Alpine:v3.22 | ghostscript | 0 | 10.04.0-r0 |
| Debian:11 | ghostscript | 0 | No fix |
| Debian:11 | ghostscript | 0 | 9.53.3~dfsg-7+deb11u9 |
| Debian:12 | ghostscript | 0 | No fix |
| Debian:12 | ghostscript | 0 | 10.0.0~dfsg-11+deb12u6 |
| Debian:13 | ghostscript | 0 | 10.04.0~dfsg-1 |
| Debian:14 | ghostscript | 0 | 10.04.0~dfsg-1 |
| Mageia:9 | ghostscript | 0 | 10.04.0-1.mga9 |
| SUSE:Enterprise Storage 7.1 | ghostscript | 0 | 9.52-150000.200.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSS | ghostscript | 0 | 9.52-150000.200.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS | ghostscript | 0 | 9.52-150000.200.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP4-ESPOS | ghostscript | 0 | 9.52-150000.200.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP4-LTSS | ghostscript | 0 | 9.52-150000.200.1 |
| SUSE:Linux Enterprise Module for Basesystem 15 SP5 | ghostscript | 0 | 9.52-150000.200.1 |
| SUSE:Linux Enterprise Module for Basesystem 15 SP6 | ghostscript | 0 | 9.52-150000.200.1 |
| SUSE:Linux Enterprise Server 12 SP5-LTSS | ghostscript | 0 | 9.52-23.86.1 |
| SUSE:Linux Enterprise Server 15 SP2-LTSS | ghostscript | 0 | 9.52-150000.200.1 |
| SUSE:Linux Enterprise Server 15 SP3-LTSS | ghostscript | 0 | 9.52-150000.200.1 |
| SUSE:Linux Enterprise Server 15 SP4-LTSS | ghostscript | 0 | 9.52-150000.200.1 |
| SUSE:Linux Enterprise Server LTSS Extended Security 12 SP5 | ghostscript | 0 | 9.52-23.86.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP2 | ghostscript | 0 | 9.52-150000.200.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP3 | ghostscript | 0 | 9.52-150000.200.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP4 | ghostscript | 0 | 9.52-150000.200.1 |
| SUSE:Manager Proxy 4.3 | ghostscript | 0 | 9.52-150000.200.1 |
| SUSE:Manager Server 4.3 | ghostscript | 0 | 9.52-150000.200.1 |
| Ubuntu:20.04:LTS | ghostscript | 0 | 9.50~dfsg-5ubuntu4.14 |
| Ubuntu:22.04:LTS | ghostscript | 0 | 9.55.0~dfsg1-0ubuntu5.10 |
| Ubuntu:24.04:LTS | ghostscript | 0 | 10.02.1~dfsg1-0ubuntu7.4 |
| Ubuntu:24.10 | ghostscript | 0 | 10.03.1~dfsg1-0ubuntu2.1 |
| Ubuntu:Pro:16.04:LTS | ghostscript | 0 | 9.26~dfsg+0-0ubuntu0.16.04.14+esm8 |
| Ubuntu:Pro:18.04:LTS | ghostscript | 0 | 9.26~dfsg+0-0ubuntu0.18.04.18+esm3 |
| openSUSE:Leap 15.5 | ghostscript | 0 | 9.52-150000.200.1 |
| openSUSE:Leap 15.6 | ghostscript | 0 | 9.52-150000.200.1 |
| openSUSE:Tumbleweed | ghostscript | 0 | 10.04.0-1.1 |
Related vulnerabilities
- CVE-2024-46953 An issue was discovered in base/gsdevice.c in Artifex Ghostscript before 10.04.0. Also affects ghostscript
- CVE-2024-46954 An issue was discovered in decode_utf8 in base/gp_utf8.c in Artifex Ghostscript before… Also affects ghostscript
- CVE-2024-46952 An issue was discovered in pdf/pdf_xref.c in Artifex Ghostscript before 10.04.0. Also affects ghostscript
- CVE-2024-46951 An issue was discovered in psi/zcolor.c in Artifex Ghostscript before 10.04.0. Also affects ghostscript
- CVE-2023-46751 An issue was discovered in the function gdev_prn_open_printer_seekable() in Artifex… Also affects ghostscript
- CVE-2023-38559 A buffer overflow flaw was found in base/gdevdevn.c:1973 in devn_pcx_write_rle() in… Also affects ghostscript
- CVE-2023-36664 Artifex Ghostscript before 10.01.2 mishandles permission validation for pipe devices… Also affects ghostscript
- CVE-2025-27837 An issue was discovered in Artifex Ghostscript before 10.05.0. Also affects ghostscript