CVE-2021-21235: Kamadak exif Kamadak-exif Vulnerable To Infinite Loop Vulnerability

MODERATE
Advisory Identifier: GHSA-px9g-8hgv-jvg2
CVSS 6.5
CWE-400 CWE-835
Published
Advisory Summary

CVE-2021-21235 is a MODERATE (CVSS 6.5) kamadak-exif vulnerable to infinite loop vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Kamadak exif libraries in the crates.io ecosystem. The issue involves kamadak-exif vulnerable to infinite loop when parsing png files. Remediation is available by upgrading affected packages to version 0.5.3.

CVE-2021-21235 at a Glance

CVE Identifier CVE-2021-21235
GHSA Identifier GHSA-px9g-8hgv-jvg2
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Kamadak exif
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 6.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2021-21235

To remediate this vulnerability, upgrade all affected Kamadak exif dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

kamadak-exif fixed: 0.5.3
Upgrade kamadak-exif to 0.5.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for kamadak-exif

How to Check if You Are Affected

To determine whether your application is affected by CVE-2021-21235, inspect your project dependencies for Kamadak exif:

inspect dependencies for kamadak-exif

Analyze the terminal output to locate any version of Kamadak exif in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.5.3), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Kamadak exif, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact Reader::read_from_container can cause an infinite loop when a crafted PNG file is given. ### Patches Version 0.5.3 includes the fix. ### Workarounds No workaround is available. Applications that do not pass files with the PNG signature to Reader::read_from_container are not affected. ### References * <https://github.com/kamadak/exif-rs/security/advisories/GHSA-px9g-8hgv-jvg2> * <https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-21235> ### For more information If you have any questions or comments about this advisory: * Open an issue in [github.com/kamadak/exif-rs](https://github.com/kamadak/exif-rs)

CVE-2021-21235 Affected Kamadak exif Versions

1 component(s)
Fixed Versions:
0.5.3
Product / Package Ecosystem Affected Versions Fixed Version
kamadak-exif
crates.io
≥ 0.5.2
< 0.5.3
All 1 versions
0.5.2
0.5.3

References

Frequently Asked Questions

What is CVE-2021-21235?
CVE-2021-21235 is a security vulnerability in Kamadak exif involving kamadak-exif vulnerable to Infinite loop when parsing PNG files under CWE-400: Uncontrolled Resource Consumption.
Which Kamadak exif versions are affected?
Affected versions include releases prior to 0.5.3 across affected packages: kamadak-exif.
What version fixes CVE-2021-21235?
Upgrading to 0.5.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is kamadak-exif affected?
Yes, kamadak-exif is affected in releases prior to 0.5.3. Upgrade your dependency to 0.5.3 or later.
What is the CVSS score of CVE-2021-21235?
CVE-2021-21235 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2021-21235?
CVE-2021-21235 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check crates.io dependencies for CVE-2021-21235?
Run the dependency tree command: 'inspect dependencies for kamadak-exif'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-px9g-8hgv-jvg2",
  "modified" : "2022-10-06T19:53:39Z",
  "published" : "2022-10-06T19:53:39Z",
  "aliases" : [ "CVE-2021-21235" ],
  "summary" : "kamadak-exif vulnerable to Infinite loop when parsing PNG files",
  "details" : "### Impact\nReader::read_from_container can cause an infinite loop when a crafted PNG file is given.\n\n### Patches\nVersion 0.5.3 includes the fix.\n\n### Workarounds\nNo workaround is available.\nApplications that do not pass files with the PNG signature to Reader::read_from_container are not affected.\n\n### References\n* <https://github.com/kamadak/exif-rs/security/advisories/GHSA-px9g-8hgv-jvg2>\n* <https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-21235>\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [github.com/kamadak/exif-rs](https://github.com/kamadak/exif-rs)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "kamadak-exif"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.5.2"
      }, {
        "fixed" : "0.5.3"
      } ]
    } ],
    "versions" : [ "0.5.2" ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/kamadak/exif-rs/security/advisories/GHSA-px9g-8hgv-jvg2"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-21235"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/kamadak/exif-rs/commit/1b05eab57e484cd7d576d4357b9cda7fdc57df8c"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/kamadak/exif-rs/commit/f21df24616ea611c5d5d0e0e2f8042eb74d5ff48"
  }, {
    "type" : "WEB",
    "url" : "https://crates.io/crates/kamadak-exif"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/kamadak/exif-rs"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2021-0143.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400", "CWE-835" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-10-06T19:53:39Z",
    "nvd_published_at" : "2021-01-06T02:15:00Z"
  }
}