CVE-2021-21235
Infinite loop in parsing PNG files in
kamadak-exif is an exif parsing library written in pure Rust. In kamadak-exif version 0.5.2, there is an infinite loop in parsing crafted PNG files. Specifically, reader::read_from_container can cause an infinite loop when a crafted PNG file is given. This is fixed in version 0.5.3. No workaround is available. Applications that do not pass files with the PNG signature to Reader::read_from_container are not affected.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- Low
- User interaction
- Required
What an attacker can affect
- Confidentiality
- None
- Integrity
- None
- Availability
- High
Exploit likelihood
What each source reports
CVE List Score used
5.7
Infinite loop in parsing PNG files in
kamadak-exif is an exif parsing library written in pure Rust. In kamadak-exif version 0.5.2, there is an infinite loop in parsing crafted PNG files. Specifically, reader::read_from_container can cause an infinite loop when a crafted PNG file is given. This is fixed in version 0.5.3. No workaround is available. Applications that do not pass files with the PNG signature to Reader::read_from_container are not affected.
- Record
CVE-2021-21235- CVSS 3.1
- 5.7 Medium
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:H - Weakness
- CWE-400
- Updated
- 2026-11-02
EUVDEUVD-2022-7148
5.7
kamadak-exif is an exif parsing library written in pure Rust. In kamadak-exif version 0.5.2, there is an infinite loop in parsing crafted PNG files. Specifically, reader::read_from_container can cause an infinite loop when a crafted PNG file is given. This is fixed in version 0.5.3. No workaround is available. Applications that do not pass files with the PNG signature to Reader::read_from_container are not affected.
- Record
EUVD-2022-7148- CVSS 3.1
- 5.7 Medium
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:H - Updated
- 2026-11-03
GitHub AdvisoriesGHSA-px9g-8hgv-jvg2
6.5
kamadak-exif vulnerable to Infinite loop when parsing PNG files
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
- Record
GHSA-px9g-8hgv-jvg2- CVSS 3.1
- 6.5 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H - Weakness
- CWE-400, CWE-835
- Updated
- 2026-11-02
NVD
5.7
kamadak-exif is an exif parsing library written in pure Rust. In kamadak-exif version 0.5.2, there is an infinite loop in parsing crafted PNG files. Specifically, reader::read_from_container can cause an infinite loop when a crafted PNG file is given. This is fixed in version 0.5.3. No workaround is available. Applications that do not pass files with the PNG signature to Reader::read_from_container are not affected.
- Record
CVE-2021-21235- CVSS 3.1
- 5.7 Medium
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:H - CVSS 3.1
- 6.5 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H - CVSS 2.0
- 4.3 Medium
AV:N/AC:M/Au:N/C:N/I:N/A:P - Weakness
- CWE-400, CWE-835
- Updated
- 2026-11-02
OSV
6.5
kamadak-exif is an exif parsing library written in pure Rust. In kamadak-exif version 0.5.2, there is an infinite loop in parsing crafted PNG files. Specifically, reader::read_from_container can cause an infinite loop when a crafted PNG file is given. This is fixed in version 0.5.3. No workaround is available. Applications that do not pass files with the PNG signature to Reader::read_from_container are not affected.
- Record
CVE-2021-21235- CVSS 3.1
- 6.5 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H - Updated
- 2026-11-02
OSVGHSA-px9g-8hgv-jvg2
6.5
kamadak-exif vulnerable to Infinite loop when parsing PNG files
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
- Record
GHSA-px9g-8hgv-jvg2- CVSS 3.1
- 6.5 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H - Weakness
- CWE-400, CWE-835
- Updated
- 2026-11-02
OSVRUSTSEC-2021-0143
6.5
kamadak-exif DoS with untrusted PNG data
Attacker crafted data can cause a infinite loop leading to DoS if used with untrusted data.
- Record
RUSTSEC-2021-0143- CVSS 3.1
- 6.5 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H - Updated
- 2026-11-02
OSVUBUNTU-CVE-2021-21235
5.7
kamadak-exif is an exif parsing library written in pure Rust. In kamadak-exif version 0.5.2, there is an infinite loop in parsing crafted PNG files. Specifically, reader::read_from_container can cause an infinite loop when a crafted PNG file is given. This is fixed in version 0.5.3. No workaround is available. Applications that do not pass files with the PNG signature to Reader::read_from_container are not affected.
- Record
UBUNTU-CVE-2021-21235- CVSS 3.1
- 5.7 Medium
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:H - CVSS 3.1
- 6.5 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H - Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
kamadak-exifcrates.io |
0.5.2 to 0.5.2 | 0.5.3 |
kamadak-exifcrates.io |
0.5.2 up to 0.5.3 | 0.5.3 |
rust-kamadak-exifUbuntu:20.04:LTS |
All versions, plus listed versions 0.3.1-2 |
None known |
rust-kamadak-exifUbuntu:22.04:LTS |
All versions, plus listed versions 0.3.1-2 |
None known |
rust-kamadak-exifUbuntu:24.04:LTS |
All versions, plus listed versions 0.5.5-1 |
None known |
rust-kamadak-exifUbuntu:25.10 |
All versions, plus listed versions 0.5.5-1 |
None known |
rust-kamadak-exifUbuntu:26.10 |
All versions, plus listed versions 0.6.1-1 |
None known |
rust-kamadak-exifUbuntu:26.04:LTS |
All versions, plus listed versions 0.5.5-10.6.1-1 |
None known |
History
| Recorded | Changed | Sources |
|---|---|---|
| facts | ||
| aliases | EUVD | |
| first indexed | CVE List, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2021-21235 is a medium vulnerability (CVSS 5.7) in Kamadak-exif Project Kamadak-exif, published January 4, 2021. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 1.53%, the 75th percentile. Fixed in kamadak-exif 0.5.3.
References
github.com/kamadak/exif-rs/security/advisories/GHSA-px9g-8hgv-jvg2
crates.io/crates/kamadak-exif
github.com/kamadak/exif-rs/commit/f21df24616ea611c5d5d0e0e2f8042eb74d5ff48
nvd.nist.gov/vuln/detail/CVE-2021-21235
github.com/kamadak/exif-rs/commit/1b05eab57e484cd7d576d4357b9cda7fdc57df8c
rustsec.org/advisories/RUSTSEC-2021-0143.html