CVE-2021-29942
📋 TL;DR
This vulnerability in the Rust reorder crate allows reading uninitialized memory when swap_index is called with an iterator reporting an incorrect length. This affects any Rust application using vulnerable versions of the reorder crate, potentially exposing sensitive data or causing crashes.
💻 Affected Systems
- Rust applications using the reorder crate
📦 What is this software?
Reorder by Reorder Project
⚠️ Risk & Real-World Impact
Worst Case
Information disclosure of sensitive memory contents, potential remote code execution if combined with other vulnerabilities, or application crashes leading to denial of service.
Likely Case
Application crashes or undefined behavior causing instability, with potential information leakage of adjacent memory contents.
If Mitigated
Limited impact if application runs with minimal privileges and doesn't process untrusted input through the vulnerable function.
🎯 Exploit Status
Exploitation requires control over iterator length values and specific usage patterns of the swap_index function.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Versions after 2021-02-24
Vendor Advisory: https://rustsec.org/advisories/RUSTSEC-2021-0050.html
Restart Required: Yes
Instructions:
1. Update Cargo.toml to use reorder crate version > 0.3.0. 2. Run 'cargo update --package reorder'. 3. Rebuild and redeploy your application.
🔧 Temporary Workarounds
Avoid swap_index with untrusted iterators
allTemporarily avoid using swap_index function with iterators from untrusted sources
🧯 If You Can't Patch
- Implement input validation for iterator length values
- Isolate applications using the vulnerable crate in restricted environments
🔍 How to Verify
Check if Vulnerable:
Check Cargo.lock for reorder crate version <= 0.3.0 or check dependencies with 'cargo tree | grep reorder'
Check Version:
grep -A2 'name = "reorder"' Cargo.lock
Verify Fix Applied:
Verify reorder crate version > 0.3.0 in Cargo.lock after update
📡 Detection & Monitoring
Log Indicators:
- Application crashes with memory access errors
- Unexpected application termination
Network Indicators:
- None specific to this vulnerability
SIEM Query:
Application logs containing 'panicked at' or 'index out of bounds' errors from Rust applications