Register for the AI for Security Summit: Join Figma, Perplexity & Wiz

CVE-2021-3781
Ghostscript vulnerability analysis and mitigation

Overview

A trivial sandbox escape vulnerability (CVE-2021-3781) was discovered in the Ghostscript interpreter, affecting versions from 9.50 onwards. The vulnerability, identified in September 2021, allows attackers to bypass the -dSAFER option protection by injecting a specially crafted pipe command. This flaw specifically affects Unix-like systems and does not impact Windows environments (Ghostscript Advisory, Debian Tracker).

Technical details

The vulnerability stems from insufficient file access protection in Ghostscript's handling of the '%pipe%' PostScript device, particularly when combined with Ghostscript's need to create and control temporary files in conventional directories like '/tmp' or '/temp'. The issue occurs because the permission checking only validated the sub-string following the device specifier, rather than the entire file name string including the device specifier. The vulnerability has been assigned a CVSS v3.1 base score of 9.9 (Critical) with the vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H (NVD, Ghostscript Advisory).

Impact

The vulnerability allows attackers to execute arbitrary commands on the system in the context of the Ghostscript interpreter. The highest threats from this vulnerability affect system confidentiality, integrity, and availability. The most severe impacts are particularly concerning when the exploit is executed with high privileges (root/superuser level) (NVD, Debian Tracker).

Exploitability

The vulnerability is exploitable through specially crafted PostScript files that can bypass the sandbox protection mechanism. The exploit is specifically effective on Unix-like systems and requires the processing of a maliciously crafted file, either by a user or an automated system (Ghostscript Advisory).

Mitigation and workarounds

The vulnerability was fixed in Ghostscript version 9.55.0 and later releases. The solution involves including the device specifier string ('%pipe%') in the permissions checking, ensuring that the entire file name string is validated. Users are advised to upgrade to version 9.55.0 or later to remediate this vulnerability (Ghostscript Advisory, Debian Tracker).

Additional resources

Linux Distribution fix status

Fix availability across major Linux distributions and their releases.

Alpine

Fixed

edge

ghostscript: 9.54-r1

Fixed

v3.18

ghostscript: 9.54-r1

Fixed

v3.19

ghostscript: 9.54-r1

Fixed

v3.20

ghostscript: 9.54-r1

Fixed

v3.21

ghostscript: 9.54-r1

Fixed

v3.22

ghostscript: 9.54-r1

Fixed

v3.23

ghostscript: 9.54-r1

Fixed

Arch Linux

Fixed

rolling

ghostscript: 9.54.0-3

Fixed

SourceThis report was generated using AI

Related Ghostscript vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-39919CRITICAL9.3
  • Ghostscript logoGhostscript
  • ghostscript
NoNoSep 15, 2026
CVE-2025-59800MEDIUM5.5
  • Ghostscript logoGhostscript
  • libgs
NoYesSep 22, 2025
CVE-2025-59799MEDIUM5.5
  • Ghostscript logoGhostscript
  • ghostscript-doc
NoYesSep 22, 2025
CVE-2025-59801MEDIUM4.3
  • Ghostscript logoGhostscript
  • ghostscript
NoYesSep 22, 2025
CVE-2026-6192LOW1.9
  • Ghostscript logoGhostscript
  • openjpeg
NoYesApr 13, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management