GHSA-5chr-phc4-wcj2: NoSQL command injection via mismatched raw BSON length prefix written verbatim to the wire
A data-validation flaw exists in the BSON handling and binary serialization path of the MongoDB C# Driver. When an application constructs a raw or lazy BSON document object from externally supplied binary data, the driver does not verify that the size quantity declared inside that data matches the amount of data actually provided, and it copies the data onto the wire unchanged. An unauthenticated party who can supply binary content to such an application can thereby cause additional elements to be inserted into, or existing elements to be removed from, the database command the application issues, without needing any database credentials of their own. This can result in unauthorized modification of stored data and disclosure of data outside the intended scope of the application's request, bounded by the database privileges the application itself holds.
Affected Software
Event History
Frequently Asked Questions
Which applications are exposed to this issue?
Applications using the MongoDB C# Driver are exposed only when they construct a raw or lazy BSON document from externally supplied binary data. The issue is reachable by an unauthenticated party able to provide that binary content to the application.
Does an attacker need MongoDB credentials or direct database access?
No. Exploitation does not require database credentials; the attacker needs a path to supply crafted binary BSON data that the application turns into a raw or lazy BSON document. The resulting database action is limited by the privileges of the application's own database identity.
Are default driver configurations affected?
The available information does not identify a default configuration as affected. Exposure depends on the application using externally supplied binary data to construct raw or lazy BSON documents.
What could indicate that an application has been affected?
Potential indicators include database commands whose inserted or removed elements differ from the application's intended request, along with unauthorized data changes or data returned outside the expected request scope. Review code paths that accept binary input and pass it into raw or lazy BSON document construction.