CVE-2026-106437: Out-of-bounds read and write via undersized BSON buffer reservation in MongoDB C Driver
The BSON buffer-reservation API in the MongoDB C Driver can record a length smaller than the five-byte BSON minimum. Later append or comparison operations can underflow unsigned length calculations and read or write outside the document buffer. An actor who can influence the length supplied by an embedding application can cause the application to terminate or read or corrupt adjacent process memory. Reaching this issue requires the application to pass an undersized value to bsonreservebuffer and then perform an affected operation.
Affected Software
Event History
Frequently Asked Questions
Which applications are realistically exposed to this issue?
Applications embedding the MongoDB C Driver are exposed only if they call bson_reserve_buffer with a length smaller than the five-byte BSON minimum and subsequently perform an affected append or comparison operation. The issue is triggered by application use of the buffer-reservation API rather than by the description alone indicating all driver use is affected.
What must an attacker be able to do to exploit it?
An attacker must be able to influence the length that the embedding application passes to bson_reserve_buffer. Exploitation also depends on the application later invoking an affected append or comparison operation using that undersized reservation.
What can happen if the vulnerable path is reached?
Unsigned length calculations can underflow, causing reads or writes outside the BSON document buffer. This can terminate the application or expose or corrupt adjacent process memory.
What mitigation is available if patching cannot be performed immediately?
Ensure the application never passes a buffer length below the five-byte BSON minimum to bson_reserve_buffer. Review callers whose reservation length is derived from external or otherwise untrusted input, and prevent affected append or comparison operations from running after an undersized reservation.