All vulnerabilities

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.

From the GitHub Advisory Database, CC BY 4.0. Shortened; the full text is there.

Affected software

SoftwareAffected versions
mongoosenpm · osv:npm:mongoose
  • From 6.0.0 before 6.13.12
  • From 7.0.0 before 7.8.13
  • From 8.0.0 before 8.24.7
  • From 9.0.0 before 9.11.4

About mongoose

Weekly downloads (npm)
9,379,180npm, 24 Nov 2026

References