Cloudanix VulnDB

CVE-2024-46953

None

CVSS

—

EPSS

0.4%

Published

Nov 10, 2024

CISA due date

—

Cloudanix analysis

Monitor only SSVC: Track

A bug in a widely used document processing tool can let attackers who supply specially crafted files write anywhere on disk or run their own code.

Exploitation
Requires User Interaction
Attacker needs
User Interaction
Complexity
Moderate
Impact
Full Compromise
Component
Library
Class
Path Traversal
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

Integer overflow during filename format string parsing in gsdevice.c causes path truncation that enables path traversal writes and potential arbitrary code execution via crafted output filenames.

Why it matters to the business

Systems that process untrusted PostScript, PDF, or EPS files with Ghostscript can suffer unauthorized file writes or remote code execution, risking data theft, malware deployment, or service disruption.

How an attack unfolds

An attacker supplies a malicious document or command-line invocation containing a specially crafted filename format string; the integer overflow truncates the resulting path, allowing traversal sequences that overwrite files or place executable content in locations Ghostscript will later process or execute.

How to fix it

Upgrade artifexsoftware/ghostpdl to the commit df8f4966577fff70320be2eb33cb55eb15d05d52 or later releases that contain the fix; rebuild any downstream packages that embed Ghostscript and validate the updated binary.

How to confirm the fix worked

Confirm the installed Ghostscript reports a version containing commit df8f4966577fff70320be2eb33cb55eb15d05d52; run regression tests with malicious filename format strings that previously triggered overflow to verify truncation no longer occurs.

Typical attack path

  1. Identify a Ghostscript invocation that accepts attacker-controlled output filename format strings
  2. Craft an input that triggers the integer overflow in filename parsing
  3. Use resulting truncation to inject path traversal sequences
  4. Write or overwrite files to achieve code execution or persistence
  5. Trigger execution of the planted payload through normal document processing

How to detect it

Review process command lines and logs for Ghostscript invocations containing unusual filename format strings with %d, %s, or path traversal sequences; inspect file system changes near output paths for unexpected writes or executables created after document processing.

What your security team should do

  • Immediately update all Ghostscript installations to the fixed commit
  • Inventory and patch any products or containers that bundle Ghostscript
  • Restrict Ghostscript use on untrusted input until patched
  • Monitor for new releases and apply updates within 48 hours

The record

An issue was discovered in base/gsdevice.c in Artifex Ghostscript before 10.04.0. An integer overflow when parsing the filename format string (for the output filename) results in path truncation, and possible path traversal and 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