Skip to content
FlawDB
Sign in

CVE-2026-125119

HIGH 7.5EPSS 47%

Mongoose: Connection-level sanitizeFilter not applied

Also known as GHSA-gg4r-jv3p-qx3c

Mitigation

  • Upgrade mongoose to one of 6.13.12, 7.8.13, 8.24.7, 9.11.4 (or later in the same release line).

Who should check

  • Projects that depend on npm package mongoose (>= 6.0.0, < 6.13.12)

Vulnerability facts

Affected
mongoose >= 6.0.0, < 6.13.12
Fixed in
6.13.12, 7.8.13, 8.24.7, 9.11.4
Exploited in the wild
Not in CISA KEV
Public exploit / PoC
None known
Remote exploitation
Remote, no login needed
CVSS
7.5 (v3.1, GitHub)CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:NOpen in CVSS calculator
Show all 8 CVSS metrics
  • Attack vector: Network
  • Attack complexity: Low
  • Privileges required: None
  • User interaction: None
  • Scope: Unchanged
  • Confidentiality impact: High
  • Integrity impact: None
  • Availability impact: None
EPSS
0.66% chance of exploitation in 30 days (percentile 47, 2026-11-28)
CWE
CWE-943
Published
Modified

Description

### Summary 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. ### Details `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. This storage was introduced in Mongoose 6.0.0 and the same mismatch is present in 9.11.2. ### Proof of concept ```javascript import mongoose from 'mongoose' const conn = await mongoose.createConnection('<MONGODB_URI>', { sanitizeFilter: true }).asPromise() const User = conn.model('User', new mongoose.Schema({ username: String, password: String, marker: String })) await User.create({ username: 'victim', password: 'correct-password', marker: 'PROTECTED_RECORD' }) const filter = { username: 'victim', password: { $ne: null } } console.log(conn.get('sanitizeFilter')) console.log((await User.findOne(filter).lean()).marker) ``` A control query with a literal wrong password returned no document in the same run, confirming the filter is otherwise enforced. ### Impact Connection-level `sanitizeFilter` option is not respected. Any user that relies on connection-level config and `sanitizeFilter` to defend against query selector injection is affected. Users that set `sanitizeFilter` globally using `mongoose.set('sanitizeFilter')` or on specific queries using `Model.find().sanitizeFilter()` are not affected.

Affected and fixed versions

Package / productAffectedFixedSource
npm mongoose>= 6.0.0, < 6.13.126.13.12, 7.8.13, 8.24.7, 9.11.4ghsa

Check your systems with an agent

Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.

Check whether anything I run is affected by CVE-2026-125119. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2026-125119.md
Affected: mongoose >= 6.0.0, < 6.13.12
Fixed in: 6.13.12, 7.8.13, 8.24.7, 9.11.4

Steps:
1. Search this machine and project for mongoose (npm): dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.

Technologies

References

FAQ

Is CVE-2026-125119 being exploited?

There is no confirmed exploitation: CVE-2026-125119 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.66% chance of exploitation in the next 30 days (as of 2026-11-28).

How serious is CVE-2026-125119?

High: CVSS 7.5 (v3.1, scored by GitHub). Remote, no login needed.

Which versions are affected by CVE-2026-125119?

mongoose >= 6.0.0, < 6.13.12.

Is there a fix for CVE-2026-125119?

Yes. Fixed in 6.13.12, 7.8.13, 8.24.7, 9.11.4. Upgrade mongoose to one of 6.13.12, 7.8.13, 8.24.7, 9.11.4 (or later in the same release line).

How do I check if I'm affected by CVE-2026-125119?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

See all
Vulnerabilities, newest first
SeverityIdentifier / vulnerabilityTechnologySignalsAge
MEDIUM 4.8CVE-2026-125116

Mongoose: Discriminator key values matching inherited properties (e.g. __t: 'constructor') bypass schema casting and can poison collections

npm packages
EPSS 37%
HIGH 8.2CVE-2026-125117

Mongoose walks into inherited properties when hydrating, setting, and merging, allowing overwrites of built-in functions (denial of service) and shared schema state

npm packages
EPSS 52%
MEDIUM 6.5CVE-2026-125118

Mongoose: Prototype pollution via Schema.prototype.virtual()

npm packages
EPSS 45%
CRITICAL 9.8CVE-2026-125120

Mongoose: sanitizeFilter not applied on countDocuments

npm packages
EPSS 59%
Sponsors