CVE-2021-28035

9.8 CRITICAL

📋 TL;DR

This vulnerability in the stack_dst Rust crate allows use-after-free of uninitialized memory when a panic occurs during cloning operations. This can lead to memory corruption and potential remote code execution. Any Rust application using stack_dst versions before 0.6.1 is affected.

💻 Affected Systems

Products:
  • Rust applications using stack_dst crate
Versions: stack_dst crate versions < 0.6.1
Operating Systems: All platforms running Rust applications
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects Rust applications that use the vulnerable stack_dst crate. The vulnerability is triggered when panic occurs during val.clone() operations.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

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

🟠

Likely Case

Application crashes, denial of service, or memory corruption leading to unpredictable behavior.

🟢

If Mitigated

Controlled crashes with minimal data loss if proper memory isolation and sandboxing are implemented.

🌐 Internet-Facing: HIGH - Rust applications often handle untrusted input and this vulnerability can be triggered remotely.
🏢 Internal Only: MEDIUM - Internal applications may still process malicious data from compromised internal sources.

🎯 Exploit Status

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

Exploitation requires triggering a panic during cloning operations, which can be achieved through crafted input. No public exploit code has been confirmed.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: stack_dst 0.6.1 or later

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

Restart Required: Yes

Instructions:

1. Update Cargo.toml to require stack_dst >= 0.6.1
2. Run 'cargo update' to fetch the patched version
3. Rebuild and redeploy your application
4. Restart any running services using the vulnerable version

🔧 Temporary Workarounds

Avoid panic-triggering inputs

all

Implement input validation to prevent operations that could trigger panics during cloning

Use alternative data structures

all

Replace stack_dst usage with standard Rust collections or other crates

🧯 If You Can't Patch

  • Isolate affected applications in containers or VMs with minimal privileges
  • Implement strict input validation and sanitization to prevent panic conditions

🔍 How to Verify

Check if Vulnerable:

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

Check Version:

grep -A2 -B2 'stack_dst' Cargo.lock

Verify Fix Applied:

Verify stack_dst version is >= 0.6.1 in Cargo.lock and test application with panic-inducing inputs

📡 Detection & Monitoring

Log Indicators:

  • Application crashes with panic messages
  • Memory corruption errors in logs
  • Unexpected process terminations

Network Indicators:

  • Unusual traffic patterns to Rust applications
  • Repeated connection attempts triggering crashes

SIEM Query:

process.name:"rust_app" AND (event.type:"crash" OR log.message:"panic" OR log.message:"stack_dst")

🔗 References

📤 Share & Export