Mongoose did not apply sanitizeFilter to countDocuments, allowing NoSQL query injection
Mongoose (Automattic/mongoose) countDocuments()
Sponsored
Brought to you byTinkerer Club
The private club for people who own their servers, run their own AI, and pay $0/month for software.
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.
Why this severity: Rated critical; query injection through countDocuments() despite sanitizeFilter
- Started
- Aug 10, 2026
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
Timeline3
Advisories3
Notes & caveats
Social posts mention four more flaws fixed in the same release, with PoCs; they are not covered by the listed advisory.
Get an email when a new major security incident drops. No spam, unsubscribe any time.