CVE-2021-29942

7.3 HIGH

📋 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

Products:
  • Rust applications using the reorder crate
Versions: All versions through 2021-02-24
Operating Systems: All platforms running Rust applications
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications that use the swap_index function with iterators that may report incorrect lengths.

📦 What is this software?

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

🌐 Internet-Facing: MEDIUM - Exploitation requires specific conditions but could affect web services using the vulnerable crate.
🏢 Internal Only: MEDIUM - Internal applications using the crate could experience crashes or data leaks.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

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

all

Temporarily 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

🔗 References

📤 Share & Export