cve.bz

CVE-2021-3781 OS Command Injection

9.9 criticalEPSS 84%Fix available

Critical (9.9). EPSS 84% estimated probability of exploitation activity in the next 30 days.

On this page
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.

Severity

CVSS 3.1

9.9 critical
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
EPSS
84% (unchanged from 84% a week ago; 84% 30 days ago) estimated probability of exploitation activity in the next 30 days; 100th percentile. Scored 2026-11-22. A forecast for this CVE across the internet, not for your own systems.
CWEs
CWE-78 Improper Neutralization of Special Elements used in an OS Command (OS Command Injection)
CWE-20 Improper Input Validation
OWASP Top 10
A05:2025 Injection
Published
Modified
NVD analysis
Analyzed, since modified
Record from
the NVD, synced

Fix and patched versions

Ask an AI about this CVE

Show the promptExplain CVE-2021-3781 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2021-3781?via=ask-ai-copy and https://cve.bz/cve/CVE-2021-3781?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2021-3781 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Affected

Versions

From the NVD's CPE matches.

ProductAffected
artifex:ghostscript9.50
artifex:ghostscript9.52
artifex:ghostscript9.53.3
artifex:ghostscript9.54.0
fedoraproject:fedora34

Linux distributions

DistributionReleasePackageFixed inAdvisory
Debian11ghostscript9.53.3~dfsg-7+deb11u1DSA-4972-1
Debian12, 13, 14ghostscript9.53.3~dfsg-8DEBIAN-CVE-2021-3781
Ubuntu20.04:LTSghostscript9.50~dfsg-5ubuntu4.3UBUNTU-CVE-2021-3781 USN-5075-1
Ubuntu22.04:LTSghostscript9.54.0~dfsg1-0ubuntu2UBUNTU-CVE-2021-3781
SUSEEnterprise Storage 6, Linux Enterprise High Performance Computing 15 SP1-ESPOS, Linux Enterprise High Performance Computing 15 SP1-LTSS and 12 moreghostscript9.52-155.1SUSE-SU-2021:3044-1
SUSEEnterprise Storage 6, Linux Enterprise High Performance Computing 15 SP1-ESPOS, Linux Enterprise High Performance Computing 15 SP1-LTSS and 12 morelibspectre0.2.8-3.12.1SUSE-SU-2021:3044-1
SUSEHPE Helion OpenStack 8, Linux Enterprise Server 12 SP2-BCL, Linux Enterprise Server 12 SP3-BCL and 11 moreghostscript9.52-23.42.1SUSE-SU-2021:3180-1
SUSEHPE Helion OpenStack 8, Linux Enterprise Server 12 SP2-BCL, Linux Enterprise Server 12 SP3-BCL and 11 morelibspectre0.2.7-12.12.1SUSE-SU-2021:3180-1
openSUSELeap 15.2ghostscript, ghostscript-mini9.52-lp152.2.7.1openSUSE-SU-2021:1273-1
openSUSELeap 15.2libspectre0.2.8-lp152.4.3.1openSUSE-SU-2021:1273-1
openSUSELeap 15.3ghostscript9.52-155.1openSUSE-SU-2021:3044-1
openSUSELeap 15.3libspectre0.2.8-3.12.1openSUSE-SU-2021:3044-1
openSUSETumbleweedghostscript9.54.0-2.2openSUSE-SU-2024:10783-1
Alpinev3.13ghostscript9.53.3-r1ALPINE-CVE-2021-3781
Alpinev3.14, v3.15, v3.16 and 8 moreghostscript9.54-r1ALPINE-CVE-2021-3781

From the distributions' data via OSV.dev: the Debian Security Tracker; Ubuntu Security Notices © Canonical Ltd., CC BY-SA 4.0; SUSE security data, CC BY 4.0; the Alpine secdb, CC BY-SA 4.0. Modified: reformatted and linked to CVE records. Credits. On the distributions' own pages: Debian · Ubuntu · SUSE · openSUSE · Alpine.

Red Hat

Red Hat rates this Important.

Red Hat's statement

This flaw does not affect ghostscript versions prior to 9.50. As a result, Red Hat Enterprise Linux versions 5, 6, 7 and 8 are not affected by this flaw.

ProductPackageStateAdvisory
Red Hat Enterprise Linux 6ghostscriptNot affected
Red Hat Enterprise Linux 7ghostscriptNot affected
Red Hat Enterprise Linux 8ghostscriptNot affected
Red Hat Enterprise Linux 8gimp:flatpak/ghostscriptNot affected
Red Hat Enterprise Linux 9ghostscriptNot affected

Contains Red Hat Security Data © Red Hat, Inc., licensed under CC BY 4.0. Source: https://access.redhat.com/security/data. Modified: reformatted. Red Hat's page for CVE-2021-3781.

Attack patterns (CAPEC)

  • CAPEC-6 Argument Injection Likelihood: High · Severity: High
  • CAPEC-15 Command Delimiters Likelihood: High · Severity: High
  • CAPEC-43 Exploiting Multiple Input Interpretation Layers Likelihood: Medium · Severity: High
  • CAPEC-88 OS Command Injection Likelihood: High · Severity: High
  • CAPEC-108 Command Line Execution through SQL Injection Likelihood: Low · Severity: Very High

The attack patterns MITRE's CAPEC relates to this record's weaknesses, as MITRE names them. Credits. More on the page of CWE-20 (51).

References

Check your stackJSON