Vulnerability HighRUSTSEC-2021-0130 · lru
RUSTSEC-2021-0130: Use after free in lru crate
Short answerA security vulnerability in the lru crate: Use after free in lru crate. GitHub rates it High. Fixed in 0.7.1: update to a fixed version.
| Crate | lru |
|---|---|
| Type | Vulnerability (memory-corruption) |
| Affected versions | Before 0.7.1. |
| Fixed in | 0.7.1 |
| Severity | High (GitHub rating) |
| Published | 2021-12-21 |
| Last changed | 2023-11-08 |
| Also known as | CVE-2021-45720, GHSA-qqmc-hwqp-8g2w, GHSA-v362-2895-h9r2 |
| Affected functions | lru::LruCache::iter, lru::LruCache::iter_mut |
What to do
- See which version you have:
cargo tree -i lru(it also shows which of your dependencies pulls it in). - Update within your version requirement:
cargo update -p lru. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for examplelru = "0.7.1") or update the dependency that pulls it in. - Check again with
cargo audit, or paste your Cargo.lock into our Cargo.toml checker.
Details from the advisory
Lru crate has use after free vulnerability.
Lru crate has two functions for getting an iterator. Both iterators give references to key and value. Calling specific functions, like pop(), will remove and free the value, and but it's still possible to access the reference of value which is already dropped causing use after free.
References
- Package: crates.io/crates/lru
- Advisory: rustsec.org/advisories/RUSTSEC-2021-0130.html
- Report: github.com/jeromefroe/lru-rs/issues/120
From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.
Other advisories for lru
Up next
Same cratelru: security historyEvery advisory for this crate, and whether it is safe to use today.Read it next →Did this answer your question?