CVE-2021-45720
📋 TL;DR
This vulnerability in the Rust lru crate allows use-after-free memory corruption when iterators access freed memory after a pop operation. It affects Rust applications using lru versions before 0.7.1 for caching functionality. Attackers could potentially exploit this to cause crashes or execute arbitrary code.
💻 Affected Systems
- Rust applications using lru crate
📦 What is this software?
Lru by Lru Project
⚠️ Risk & Real-World Impact
Worst Case
Remote code execution leading to complete system compromise if the vulnerable application processes attacker-controlled data.
Likely Case
Application crashes (denial of service) or memory corruption leading to undefined behavior.
If Mitigated
Limited impact if application runs with memory safety mitigations like ASLR and doesn't process untrusted data.
🎯 Exploit Status
Exploitation requires triggering specific iterator operations after pop operations. Proof-of-concept exists in advisory.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: lru crate version 0.7.1 or later
Vendor Advisory: https://rustsec.org/advisories/RUSTSEC-2021-0130.html
Restart Required: Yes
Instructions:
1. Update Cargo.toml to specify lru = '>=0.7.1'. 2. Run 'cargo update'. 3. Rebuild and redeploy application. 4. Restart affected services.
🔧 Temporary Workarounds
Avoid iterator use after pop
allManually ensure iterators are not used after calling pop operations on LRU cache
🧯 If You Can't Patch
- Isolate vulnerable applications in network segments with limited access
- Implement strict input validation and sanitization for data processed by LRU cache
🔍 How to Verify
Check if Vulnerable:
Check Cargo.lock or Cargo.toml for lru dependency version < 0.7.1
Check Version:
grep -A2 -B2 'lru' Cargo.lock || grep 'lru' Cargo.toml
Verify Fix Applied:
Verify lru version is >= 0.7.1 in Cargo.lock after update
📡 Detection & Monitoring
Log Indicators:
- Application crashes with segmentation faults
- Memory corruption errors in logs
Network Indicators:
- Unusual traffic patterns to services using LRU caching
SIEM Query:
source="application.logs" AND ("segmentation fault" OR "use-after-free" OR "memory corruption")