CVE-2026-125119: Mongoose: Connection-level sanitizeFilter not applied
Published 2026-11-10 · Updated 2026-11-27 · Also known as BIT-mongoose-2026-125119, GHSA-gg4r-jv3p-qx3c
Summary
Mongoose fails to apply the sanitizeFilter security option when configured at the connection level, leaving applications vulnerable to query selector injection. Engineering teams relying on this connection-level setting must update to the specified patched versions to ensure proper input sanitization.
Who is affected
Applications using Mongoose 6.0.0 through 9.11.3 are affected if they enable sanitizeFilter via mongoose.connect() or createConnection(). When active, this flaw allows attackers to inject MongoDB operators like $ne into filter values, potentially bypassing authentication or unauthorized data retrieval. Global configurations and query-level settings remain unaffected.
Exploitability
The vulnerability carries a high CVSS base score of 7.5, indicating it can be exploited remotely with low complexity and no required privileges. With an EPSS score of 0.007, the likelihood of exploitation is currently low, and it is not listed in the CISA Known Exploited Vulnerabilities catalog.
Remediation
- Upgrade npm package mongoose to version 6.13.12, 7.8.13, 8.24.7, or 9.11.4 or newer.
- Verify that the sanitizeFilter option is correctly applied after upgrading by testing query behavior with injected operators.
How to check your project
- Check package.json or lock files to determine if the installed mongoose version falls within the ranges 6.0.0-6.13.11, 7.0.0-7.8.12, 8.0.0-8.24.6, or 9.0.0-9.11.3.
- Search the codebase for usages of mongoose.connect() or createConnection() where the sanitizeFilter: true option is provided.
Automated analysis of the published advisory data, generated 2026-11-27. Not human-reviewed; verify against the official advisory. How this works.
Affected packages
| Ecosystem | Package | Affected versions | Fixed in | Upgrade |
|---|---|---|---|---|
| npm | mongoose |
>= 6.0.0, < 6.13.12 | 6.13.12 | npm install [email protected] |
| npm | mongoose |
>= 7.0.0, < 7.8.13 | 7.8.13 | npm install [email protected] |
| npm | mongoose |
>= 8.0.0, < 8.24.7 | 8.24.7 | npm install [email protected] |
| npm | mongoose |
>= 9.0.0, < 9.11.4 | 9.11.4 | npm install [email protected] |
CVSS 3.1 vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
| Attack vector | Network |
|---|---|
| Attack complexity | Low |
| Privileges required | None |
| User interaction | None |
| Scope | Unchanged |
| Confidentiality | High |
| Integrity | None |
| Availability | None |
FAQ
Are global configurations or query-level filters affected?
No. Users that set sanitizeFilter globally using mongoose.set('sanitizeFilter') or on individual queries using Model.find().sanitizeFilter() are not affected.
Is this vulnerability actively being exploited?
No, it is not currently listed in the CISA Known Exploited Vulnerabilities catalog.
What is the technical root cause of this failure?
The connection-level option is stored in Connection.config, but the Query#_castConditions logic only checks Connection.options, resulting in the security filter never being invoked.
Original advisory description
References
- WEB https://github.com/Automattic/mongoose/security/advisories/GHSA-gg4r-jv3p-qx3c
- ADVISORY https://nvd.nist.gov/vuln/detail/CVE-2026-125119
- WEB https://github.com/Automattic/mongoose/commit/4bb659478be2f30655a7bdd78bc251bdf111cd29
- WEB https://github.com/Automattic/mongoose/commit/4f4f9a79f860786a54133bee2c9af967ec691491
- WEB https://github.com/Automattic/mongoose/commit/83eda6af1489e9ef60bb8eee8cf9ee005771b9d5
- WEB https://github.com/Automattic/mongoose/commit/b8970c25998c23fbccd17f76c0398b902ff4911d
- PACKAGE https://github.com/Automattic/mongoose
- WEB https://github.com/Automattic/mongoose/releases/tag/6.13.12
- WEB https://github.com/Automattic/mongoose/releases/tag/7.8.13
- WEB https://github.com/Automattic/mongoose/releases/tag/8.24.7
- WEB https://github.com/Automattic/mongoose/releases/tag/9.11.4
Source records: GHSA-gg4r-jv3p-qx3c (OSV.dev) · EPSS by FIRST, 2026-11-27.