CVE-2025-40906

9.8 CRITICAL

📋 TL;DR

CVE-2025-40906 affects BSON::XS versions 0.8.4 and earlier for Perl, which bundle a vulnerable libbson 1.1.7 library containing multiple critical vulnerabilities. This allows attackers to potentially execute arbitrary code, cause denial of service, or perform memory corruption attacks. Systems using the deprecated BSON::XS Perl module for MongoDB BSON serialization are affected.

💻 Affected Systems

Products:
  • BSON::XS Perl module
Versions: 0.8.4 and earlier
Operating Systems: All platforms running Perl with BSON::XS
Default Config Vulnerable: ⚠️ Yes
Notes: BSON::XS reached end of life in August 2020 and is no longer supported. Vulnerabilities come from bundled libbson 1.1.7.

⚠️ Manual Verification Required

This CVE does not have specific version information in our database, so automatic vulnerability detection cannot determine if your system is affected.

Why? The CVE database entry doesn't specify which versions are vulnerable (no version ranges provided by the vendor/NVD).

🔒 Custom verification scripts are available for registered users. Sign up free to download automated test scripts.

Recommended Actions:
  1. Review the CVE details at NVD
  2. Check vendor security advisories for your specific version
  3. Test if the vulnerability is exploitable in your environment
  4. Consider updating to the latest version as a precaution

⚠️ Risk & Real-World Impact

🔴

Worst Case

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

🟠

Likely Case

Denial of service crashes or memory corruption affecting application stability.

🟢

If Mitigated

Limited impact if proper network segmentation and least privilege controls are implemented.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

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

Multiple CVEs in bundled libbson increase attack surface. Some underlying vulnerabilities have known exploits.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: N/A

Vendor Advisory: https://www.mongodb.com/community/forums/t/mongodb-perl-driver-end-of-life/7890

Restart Required: Yes

Instructions:

1. Uninstall BSON::XS: 'cpanm --uninstall BSON::XS'
2. Migrate to MongoDB Perl driver v2.2.0+ which uses libbson 1.26.0+
3. Update all Perl applications to use the new driver
4. Restart affected services

🔧 Temporary Workarounds

Remove BSON::XS module

all

Uninstall the vulnerable BSON::XS module to eliminate the attack surface

cpanm --uninstall BSON::XS

Network isolation

all

Restrict network access to systems using BSON::XS

🧯 If You Can't Patch

  • Implement strict network segmentation to isolate affected systems
  • Deploy application-level firewalls to monitor and block suspicious BSON parsing

🔍 How to Verify

Check if Vulnerable:

Run: perl -MBSON::XS -e 'print $BSON::XS::VERSION'

Check Version:

perl -MBSON::XS -e 'print $BSON::XS::VERSION' 2>/dev/null || echo "Not installed"

Verify Fix Applied:

Check that BSON::XS is not installed: perl -MBSON::XS -e 'print "Vulnerable"' 2>/dev/null || echo "Not vulnerable"

📡 Detection & Monitoring

Log Indicators:

  • Application crashes related to BSON parsing
  • Memory corruption errors in system logs
  • Unexpected process terminations

Network Indicators:

  • Unusual BSON data patterns
  • Exploit kit traffic targeting MongoDB/BSON services

SIEM Query:

source="*bson*" OR source="*mongodb*" AND (event_type="crash" OR event_type="memory_error")

🔗 References

📤 Share & Export