CVE-2021-21235: Kamadak exif Kamadak-exif Vulnerable To Infinite Loop Vulnerability
MODERATECVE-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
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).
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.
Upgrade kamadak-exif to 0.5.3
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
CVE-2021-21235 Affected Kamadak exif Versions
1 component(s)| 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?
Which Kamadak exif versions are affected?
What version fixes CVE-2021-21235?
Is kamadak-exif affected?
What is the CVSS score of CVE-2021-21235?
What CWE is associated with CVE-2021-21235?
How can I check crates.io dependencies for CVE-2021-21235?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}