# Mongoose did not apply sanitizeFilter to countDocuments, allowing NoSQL query injection · pwn.watch > Mongoose's sanitizeFilter option was not applied to countDocuments(), so user input passed to it could inject MongoDB query operators (CVE-2026-125120). Fixes shipped on Aug 10 2026 in 6.13.11, 7.8.12, 8.24.3 and 9.9.2; the advisory was published on Nov 2 and reviewed by GitHub on Nov 10. Until you update, a global pre('countDocuments') plugin that runs mongoose.sanitizeFilter on the query filter works around it. Page: https://pwn.watch/i/mongoose-countdocuments-sanitizefilter-nosql-injection-cve-2026-125120 · generated 2026-12-05T19:43:08.985Z ## Status - Severity: critical · status: live · patch: patched - Product: Mongoose (Automattic/mongoose) countDocuments() - Started: 2026-08-10 - CVEs: CVE-2026-125120 - Affected: Releases before 6.13.11, 7.8.12, 8.24.3 and 9.9.2 on their branches - Fixed in: 6.13.11; 7.8.12; 8.24.3; 9.9.2 ## Follow this incident - RSS (one item per update): https://pwn.watch/i/mongoose-countdocuments-sanitizefilter-nosql-injection-cve-2026-125120/feed.xml - JSON Feed: https://pwn.watch/i/mongoose-countdocuments-sanitizefilter-nosql-injection-cve-2026-125120/feed.json - Full data (timeline, sources, posts, agentBrief): https://pwn.watch/i/mongoose-countdocuments-sanitizefilter-nosql-injection-cve-2026-125120.json - This file: https://pwn.watch/i/mongoose-countdocuments-sanitizefilter-nosql-injection-cve-2026-125120/llms.txt ## Updates (newest first) - 2026-11-10: GitHub reviews the advisory. (https://github.com/Automattic/mongoose/security/advisories/GHSA-pcrw-h46h-c93h) - 2026-11-02: The advisory GHSA-pcrw-h46h-c93h is published. (https://github.com/Automattic/mongoose/security/advisories/GHSA-pcrw-h46h-c93h) - 2026-08-10: Mongoose 6.13.11, 7.8.12, 8.24.3 and 9.9.2 ship the fix. (https://github.com/Automattic/mongoose/releases/tag/9.9.2) ## Fix brief # Security brief: Mongoose did not apply sanitizeFilter to countDocuments, allowing NoSQL query injection Source: https://pwn.watch/i/mongoose-countdocuments-sanitizefilter-nosql-injection-cve-2026-125120 · status: live · severity: critical · updated Dec 5, 2026, 19:33 UTC ## Patch status **PATCHED: fixed releases exist. Upgrade to a fixed version.** ## What it is Mongoose's sanitizeFilter option was not applied to countDocuments(), so user input passed to it could inject MongoDB query operators (CVE-2026-125120). Fixes shipped on Aug 10 2026 in 6.13.11, 7.8.12, 8.24.3 and 9.9.2; the advisory was published on Nov 2 and reviewed by GitHub on Nov 10. Until you update, a global pre('countDocuments') plugin that runs mongoose.sanitizeFilter on the query filter works around it. Severity detail: Rated critical; query injection through countDocuments() despite sanitizeFilter - Product: Mongoose (Automattic/mongoose) countDocuments() - CVE / advisory ids: CVE-2026-125120 ## Affected versions - Releases before 6.13.11, 7.8.12, 8.24.3 and 9.9.2 on their branches ## Check whether you're affected No generic command applies (the product is a hosted service, appliance or desktop app). Check the installed version in its admin UI / About screen and compare with the versions above. ## Fix Upgrade to one of these fixed versions (or later on the same branch): - 6.13.11 - 7.8.12 - 8.24.3 - 9.9.2 After upgrading, re-run the checks above and redeploy/restart the affected services. ## Specific notes Update mongoose to 9.9.2, 8.24.3, 7.8.12 or 6.13.11 (whichever matches your major) and redeploy. If you can't update yet, register a global plugin with a pre('countDocuments') hook that calls mongoose.sanitizeFilter(this.getFilter()). Then check other places where request input goes straight into a query filter. ## Latest updates - Nov 10, 2026: GitHub reviews the advisory. - Nov 2, 2026: The advisory GHSA-pcrw-h46h-c93h is published. - Aug 10, 2026: Mongoose 6.13.11, 7.8.12, 8.24.3 and 9.9.2 ship the fix. ## Advisories - [NVD: CVE-2026-125120](https://nvd.nist.gov/vuln/detail/CVE-2026-125120) (NVD) - [GHSA-pcrw-h46h-c93h: sanitizeFilter not applied to countDocuments](https://github.com/Automattic/mongoose/security/advisories/GHSA-pcrw-h46h-c93h) (GitHub) - [Mongoose 9.9.2 release](https://github.com/Automattic/mongoose/releases/tag/9.9.2) (Automattic/mongoose) ## Caveats Social posts mention four more flaws fixed in the same release, with PoCs; they are not covered by the listed advisory. --- Machine-readable: https://pwn.watch/i/mongoose-countdocuments-sanitizefilter-nosql-injection-cve-2026-125120.json · all incidents: https://pwn.watch/incidents.json. Verify against the vendor advisory before changing production systems.