# CVE-2026-125119: Mongoose: Connection-level sanitizeFilter not applied

- **Severity:** HIGH 7.5
- **CVSS:** 7.5 (v3.1, GitHub) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N`
- **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
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, no login needed
- **EPSS:** 0.66% (percentile 47, 2026-11-30)
- **CWE:** CWE-943
- **Aliases:** GHSA-gg4r-jv3p-qx3c
- **Published:** 2026-11-10T19:56:12.000Z
- **Modified:** 2026-11-10T19:56:12.000Z

## Who should check

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

## 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

- npm `mongoose`: affected \>= 6.0.0, \< 6.13.12; fixed 6.13.12, 7.8.13, 8.24.7, 9.11.4 (ghsa)

## Technologies

npm packages

## 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).

## Check your systems with an agent

Paste this into a coding agent:

```text
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.
```

## 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-30).

### 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.

## References

- vendor: <https://github.com/Automattic/mongoose/security/advisories/GHSA-gg4r-jv3p-qx3c>
- patch: <https://github.com/Automattic/mongoose/commit/4bb659478be2f30655a7bdd78bc251bdf111cd29>
- patch: <https://github.com/Automattic/mongoose/commit/4f4f9a79f860786a54133bee2c9af967ec691491>
- patch: <https://github.com/Automattic/mongoose/commit/83eda6af1489e9ef60bb8eee8cf9ee005771b9d5>
- patch: <https://github.com/Automattic/mongoose/commit/b8970c25998c23fbccd17f76c0398b902ff4911d>
- other: <https://nvd.nist.gov/vuln/detail/CVE-2026-125119>
- other: <https://github.com/Automattic/mongoose/releases/tag/6.13.12>
- other: <https://github.com/Automattic/mongoose/releases/tag/7.8.13>
- other: <https://github.com/Automattic/mongoose/releases/tag/8.24.7>
- other: <https://github.com/Automattic/mongoose/releases/tag/9.11.4>
- other: <https://github.com/advisories/GHSA-gg4r-jv3p-qx3c>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- GitHub Advisory Database: CC-BY 4.0 <https://github.com/advisories/GHSA-gg4r-jv3p-qx3c> (license: <https://creativecommons.org/licenses/by/4.0/>)
- FIRST EPSS: EPSS scores by FIRST <https://www.first.org/epss/>

HTML: <https://flawdb.com/CVE-2026-125119> · JSON: <https://flawdb.com/api/v1/entries/CVE-2026-125119>
