npm
CVE-2026-125119
Mongoose: Connection-level sanitizeFilter not applied
- Severity
- High 7.5
- Published
- 10 Nov 2026
- Last changed
- 10 Nov 2026
- Added to UpHeron
- 23 Nov 2026
- Fixed in
- 6.13.12, 7.8.13, 8.24.7, 9.11.4
- Exploit chance
- 0.5% in the next 30 daysHigher than 46% of CVEs. EPSS by FIRST, 24 Nov 2026
- Weakness
- NoSQL injection (CWE-943)
- Attack
- Over the network · No login needed · No user action needed
- Attacker can
- Read data
- CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N- Also known as
- GHSA-gg4r-jv3p-qx3c
- Sources
- OSV.dev and GitHub
Description
sanitizeFilter exists to stop query selector injection: it wraps operator objects such as { $ne: null } in filter values in $eq, so they are matched literally. Set on a connection with mongoose.connect() or createConnection(uri, { sanitizeFilter: true }), the connection reports it as enabled but queries never apply it. An application that relies on the connection-level option and passes an attacker-controlled object into a filter therefore remains open to selector injection, and a password value of { $ne: null } returns the account record without the password.
NativeConnection#createClient() at lib/drivers/node-mongodb-native/connection.js:270-272 moves options.sanitizeFilter into Connection.config and deletes the original option. Query#_castConditions() at lib/query.js:2413-2423 checks Connection.options, the global options, and the per-query options, but never Connection.config. The defense therefore does not run even though Connection#get('sanitizeFilter') returns true.
Affected software
| Software | Affected versions |
|---|---|
mongoosenpm · osv:npm:mongoose |
|
About mongoose
- Weekly downloads (npm)
- 9,379,180npm, 24 Nov 2026
Vulnerabilities in mongoose
- In our list
- 5
- Published in the last 12 months
- 5
- Critical, last 12 months
- 1
- High, last 12 months
- 2
- Known exploited
- 0
- CVE-2026-125116Mongoose: Discriminator key values matching inherited properties (e.g. __t: 'constructor') bypass schema casting and can poison collectionsMedium 4.8 10 Nov 2026
- CVE-2026-125117Mongoose walks into inherited properties when hydrating, setting, and merging, allowing overwrites of built-in functions (denial of service) and shared schema stateHigh 8.2 10 Nov 2026
- CVE-2026-125118Mongoose: Prototype pollution via Schema.prototype.virtual()Medium 6.5 10 Nov 2026
- CVE-2026-125120Mongoose: sanitizeFilter not applied on countDocumentsCritical 9.8 10 Nov 2026
References
- CVE.org https://www.cve.org/CVERecord?id=CVE-2026-125119
- GitHub Advisory Database https://github.com/advisories/GHSA-gg4r-jv3p-qx3c