CVE-2020-35895

9.8 CRITICAL

📋 TL;DR

CVE-2020-35895 is a memory corruption vulnerability in the Rust stack crate's ArrayVec implementation that allows out-of-bounds writes during element insertion. This can lead to arbitrary code execution, denial of service, or data corruption. Any Rust application using the vulnerable stack crate versions is affected.

💻 Affected Systems

Products:
  • Rust applications using stack crate
Versions: stack crate versions before 0.3.1
Operating Systems: All operating systems running Rust applications
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects Rust applications that explicitly use the vulnerable stack crate.

📦 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 crash (denial of service) or memory corruption leading to unpredictable behavior.

🟢

If Mitigated

Limited impact with proper memory protections and exploit mitigations like ASLR and stack canaries.

🌐 Internet-Facing: HIGH - Exploitable remotely via crafted inputs to affected applications.
🏢 Internal Only: HIGH - Internal applications using vulnerable versions remain at risk.

🎯 Exploit Status

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

Exploitation requires triggering the vulnerable ArrayVec insertion code path.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: stack crate version 0.3.1 or later

Vendor Advisory: https://rustsec.org/advisories/RUSTSEC-2020-0042.html

Restart Required: Yes

Instructions:

1. Update Cargo.toml to require stack crate >=0.3.1. 2. Run 'cargo update' to fetch patched version. 3. Rebuild and redeploy application.

🔧 Temporary Workarounds

Remove stack crate dependency

all

Replace stack crate with alternative safe implementations

cargo remove stack
cargo add [alternative-crate]

🧯 If You Can't Patch

  • Implement input validation and sanitization for all ArrayVec insertion operations
  • Deploy memory protection controls like ASLR, DEP, and stack canaries

🔍 How to Verify

Check if Vulnerable:

Check Cargo.lock for stack crate version <0.3.1 or run 'cargo audit'

Check Version:

grep -A2 'name = "stack"' Cargo.lock

Verify Fix Applied:

Verify Cargo.lock contains stack crate >=0.3.1 and 'cargo audit' shows no vulnerabilities

📡 Detection & Monitoring

Log Indicators:

  • Application crashes with segmentation faults
  • Memory access violation errors
  • Unexpected process termination

Network Indicators:

  • Unusual outbound connections following application crashes

SIEM Query:

source="application.logs" AND ("segmentation fault" OR "access violation" OR "stack crate")

🔗 References

📤 Share & Export