CVE-2021-28027

9.8 CRITICAL

📋 TL;DR

This vulnerability in the bam crate for Rust allows integer underflow and out-of-bounds write during bgzip block loading. Attackers can exploit this to execute arbitrary code or cause denial of service. Any Rust application using vulnerable versions of the bam crate is affected.

💻 Affected Systems

Products:
  • Rust applications using bam crate
Versions: bam crate versions < 0.1.3
Operating Systems: All platforms running Rust
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications that process bgzip files using the vulnerable bam crate

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution leading to complete system compromise

🟠

Likely Case

Application crash or denial of service

🟢

If Mitigated

Limited impact with proper memory protections and sandboxing

🌐 Internet-Facing: HIGH - Exploitable remotely without authentication
🏢 Internal Only: MEDIUM - Requires processing malicious bgzip files

🎯 Exploit Status

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

Proof of concept available in advisory; exploitation requires processing malicious bgzip files

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: bam crate version 0.1.3 or later

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

Restart Required: Yes

Instructions:

1. Update Cargo.toml to require bam >= 0.1.3
2. Run 'cargo update' to fetch new version
3. Rebuild and redeploy application
4. Restart affected services

🔧 Temporary Workarounds

Disable bgzip processing

all

Temporarily disable functionality that processes bgzip files

Input validation

all

Implement strict validation of bgzip files before processing

🧯 If You Can't Patch

  • Isolate affected applications in network segments
  • Implement strict file upload controls and scanning for bgzip files

🔍 How to Verify

Check if Vulnerable:

Check Cargo.lock for bam crate version < 0.1.3

Check Version:

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

Verify Fix Applied:

Verify Cargo.lock shows bam crate version >= 0.1.3

📡 Detection & Monitoring

Log Indicators:

  • Application crashes with memory access violations
  • Unexpected process termination

Network Indicators:

  • Unusual file uploads with .bgz or .bgzip extensions

SIEM Query:

process:terminated AND (memory_access_violation OR segmentation_fault)

🔗 References

📤 Share & Export