CVE-2021-45714

7.5 HIGH

📋 TL;DR

This vulnerability in the rusqlite Rust crate involves a use-after-free bug in the create_aggregate_function method. Attackers could exploit this to execute arbitrary code or cause denial of service. Applications using vulnerable versions of rusqlite for SQLite database operations are affected.

💻 Affected Systems

Products:
  • rusqlite Rust crate
Versions: 0.25.x before 0.25.4, 0.26.x before 0.26.2
Operating Systems: All operating systems where Rust applications using rusqlite run
Default Config Vulnerable: ⚠️ Yes
Notes: Any Rust application using the vulnerable create_aggregate_function method is affected regardless of configuration.

📦 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 causing denial of service, potentially with memory corruption that could be leveraged for further exploitation.

🟢

If Mitigated

Application instability or crashes without privilege escalation if proper sandboxing and memory protections are in place.

🌐 Internet-Facing: MEDIUM
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires the attacker to trigger the vulnerable create_aggregate_function method, which typically requires some level of application interaction.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 0.25.4 or 0.26.2

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

Restart Required: Yes

Instructions:

1. Update Cargo.toml to specify rusqlite >=0.25.4 or >=0.26.2. 2. Run 'cargo update' to fetch the patched version. 3. Rebuild and redeploy your application.

🔧 Temporary Workarounds

Avoid create_aggregate_function

all

Temporarily stop using the vulnerable create_aggregate_function method until patched.

🧯 If You Can't Patch

  • Implement strict input validation and sanitization for all SQLite queries
  • Deploy application in sandboxed environments with memory protection features enabled

🔍 How to Verify

Check if Vulnerable:

Check Cargo.lock for rusqlite version: grep -A2 -B2 rusqlite Cargo.lock

Check Version:

grep rusqlite Cargo.lock | head -1

Verify Fix Applied:

Verify rusqlite version in Cargo.lock is >=0.25.4 or >=0.26.2

📡 Detection & Monitoring

Log Indicators:

  • Application crashes with memory access violations
  • Unexpected process termination

Network Indicators:

  • Unusual database query patterns if SQLite is network-accessible

SIEM Query:

Process termination events from Rust applications using rusqlite

🔗 References

📤 Share & Export