CVE-2026-118581

NoSQL injection via mismatched BSON size prefix in raw document splice to the wire protocol

Published Oct 28, 2026 CVSS 4.0 · 6.9 Medium EPSS < 1% KEV · Not listed
Description
A BSON encoding component of the MongoDB Java Driver does not verify that an externally supplied raw document's self-declared length agrees with the extent of the byte range it is given before that range is copied into an outgoing database command. An application that wraps untrusted raw bytes in such a document and uses it as part of a command can therefore emit a structurally inconsistent message, causing the database to interpret attacker-supplied trailing content as additional fields of the surrounding command. No authentication to the driver or database is required beyond the ability to influence those bytes through the victim application, and no user interaction is needed. The result is unintended modification of the command actually executed, which can alter the data read or written under the application's credentials.

Analysis

AI-generated

Technical impact

A vulnerability in the MongoDB Java Driver’s BSON encoder fails to confirm that the length claimed by a raw document matches the actual byte range supplied. When an application supplies untrusted raw BSON to the driver, the driver copies the data without verification and the database can interpret trailing bytes as new fields of a command. This causes commands to be altered without the user’s intent, allowing an attacker to read or write arbitrary data using the application’s credentials, and does not require authentication to the driver or database.

Affected Systems

The issue affects the MongoDB Java Driver; any application that incorporates this driver and accepts raw BSON input from untrusted sources is impacted. The driver has already released a patch in version 5.14.0, which can be seen from the provided release notes link.

Risk and Exploitability

The CVSS score of 6.9 indicates moderate severity. The EPSS score of 0.00192, which is below 1%, indicates a very low probability of exploitation. Because no authentication to the driver or database is required beyond the ability to influence the raw bytes, attacker interaction is minimal. The attack vector appears to be application‑side injection into the database command, making it potentially a low‑effort attack in a compromised or vulnerable application.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade the MongoDB Java Driver to version 5.14.0 or later, which includes the required BSON length validation.
  • Sanitize or validate any raw BSON data before passing it to the driver; avoid using untrusted byte streams as command components.
  • Conduct security testing against the driver’s handling of raw BSON to ensure no mis‑parsed fields are accepted by the database.

Generated by OpenCVE AI on October 30, 2026 at 02:10 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Mongodb
Mongodb java Driver
Vendors & Products Mongodb
Mongodb java Driver
Type Values Removed Values Added
Description A BSON encoding component of the MongoDB Java Driver does not verify that an externally supplied raw document's self-declared length agrees with the extent of the byte range it is given before that range is copied into an outgoing database command. An application that wraps untrusted raw bytes in such a document and uses it as part of a command can therefore emit a structurally inconsistent message, causing the database to interpret attacker-supplied trailing content as additional fields of the surrounding command. No authentication to the driver or database is required beyond the ability to influence those bytes through the victim application, and no user interaction is needed. The result is unintended modification of the command actually executed, which can alter the data read or written under the application's credentials.
Title NoSQL injection via mismatched BSON size prefix in raw document splice to the wire protocol
Weaknesses CWE-943
References
Metrics cvssV3_1

{'score': 6.5, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N'}

cvssV4_0

{'score': 6.9, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N'}

Weaknesses
  • CWE-130

    Improper Handling of Length Parameter Inconsistency

  • CWE-943

    Improper Neutralization of Special Elements in Data Query Logic

Sources

Status
PUBLISHED
Assigner
mongodb
Published
Updated
Nov 5, 2026, 5:06 PM
Reserved
Oct 28, 2026, 4:00 PM
Status
Awaiting Analysis
Published
Oct 28, 2026, 5:18 PM
Modified
Nov 5, 2026, 5:17 PM
Severity
Moderate
Public date
Oct 28, 2026, 4:51 PM