CVE-2021-25907

9.8 CRITICAL

📋 TL;DR

This vulnerability in the Rust containers crate allows double-free memory corruption when a panic occurs during certain operations. Attackers can exploit this to execute arbitrary code or cause denial of service. Any Rust application using vulnerable versions of the containers crate is affected.

💻 Affected Systems

Products:
  • Rust applications using containers crate
Versions: containers crate versions < 0.9.11
Operating Systems: All platforms running Rust applications
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects Rust applications that use the containers crate and trigger panic conditions in mutate/mutate2 functions.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution leading to complete system compromise, data theft, or ransomware deployment.

🟠

Likely Case

Application crash or denial of service due to memory corruption, potentially leading to data loss.

🟢

If Mitigated

Controlled crash with minimal data loss if proper memory isolation and privilege separation are implemented.

🌐 Internet-Facing: HIGH - Applications exposed to untrusted input can be triggered remotely.
🏢 Internal Only: MEDIUM - Internal applications could be exploited by authenticated users or through other attack vectors.

🎯 Exploit Status

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

Exploitation requires triggering a panic in specific functions, but proof-of-concept code is publicly available.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: containers crate version 0.9.11 or later

Vendor Advisory: https://rustsec.org/advisories/RUSTSEC-2021-0010.html

Restart Required: Yes

Instructions:

1. Update Cargo.toml to require containers >= 0.9.11
2. Run 'cargo update --package containers'
3. Rebuild and redeploy your application
4. Restart affected services

🔧 Temporary Workarounds

Avoid panic triggers

all

Modify code to avoid operations that could trigger panics in mutate/mutate2 functions

Use alternative containers

all

Replace containers crate with alternative container libraries like std::collections

🧯 If You Can't Patch

  • Isolate vulnerable applications in containers with minimal privileges
  • Implement strict input validation to prevent triggering panic conditions

🔍 How to Verify

Check if Vulnerable:

Check Cargo.lock or run 'cargo tree | grep containers' to see if version < 0.9.11 is used

Check Version:

grep containers Cargo.lock | head -1

Verify Fix Applied:

Verify containers crate version is >= 0.9.11 in Cargo.lock and test panic scenarios

📡 Detection & Monitoring

Log Indicators:

  • Application crashes with double-free errors
  • Panic messages from containers crate functions

Network Indicators:

  • Unexpected application restarts
  • Increased error rates

SIEM Query:

source="application.logs" AND ("double free" OR "containers::util::mutate" OR "containers::util::mutate2")

🔗 References

📤 Share & Export