CVE-2021-43113
Critical · 9.8CVSS
9.8
EPSS
5.4%
Published
Dec 15, 2021
CISA due date
—
Cloudanix analysis
A problem in a popular PDF library lets attackers run their own commands on computers whenever the software compares certain PDF files.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- Low
- Impact
- Remote Code Execution
- Component
- Library
- Class
- Command Injection
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
The vulnerability permits command injection by allowing an attacker-controlled filename passed to CompareTool to be unsafely interpolated into the Ghostscript (gs) command line within GhostscriptHelper.java, resulting in arbitrary operating system command execution.
Why it matters to the business
Organizations relying on PDF generation or comparison features in affected libraries face risk of complete system takeover, data exfiltration, or ransomware deployment on servers handling untrusted documents; high ecosystem prevalence in Java-based document workflows amplifies exposure across development and production environments.
How an attack unfolds
An attacker supplies a specially crafted filename containing shell metacharacters to a CompareTool invocation; the filename is directly concatenated into the Ghostscript command line without sanitization, causing the operating system to execute attacker-supplied commands when the comparison operation runs.
How to fix it
Upgrade itext/itext7, itext/itext-java, and itext/itextpdf to commit a2746010d27536b68d60d53f81912d5a7c537b7e or 0231a60e92a1968601d1d7779dc3f57f1274f32f; for Debian roundup packages apply the listed fixed versions (1.2.1-10+etch1 or 1.4.4-4+lenny1) or later; disable Ghostscript integration where feasible until patches are applied.
How to confirm the fix worked
Verify library versions against the fixed commits or package revisions; test CompareTool calls with filenames containing shell metacharacters to confirm they no longer result in command execution; review application dependency manifests for remaining vulnerable iText 7 artifacts.
Typical attack path
- Locate applications using vulnerable iText 7 CompareTool functionality
- Craft a malicious filename embedding shell metacharacters and command payloads
- Trigger PDF comparison processing that invokes GhostscriptHelper
- Achieve remote code execution on the host system
- Establish persistence or exfiltrate data
How to detect it
Inspect application and system logs for Ghostscript invocations containing unexpected filenames or shell operators; search process execution records for gs commands with suspicious arguments; correlate with PDF comparison API calls in application traces.
- gs -sDEVICE=
- CompareTool
- GhostscriptHelper
- filename containing ; or | or `
What your security team should do
- Prioritize immediate upgrade of all iText 7 instances given available public exploits and high severity
- Scan source code and dependency trees for usage of CompareTool and GhostscriptHelper
- Implement input sanitization on filenames passed to PDF comparison routines as a temporary control
- Monitor EPSS trend and exploit availability for changes in threat level
- Review logs for suspicious Ghostscript process invocations
The record
iTextPDF in iText 7 and up to (excluding 4.4.13.3) 7.1.17 allows command injection via a CompareTool filename that is mishandled on the gs (aka Ghostscript) command line in GhostscriptHelper.java.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Maven | com.itextpdf:itext7-core | 0 | 7.1.17 |
| Maven | com.itextpdf:itextpdf | 0 | 5.5.13.3 |
| Debian:10 | libitext5-java | 0 | 5.5.13-1+deb10u1 |
| Debian:11 | libitext5-java | 0 | 5.5.13.2-1+deb11u1 |
| Debian:12 | libitext5-java | 0 | 5.5.13.3-1 |
| Debian:13 | libitext5-java | 0 | 5.5.13.3-1 |
| Debian:14 | libitext5-java | 0 | 5.5.13.3-1 |
| Ubuntu:24.04:LTS | libitext5-java | 0 | No fix |
| Ubuntu:24.10 | libitext5-java | 0 | No fix |
| Ubuntu:25.04 | libitext5-java | 0 | No fix |
| Ubuntu:25.10 | libitext5-java | 0 | No fix |
Related vulnerabilities
- CVE-2026-114575 A flaw has been found in TOTOLINK A950RG 4.1.2cu.5268_B20221104. CWE-77
- CVE-2026-112942 launch-editor allows users to open files with line numbers in editor from Node.js. CWE-77
- CVE-2026-55453 OpenPrinting CUPS is an open source printing system for Linux and other Unix-like… CWE-77
- CVE-2026-102827 simple-git, an interface for running git commands in any node.js application, enables… CWE-77
- CVE-2026-102826 simple-git, an interface for running git commands in any node.js application, enables… CWE-77
- CVE-2026-79945 Dell SCG 5.0 Appliance versions prior to 5.36.00.16 and Dell SCG 5.0 Application versions… CWE-77
- CVE-2026-79741 Dell SCG 5.0 Appliance versions prior to 5.36.00.16 and Dell SCG 5.0 Application versions… CWE-77
- CVE-2026-78493 Dell SCG 5.0 Appliance versions prior to 5.36.00.16 and Dell SCG 5.0 Application versions… CWE-77