CVE-2026-118581: MongoDB Java Driver BSON document length validation bypass

CVE-2026-118581 · Severity: medium · CVSS 6.5 · Published 2026-10-28

The MongoDB Java Driver fails to validate that a raw BSON document's declared size matches its actual byte content before copying it into database commands. An attacker who can inject untrusted bytes through an application can craft malformed documents that cause the database to misinterpret trailing content as additional command fields, leading to unintended data modification under the application's credentials without requiring authentication or user interaction.

Technologies: MongoDB Java Driver. Vendors: MongoDB.

Quick answers

Is CVE-2026-118581 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-118581 being exploited in the wild.
How severe is CVE-2026-118581?
Medium severity, with a CVSS score of 6.5, published 28 October 2026.
Which products and versions are affected?
MongoDB Java Driver before 5.14.0.
Is there a fix for CVE-2026-118581?
Yes: fixed in 5.14.0. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-118581 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2026-118581?
Check whether you run MongoDB Java Driver at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • Fixed in: 5.14.0

Technical details

The vulnerability exists in the BSON encoding component (BsonBinaryWriter) which does not verify that an externally supplied raw document's self-declared length agrees with the byte range provided. When a RawBsonDocument wrapping untrusted bytes is used in a command, the size mismatch allows attacker-controlled trailing content to be interpreted as additional fields by the database, resulting in command injection. This is a logic bug in size validation with network-based attack vector that requires only the ability to influence the bytes within the victim application.

Affected products

  • MongoDB Java Driver before 5.14.0

Timeline

  • 2026-10-28: disclosed
  • 2026-10-28: patched

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.