CVE-2021-45720

7.5 HIGH

📋 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

Products:
  • Rust applications using lru crate
Versions: lru crate versions < 0.7.1
Operating Systems: All operating systems running Rust applications
Default Config Vulnerable: ⚠️ Yes
Notes: Any Rust application using lru crate for LRU cache implementation is vulnerable regardless of configuration.

📦 What is this software?

⚠️ 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.

🌐 Internet-Facing: MEDIUM - Exploitation requires specific conditions but could affect web services using the vulnerable crate.
🏢 Internal Only: LOW - Requires local access or internal network exploitation vectors.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

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

all

Manually 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")

🔗 References

📤 Share & Export