Skip to content
MongoDBGHSA-9w68-f89p-56c9

NoSQL injection in LINQ pipeline translation

Medium6.5CVE-2026-81527 · Published Aug 27, 2026

### Impact A NoSQL/expression injection weakness exists in the LINQ-to-aggregation query translation layer of the MongoDB C# Driver. When application-supplied values are embedded in certain query constructs, special elements contained within those values are not properly escaped before the resulting query is transmitted to the database, so portions of the value may be interpreted by the database as query logic rather than as data. An authenticated user of an application that incorporates untrusted values into affected queries may thereby cause unintended data to be returned or query results to be altered. ### Patches From driver version 3.11.1, application-supplied values in LINQ queries are escaped with `$literal` where the server would otherwise evaluate them, an explicit `$eq` is retained around values that would be read as query operators, and field names derived from application data that cannot be represented safely are rejected with an `ExpressionNotSupportedException`. ### Workarounds Never build document keys from untrusted data, and do not accept user-supplied strings starting with $ where they will be evaluated as part of an aggregation expression — projections, `Grou...

GitHub advisory

Affected versions

PackageAffectedFixed in
MongoDB.Driver
NuGet
>= 2.14.0, < 3.11.13.11.1
Details and references

### Impact A NoSQL/expression injection weakness exists in the LINQ-to-aggregation query translation layer of the MongoDB C# Driver. When application-supplied values are embedded in certain query constructs, special elements contained within those values are not properly escaped before the resulting query is transmitted to the database, so portions of the value may be interpreted by the database as query logic rather than as data. An authenticated user of an application that incorporates untrusted values into affected queries may thereby cause unintended data to be returned or query results to be altered. ### Patches From driver version 3.11.1, application-supplied values in LINQ queries are escaped with `$literal` where the server would otherwise evaluate them, an explicit `$eq` is retained around values that would be read as query operators, and field names derived from application data that cannot be represented safely are rejected with an `ExpressionNotSupportedException`. ### Workarounds Never build document keys from untrusted data, and do not accept user-supplied strings starting with $ where they will be evaluated as part of an aggregation expression — projections, `GroupBy` keys, `$expr` filters. This applies to expression filters passed to `UpdateMany` and `DeleteMany`. ### References [CSHARP-6178](https://jira.mongodb.org/browse/CSHARP-6178), [CSHARP-6156](https://jira.mongodb.org/browse/CSHARP-6156),[CSHARP-6185](https://jira.mongodb.org/browse/CSHARP-6185), [Fix](https://github.com/mongodb/mongo-csharp-driver/commit/230d4492e62915b6aa5e788cdcc38d0ab0ebd965), [CVE](https://www.cve.org/CVERecord?id=CVE-2026-81527)

CVSS 3.1
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N
Severity from
GitHub (reviewed advisory)
Weakness
CWE-943

More MongoDB advisories

All MongoDB

Critical advisories by email

Wednesdays: the week’s critical and high advisories in the AI and data stack, with the fixed versions. Only in weeks that have some.

Double opt-in. Unsubscribe any time.