← Vulnerability feed

Vulnerability record · CVE-2021-3781 · published 16 February 2022

CVE-2021-3781: Ghostscript -dSAFER sandbox escape via crafted pipe command

Artifex · Ghostscript

Ghostscript's -dSAFER sandbox can be escaped by injecting a specially crafted pipe command, allowing a malicious document to run arbitrary commands as the interpreter. Because Ghostscript is widely embedded in document conversion and printing pipelines, untrusted files can turn into host command execution. The record gives no affected version ranges, so version-specific exposure cannot be confirmed from it.

9.9 CVSS 3.1 Critical EPSS 84% · top 0.3% CWE-20 · Improper input validationCWE-78 · OS command injection
9.9CVSS 3.1 base score, v2 9.3
84%EPSS exploitation probability, 30 days
NoNot in CISA KEV
2Affected product versions listed by NVD
6References
17 Jun 2026Last modified by NVD

Description

A trivial sandbox (enabled with the `-dSAFER` option) escape flaw was found in the ghostscript interpreter by injecting a specially crafted pipe command. This flaw allows a specially crafted document to execute arbitrary commands on the system in the context of the ghostscript interpreter. The highest threat from this vulnerability is to confidentiality, integrity, as well as system availability.

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H

Automated analysis

Generated by VULONE's analysis model from the NVD record, CISA KEV and EPSS data on 18 September 2026. Confidence: medium.

critical priorityCVSS 9.9 critical with scope change and very high EPSS, though no KEV listing or confirmed in-the-wild exploitation is recorded.

What it is

Ghostscript's -dSAFER sandbox can be escaped by injecting a specially crafted pipe command, allowing a malicious document to run arbitrary commands as the interpreter. Because Ghostscript is widely embedded in document conversion and printing pipelines, untrusted files can turn into host command execution. The record gives no affected version ranges, so version-specific exposure cannot be confirmed from it.

Impact

An attacker gains arbitrary command execution in the context of the Ghostscript interpreter, threatening confidentiality, integrity and availability of the host. The CVSS scope change (S:C) indicates impact can extend beyond the vulnerable component.

Attack surface

Reached over the network (AV:N) by supplying a crafted document to a Ghostscript-based processing path; no user interaction is required (UI:N). The vector requires low privileges (PR:L), so the attacker needs some existing access or a service context that processes their input.

Exploitation

Not listed in CISA KEV and no ransomware use documented, but EPSS is very high (0.839, 99.7th percentile), indicating strong likelihood of exploitation activity. References are patch and advisory links only, with no public exploit tag.

What to do

  • Patch Ghostscript to a fixed release using the vendor advisory and Red Hat bug 2002271 as guidance.
  • If patching is delayed, avoid processing untrusted documents with Ghostscript and disable or restrict -dSAFER-dependent conversion services.
  • Run Ghostscript in a hardened sandbox or container with minimal filesystem and network access, since -dSAFER itself is the escape vector.
  • Restrict who can submit documents to Ghostscript-backed pipelines, given the PR:L requirement.
  • Track vendor advisories (Artifex, Fedora, Gentoo GLSA 202211-11) for updated fixed versions.

Detection

  • Monitor Ghostscript processes for unexpected child processes or shell execution, especially pipe-related commands.
  • Alert on Ghostscript handling files from untrusted or external sources outside normal workflow.
  • Review host logs for command execution spawned by document conversion or print services.
  • Watch for anomalous outbound network connections from hosts running Ghostscript-based services.

This assessment is produced automatically and is not human-reviewed. Verify against the vendor advisory before acting on it.

Affected products

2 vulnerable configurations from NVD's CPE data, grouped by vendor and product.

References

LinkTags
https://bugzilla.redhat.com/show_bug.cgi?id=2002271 Issue TrackingPatchThird Party Advisory
https://ghostscript.com/CVE-2021-3781.html PatchVendor Advisory
https://security.gentoo.org/glsa/202211-11 Third Party Advisory
https://bugzilla.redhat.com/show_bug.cgi?id=2002271 Issue TrackingPatchThird Party Advisory
https://ghostscript.com/CVE-2021-3781.html PatchVendor Advisory
https://security.gentoo.org/glsa/202211-11 Third Party Advisory

Track CVE-2021-3781 inside VULONE

Watch it alongside the ransomware crews, C2 infrastructure and forum chatter that reference it, query it through the API and pull it into your SIEM over TAXII.

Start free Open in platform

Related vulnerabilities

Same products first, then exploited flaws of the same weakness class.

10.0CVE-2021-44228Apache Log4j2 JNDI lookup remote code executionApache Log4j2 versions 2.0-beta9 through 2.15.0 (excluding 2.12.2, 2.12.3, and 2.3.1) do not protect against attacker-controlled LDAP and other JNDI …KEVEPSS 100%analysed9.8CVE-2024-4577PHP-CGI on Windows argument injection leads to remote code executionPHP-CGI on Windows can misinterpret characters in the command line passed to Win32 API functions when certain code pages are configured, due to Windo…KEVEPSS 100%analysed9.8CVE-2021-44026Roundcube Webmail SQL injection via search parametersRoundcube Webmail before 1.3.17 and 1.4.x before 1.4.12 is prone to SQL injection through the search or search_params input. The flaw is remotely rea…KEVEPSS 70%analysed9.8CVE-2021-42013Apache HTTP Server path traversal and RCE via incomplete fixThe fix for CVE-2021-41773 in Apache HTTP Server 2.4.50 was insufficient, leaving a path traversal flaw that lets attackers map URLs to files outside…KEVEPSS 100%analysed9.8CVE-2021-41773Apache HTTP Server 2.4.49 path traversal and RCEA path normalization flaw introduced in Apache HTTP Server 2.4.49 lets attackers map URLs to files outside directories configured by Alias-like direc…KEVEPSS 100%analysed9.8CVE-2021-1870Apple WebKit logic flaw allows remote code executionA logic issue in Apple's WebKit was addressed with improved restrictions, affecting macOS Big Sur, Catalina, Mojave, iOS and iPadOS, plus WebKitGTK a…KEVEPSS 7.7%analysed9.8CVE-2021-1871Apple WebKit logic flaw allows remote code executionA logic issue in Apple's WebKit was addressed with improved restrictions. It affects macOS Big Sur, Catalina, Mojave, iOS and iPadOS, and a remote at…KEVEPSS 7.0%analysed9.8CVE-2020-16846SaltStack Salt API shell injection via crafted web requestsSaltStack Salt through 3002 is vulnerable to OS command injection when the SSH client is enabled and crafted web requests are sent to the Salt API. T…KEVEPSS 100%analysed

Source: NIST National Vulnerability Database (record CVE-2021-3781), CISA KEV, FIRST EPSS (scores of 2026-09-24). This page is refreshed as NVD updates the record.