CVE-2021-3781Ghostscript OS Command Injection
A trivial sandbox (enabled with the -dSAFER option) escape flaw was found in the ghostscript interpreter by injecting a specially crafted pipe command.
Published Feb 16, 2022 · Updated Nov 23, 2026 · Also known as ALPINE-CVE-2021-3781, CLEANSTART-2025-JH59626, DEBIAN-CVE-2021-3781, DSA-4972-1, JLSEC-2026-1464, MGASA-2021-0436, OESA-2022-1560, SUSE-SU-2021:3044-1, SUSE-SU-2021:3180-1, UBUNTU-CVE-2021-3781, USN-5075-1, openSUSE-SU-2021:1273-1
Key Facts
Patch immediately- CVE-2021-3781 is a critical-severity vulnerability (CVSS 9.9 v3.1) affecting Ghostscript (Artifex), Fedora (Fedoraproject), rootio-ghostscript and 8 more products.
- It is not listed in any known-exploited vulnerabilities catalog. No public exploit code is known.
- EPSS estimates a 86% probability of exploitation in the next 30 days.
- Fixed versions are available, including Ghostscript 9.50~dfsg-5ubuntu4.3, Ghostscript 9.52-155.1, Ghostscript 9.52-23.42.1.
- Brandefense priority: patch immediately, because it is very likely to be exploited soon.
Scores
CVSS v3.1
9.9
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
EPSS (30-day exploit likelihood)
86%
Higher than 99.7% of all scored CVEs
Exploit maturity
None known
ATLAS score
39/100
Publication score, see How it works
Exploitation Verdict
KEV listed
Not listed
Federal due date
None
No federal due date
Ransomware use
Not reported
Attributed actors
None named
Exploit & Defence Guidance
Exploit maturity
None known
Public exploit code
0
Proof-of-concept links
In-the-wild evidence
0
Reports of active use
Advisories And Exploit References
- advisoryhttps://security.alpinelinux.org/vuln/CVE-2021-3781
- advisoryhttps://security-tracker.debian.org/tracker/CVE-2021-3781
- advisoryhttps://ubuntu.com/security/CVE-2021-3781
- advisoryhttps://www.cve.org/CVERecord?id=CVE-2021-3781
- advisoryhttps://advisories.mageia.org/MGASA-2021-0436.html
- advisoryhttps://bugs.ghostscript.com/show_bug.cgi?id=704342
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.
Affected Products
263 affected entries in total| Product | Affected versions | Fixed in |
|---|---|---|
| GhostscriptArtifex | 9.50, 9.52, 9.53.3, 9.54.0, >= ghostpdl 9.55.0 | 9.54.0-3 |
| FedoraFedoraproject | 34 | n/a |
| rootio-ghostscriptrootio | See advisory | 9.54-r1 |
| Ghostscript_jlljulia | See advisory | 9.55.0+0 |
| ghostscript-miniopensuse | See advisory | 9.52-lp152.2.7.1 |
Patched Releases
Ghostscript
9.50~dfsg-5ubuntu4.3, 9.52-155.1, 9.52-23.42.1, 9.52-6.oe1, 9.52-7.oe1, 9.52-lp152.2.7.1, 9.53.3-2.1.mga8, 9.53.3-r1, 9.53.3~dfsg-7+deb11u1, 9.53.3~dfsg-8, 9.54-r1, 9.54.0-2.2, 9.54.0-3, 9.54.0-r2, 9.54.0~dfsg1-0ubuntu2
Ghostscript_jll
9.55.0+0
ghostscript-devel
9.52-155.1, 9.52-23.42.1, 9.52-lp152.2.7.1, 9.54.0-2.2
ghostscript-mini
9.52-lp152.2.7.1
ghostscript-mini-devel
9.52-lp152.2.7.1
ghostscript-x11
9.52-155.1, 9.52-23.42.1, 9.52-lp152.2.7.1, 9.54.0-2.2
libspectre
0.2.7-12.12.1, 0.2.8-3.12.1, 0.2.8-lp152.4.3.1
libspectre-devel
0.2.7-12.12.1, 0.2.8-3.12.1, 0.2.8-lp152.4.3.1
libspectre1
0.2.7-12.12.1, 0.2.8-3.12.1, 0.2.8-lp152.4.3.1
rootio-ghostscript
9.53.3~dfsg-8, 9.54-r1
Timeline
Publicly disclosed
Feb 16, 2022
Last updated
Nov 23, 2026
Weakness Type
- CWE-20 Improper Input Validation
- CWE-78 Improper Neutralization of Special Elements used in an OS Command
References
- advisorysecurity.alpinelinux.org · CVE-2021-3781
- advisorysecurity-tracker.debian.org · CVE-2021-3781
- advisoryubuntu.com · CVE-2021-3781
- advisorycve.org · CVERecord
- advisoryadvisories.mageia.org · MGASA-2021-0436.html
FAQ
Common Questions.
A trivial sandbox (enabled with the -dSAFER option) escape flaw was found in the ghostscript interpreter by injecting a specially crafted pipe command.
Affected: Ghostscript (Artifex) versions 9.50, 9.52, 9.53.3, 9.54.0, >= ghostpdl 9.55.0; Fedora (Fedoraproject) versions 34; rootio-ghostscript, among others. The full list is in the CVE brief.
It is not listed in any known-exploited vulnerabilities catalog.
No, it is not currently listed in the CISA Known Exploited Vulnerabilities catalog.
No public exploit code is known.
Fixed versions are available, including Ghostscript 9.50~dfsg-5ubuntu4.3, Ghostscript 9.52-155.1, Ghostscript 9.52-23.42.1.
Brandefense priority: patch immediately, because it is very likely to be exploited soon.
Is CVE-2021-3781 On Your Attack Surface?
Brandefense matches it against the products discovered on your perimeter and opens a finding the day a CVE like this is listed.
Request A Demo