CVE-2026-125120
Mongoose: sanitizeFilter not applied on countDocuments
Also known as GHSA-pcrw-h46h-c93h
Mitigation
- Upgrade mongoose to one of 6.13.11, 7.8.12, 8.24.3, 9.9.2 (or later in the same release line).
Who should check
- Projects that depend on npm package mongoose (< 6.13.11)
Vulnerability facts
- Affected
- mongoose < 6.13.11
- Fixed in
- 6.13.11, 7.8.12, 8.24.3, 9.9.2
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- None known
- Remote exploitation
- Remote, no login needed
- CVSS
- 9.8 (v3.1, GitHub)CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:HOpen 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: High
- Availability impact: High
- EPSS
- 0.94% chance of exploitation in 30 days (percentile 59, 2026-11-28)
- CWE
- CWE-943
- Modified
Description
### Impact `sanitizeFilter` is Mongoose's mechanism for protecting against query selector injection attacks. In older versions of Mongoose, `sanitizeFilter` was not applied for `countDocuments()` queries. ### Patches Patches have been released for all supported Mongoose major release lines. Please upgrade to the following versions depending on which major version of Mongoose applications are using. 1. `^9.9.2` 2. `^8.24.3` 3. `^7.8.12` 4. `^6.13.11` ### Workarounds Middleware: ```javascript mongoose.plugin(function() { schema.pre('countDocuments', function() { // This will always apply `sanitizeFilter` on `countDocuments` mongoose.sanitizeFilter(this.getFilter()); }); }); ```
Affected and fixed versions
| Package / product | Affected | Fixed | Source |
|---|---|---|---|
| npm mongoose | < 6.13.11 | 6.13.11, 7.8.12, 8.24.3, 9.9.2 | ghsa |
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-125120. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/CVE-2026-125120.md Affected: mongoose < 6.13.11 Fixed in: 6.13.11, 7.8.12, 8.24.3, 9.9.2 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
Patches
- https://github.com/Automattic/mongoose/commit/7e912af3fac52cb0eea4cd71e24d65318916831a
- https://github.com/Automattic/mongoose/commit/8b10d5760bb181f5bf5d01495cde161c8aed0557
- https://github.com/Automattic/mongoose/commit/b1df045aab076b740fdaec14a15a44c694b85b7d
- https://github.com/Automattic/mongoose/commit/b5003d3915db1cf9209c38a4b93cf3a92cddd710
Other
- https://nvd.nist.gov/vuln/detail/CVE-2026-125120
- https://github.com/Automattic/mongoose/releases/tag/6.13.11
- https://github.com/Automattic/mongoose/releases/tag/7.8.12
- https://github.com/Automattic/mongoose/releases/tag/8.24.3
- https://github.com/Automattic/mongoose/releases/tag/9.9.2
- https://github.com/advisories/GHSA-pcrw-h46h-c93h
FAQ
Is CVE-2026-125120 being exploited?
There is no confirmed exploitation: CVE-2026-125120 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.94% chance of exploitation in the next 30 days (as of 2026-11-28).
How serious is CVE-2026-125120?
Critical: CVSS 9.8 (v3.1, scored by GitHub). Remote, no login needed.
Which versions are affected by CVE-2026-125120?
mongoose < 6.13.11.
Is there a fix for CVE-2026-125120?
Yes. Fixed in 6.13.11, 7.8.12, 8.24.3, 9.9.2. Upgrade mongoose to one of 6.13.11, 7.8.12, 8.24.3, 9.9.2 (or later in the same release line).
How do I check if I'm affected by CVE-2026-125120?
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.
More mongoose vulnerabilities
See all| Severity | Identifier / vulnerability | Technology | Signals | Age |
|---|---|---|---|---|
| MEDIUM 4.8 | CVE-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.2 | CVE-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.5 | CVE-2026-125118 Mongoose: Prototype pollution via Schema.prototype.virtual() | npm packages | EPSS 45% | |
| HIGH 7.5 | CVE-2026-125119 Mongoose: Connection-level sanitizeFilter not applied | npm packages | EPSS 47% |