CVE-2021-22204

MEDIUM(6.8)KEVLikely Exploited

ExifTool Remote Code Execution Vulnerability

Description

CVE-2021-22204 is a code injection vulnerability in ExifTool, the widely used Perl-based metadata extraction tool. Improper neutralization of user data in the DjVu file format parser in ExifTool versions 7.44 through 12.23 allows attackers to achieve arbitrary code execution by supplying a malicious image file. This code injection vulnerability in ExifTool is particularly dangerous because ExifTool is commonly integrated into web applications and CI/CD pipelines for automated image processing. CISA has confirmed active exploitation of CVE-2021-22204, and an EPSS score of 92.76% (99.8th percentile) indicates near-certain exploitation, notably because the vulnerability was chained with GitLab to achieve unauthenticated remote code execution.

KEV Information

Vendor
Perl
Product
Exiftool
Date Added
November 17, 2021
Due Date
December 1, 2021
Required Action
Apply updates per vendor instructions.

CVSS Score

Vector String
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:LOpen in Calculator
Attack Vector
LOCAL
Attack Complexity
LOW
Privileges Required
NONE
User Interaction
NONE
Scope
CHANGED
Confidentiality Impact
LOW
Integrity Impact
LOW
Availability Impact
LOW
Exploitability Score
2.5
Impact Score
3.7

CWEs

Affected Products

VendorProductVersion
exiftool projectexiftool>= 7.44, < 12.24
debiandebian linux9.0; 10.0
fedoraprojectfedora32; 33; 34

Multiple CVSS Assessments

Source: [email protected](Secondary)
6.8
MEDIUM

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

Source: [email protected](Primary)
7.8
HIGH

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

References

Weakness Type

CWE-94: Improper Control of Generation of Code ('Code Injection')

In CVE-2021-22204, ExifTool's DjVu file format parser improperly neutralizes user-controlled data before evaluating it as Perl code. When processing a crafted DjVu ANT annotation, the parser passes attacker-controlled input to Perl's code evaluation mechanism, enabling arbitrary code execution within the ExifTool process context.

Learn more: CWE-94 — Improper Control of Generation of Code ('Code Injection')

Impact Analysis

CVE-2021-22204 has a CVSS 3.1 score of 6.8 (MEDIUM) based on the secondary assessment, though NVD assigns a higher score of 7.8 (HIGH) with the primary vector. The vulnerability requires local access but no privileges and no user interaction, with a changed scope indicating it can affect resources beyond ExifTool itself. While the individual CVSS sub-metrics show low impact on confidentiality, integrity, and availability, the real-world impact is significantly amplified by ExifTool's widespread integration into web applications. Most notably, this vulnerability was chained with GitLab to achieve unauthenticated remote code execution against GitLab instances, vastly expanding the attack surface beyond local exploitation. With an EPSS score of 92.76% (99.8th percentile), CVE-2021-22204 is near-certain to be exploited, and its use in the GitLab attack chain demonstrates the severe real-world consequences of this seemingly moderate-severity vulnerability.

Exploit Maturity

CVE-2021-22204 has extensive public exploit availability and is confirmed as actively exploited through its listing in the CISA Known Exploited Vulnerabilities catalog. Public exploit code is available through multiple sources, including the original ExifTool DjVu ANT Perl Injection proof-of-concept, a GitLab Unauthenticated Remote ExifTool Command Injection exploit, a GitLab 13.10.2 Remote Code Execution exploit, and an ExifTool 12.23 Arbitrary Code Execution exploit. The EPSS score of 92.76% (99.8th percentile) reflects near-certain exploitation activity. The vulnerability was notably chained with GitLab's image upload functionality to achieve unauthenticated remote code execution on GitLab servers, as documented in a HackerOne report.

Remediation

  1. Apply vendor patches immediately as mandated by CISA KEV: update ExifTool to version 12.24 or later, which addresses the DjVu file format code injection vulnerability.
  2. Verify all instances of ExifTool (versions 7.44 through 12.23) have been updated, including those bundled within web applications, CI/CD pipelines, and container images. Check systems running Debian Linux 9.0 and 10.0, and Fedora 32, 33, and 34 for distribution-packaged versions.
  3. If immediate patching is not possible, disable DjVu file processing in ExifTool or implement strict file type validation to reject DjVu files before they reach ExifTool. Restrict which file formats ExifTool processes using the -ext flag.
  4. Audit systems that integrate ExifTool for image processing, particularly web applications like GitLab that automatically process uploaded images. Review logs for suspicious DjVu file uploads or unexpected process execution originating from ExifTool.
  5. Implement defense-in-depth by running ExifTool processes with minimal privileges, in sandboxed environments (containers, seccomp profiles), and with restricted network access to limit the impact of code execution vulnerabilities.

Technical Details

CVE-2021-22204 exploits a code injection flaw in ExifTool's DjVu file format parser, specifically in the handling of ANT (annotation) chunks within DjVu files. When ExifTool parses a crafted DjVu file, attacker-controlled data from the ANT annotation is improperly passed to Perl's code evaluation mechanism without adequate sanitization, allowing arbitrary Perl code execution. The CVSS vector (CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:L) indicates local access is required, but the changed scope means the impact extends beyond ExifTool itself. In practice, the local access requirement is bypassed when ExifTool is integrated into web applications — the GitLab exploitation chain demonstrated this by uploading a malicious DjVu image through the web interface, which GitLab's backend automatically processed with ExifTool, converting a local code injection into unauthenticated remote code execution.

Frequently Asked Questions

Is CVE-2021-22204 being actively exploited?

Yes. CVE-2021-22204 is listed in the CISA Known Exploited Vulnerabilities catalog, confirming active exploitation. Multiple public exploits are available, including chains targeting GitLab instances. The EPSS score of 92.76% (99.8th percentile) indicates near-certain exploitation activity.

What products are affected by CVE-2021-22204?

CVE-2021-22204 directly affects ExifTool versions 7.44 through 12.23. It also impacts any application that integrates ExifTool for image processing, most notably GitLab, which was targeted through this vulnerability. Affected distributions include Debian Linux 9.0 and 10.0, and Fedora 32, 33, and 34.

How do I fix CVE-2021-22204?

Update ExifTool to version 12.24 or later. Ensure all bundled or distribution-packaged instances are also updated. As interim measures, disable DjVu file processing or run ExifTool in a sandboxed environment with minimal privileges.

How severe is CVE-2021-22204?

CVE-2021-22204 has a CVSS 3.1 score of 6.8 (MEDIUM) to 7.8 (HIGH) depending on the assessment. While the base score appears moderate, the real-world severity is significantly higher due to widespread ExifTool integration in web applications and the availability of exploitation chains that achieve unauthenticated remote code execution on platforms like GitLab.

CVSS Score

6.8
MEDIUM(6.8)

EPSS Score

EPSS Score99.98%
EPSS Percentile100.0%

Dates

PublishedApril 23, 2021
Last ModifiedJune 17, 2026
StatusAnalyzed
CVSS Versionv3.1

Need Help With Vulnerability Management?

Our security experts can help you prioritize and remediate vulnerabilities effectively.