CVE-2021-26951

9.8 CRITICAL

📋 TL;DR

This vulnerability in the calamine Rust crate allows attackers to write arbitrary data to uninitialized heap memory locations, potentially leading to memory corruption and remote code execution. Any Rust application using calamine versions before 0.17.0 to parse Excel files is affected, particularly those accepting untrusted Excel file inputs.

💻 Affected Systems

Products:
  • Rust applications using calamine crate
Versions: calamine crate versions < 0.17.0
Operating Systems: All platforms running Rust applications
Default Config Vulnerable: ⚠️ Yes
Notes: Only vulnerable when processing Excel files (XLS, XLSX, XLSB, XLSM formats). Applications must use the vulnerable Sectors::get method.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution with the privileges of the application process, potentially leading to complete system compromise.

🟠

Likely Case

Application crash (denial of service) or memory corruption leading to data leakage or corruption.

🟢

If Mitigated

No impact if patched or if application doesn't process untrusted Excel files.

🌐 Internet-Facing: HIGH - Applications accepting Excel uploads from untrusted sources are directly exploitable.
🏢 Internal Only: MEDIUM - Internal applications processing Excel files could be exploited through phishing or compromised internal systems.

🎯 Exploit Status

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

Exploitation requires crafting a malicious Excel file. The vulnerability is in memory management during file parsing.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: calamine 0.17.0 or later

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

Restart Required: Yes

Instructions:

1. Update Cargo.toml to require calamine >= 0.17.0
2. Run 'cargo update' to fetch the patched version
3. Rebuild and redeploy your application
4. Restart any running instances

🔧 Temporary Workarounds

Input validation and sandboxing

all

Validate Excel files before processing and run parsing in isolated environments

🧯 If You Can't Patch

  • Disable Excel file processing functionality entirely
  • Implement strict file type validation and only accept Excel files from trusted sources

🔍 How to Verify

Check if Vulnerable:

Check Cargo.lock or run 'cargo tree | grep calamine' to see installed version

Check Version:

grep calamine Cargo.lock | head -1

Verify Fix Applied:

Verify calamine version is >= 0.17.0 in Cargo.lock after update

📡 Detection & Monitoring

Log Indicators:

  • Application crashes during Excel file parsing
  • Memory access violation errors
  • Unexpected process termination

Network Indicators:

  • Large or malformed Excel file uploads
  • Repeated upload attempts with similar file patterns

SIEM Query:

source="application_logs" AND ("segmentation fault" OR "memory corruption" OR "calamine") AND file_extension="xls*"

🔗 References

📤 Share & Export