Skip to content
Threat Feed
high advisory

Exploitation of Ghostscript Leading to Arbitrary Command Execution

Attackers are exploiting vulnerabilities in the Ghostscript library, such as CVE-2024-29510, to achieve remote code execution through malicious file processing.

The Ghostscript library, widely utilized for document processing and file conversion, is being actively targeted by threat actors to execute arbitrary commands on Linux systems. Exploitation often centers on CVE-2024-29510, a vulnerability allowing attackers to bypass security restrictions during the processing of specially crafted files. This technique is frequently observed within environments that automatically handle user-uploaded documents, such as web-based file conversion services, or via malicious attachments in office suites. By triggering Ghostscript to interpret malicious input, attackers can escape restricted environments and execute system-level commands, leading to full system compromise. For defenders, the primary concern is the abuse of legitimate conversion utilities to facilitate initial access or post-exploitation activities.

Attack Chain

  1. An attacker crafts a malicious document (e.g., PostScript, PDF) designed to exploit a vulnerability in the Ghostscript interpreter.
  2. The malicious document is delivered to a target system via email attachment, direct upload to a web application, or a secondary exploit.
  3. The target system (or a back-end conversion service) initiates the Ghostscript utility (gs or ghostscript) to process the document.
  4. The malicious code within the document triggers a format string vulnerability or similar flaw in the Ghostscript interpreter.
  5. The vulnerability allows the attacker to hijack the execution flow and execute system commands.
  6. Ghostscript spawns a shell process (/bin/sh or sh -c) to execute the attacker-supplied payload.
  7. The spawned shell executes arbitrary commands, enabling persistence, data exfiltration, or further lateral movement.

Impact

Successful exploitation results in unauthorized remote code execution on the affected Linux host. This can lead to total system compromise, exfiltration of sensitive data, and the establishment of persistent backdoors. Organizations running document processing pipelines, web-based converters, or automated office document parsers are at the highest risk.

Recommendation

  • Deploy the provided Sigma rule to monitor for suspicious shell spawning originating from the Ghostscript binary.
  • Audit all applications and services that use Ghostscript for document processing to identify and isolate potentially vulnerable entry points.
  • Ensure the Ghostscript library is updated to the latest patched version to remediate CVE-2024-29510.
  • Enable process-creation auditing (e.g., Sysmon for Linux or Auditd) to capture parent-child process relationships, specifically focusing on gs or ghostscript executing shells.

Immediate actions

Deploy Sigma detection rule to SIEM

Detection Engineering 24h

Mitigations

Patch Ghostscript to the latest version

immediate IT Operations

CVE-2024-29510

Detection coverage 1

Detect Ghostscript Spawning Shell

high

Detects exploitation of Ghostscript by monitoring for shells spawned as child processes of the Ghostscript binary.

sigma tactics: execution techniques: T1059 sources: process_creation, linux

Detection queries are available on the platform. Get full rules →