CVE-2026-125120 — Vulnerability in mongoose — CVE Details
Mongoose: sanitizeFilter not applied on countDocuments
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.94%). Schedule for your next planned update.
Does your project use an affected mongoose version?
Paste your package-lock.json to check it for CVE-2026-125120 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
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.
^9.9.2^8.24.3^7.8.12^6.13.11
Workarounds
Middleware:
mongoose.plugin(function() {
schema.pre('countDocuments', function() {
// This will always apply `sanitizeFilter` on `countDocuments`
mongoose.sanitizeFilter(this.getFilter());
});
});
Advisory Timeline
- First published November 10, 2026 (16 days ago).
- Last revised November 10, 2026 — 0 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
npm install mongoose@8.24.3
npm install mongoose@6.13.11
npm install mongoose@7.8.12
npm install mongoose@9.9.2
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (4)
Affects 1 ecosystem: npm (1).
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-943
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 9.8 score means for each attack dimension.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
References
- https://github.com/Automattic/mongoose/security/advisories/GHSA-pcrw-h46h-c93hWEB
- https://nvd.nist.gov/vuln/detail/CVE-2026-125120ADVISORY
- https://github.com/Automattic/mongoose/commit/7e912af3fac52cb0eea4cd71e24d65318916831aWEB
- https://github.com/Automattic/mongoose/commit/8b10d5760bb181f5bf5d01495cde161c8aed0557WEB
- https://github.com/Automattic/mongoose/commit/b1df045aab076b740fdaec14a15a44c694b85b7dWEB
- https://github.com/Automattic/mongoose/commit/b5003d3915db1cf9209c38a4b93cf3a92cddd710WEB
- https://github.com/Automattic/mongoosePACKAGE
- https://github.com/Automattic/mongoose/releases/tag/6.13.11WEB
- https://github.com/Automattic/mongoose/releases/tag/7.8.12WEB
- https://github.com/Automattic/mongoose/releases/tag/8.24.3WEB
- https://github.com/Automattic/mongoose/releases/tag/9.9.2WEB
Frequently Asked Questions
- What is CVE-2026-125120?
- Mongoose: sanitizeFilter not applied on countDocuments. This vulnerability has been assigned a severity rating of CRITICAL (CVSS score: 9.8/10).
- How do I check if my project is affected by CVE-2026-125120?
- CVE-2026-125120 affects mongoose. It has a 0.9% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-125120 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Maximum impact if exploited, often with little effort or access required.
This is an above-median EPSS score — 59.2% of tracked vulnerabilities score at or below it, putting its exploitation likelihood in the upper half of the tracked corpus.
Also Known As
Related CVEs
- CVE-2026-76807CRITICAL
Todoist MCP Server: Browser DNS rebinding lets websites write and delete Todoist data through local MCP server
- CVE-2023-3696CRITICAL
Mongoose Prototype Pollution vulnerability
- CVE-2026-114516CRITICAL
Etherpad: Pre-auth arbitrary file read
- CVE-2025-23061CRITICAL
Mongoose search injection vulnerability
- CVE-2026-125117HIGH
Mongoose walks into inherited properties when hydrating, setting, and merging, allowing overwrites of built-in functions (denial of service) and shared schema state
- CVE-2024-53900HIGH
Mongoose search injection vulnerability