CCSI
← CVE Security Watch

November 10, 2026 at 9:00 AM EST

Mongoose: critical sanitizeFilter bypass in countDocuments() and related flaws (CVE-2026-125120, CVE-2026-125117)

criticalhigh

Mongoose, the popular MongoDB ODM for Node.js, fixed a CVSS 9.8 sanitizeFilter bypass in countDocuments() plus several prototype-related and filter-sanitizing flaws. None are on CISA KEV; upgrading to 6.13.12, 7.8.13, 8.24.7 or 9.11.4 covers all of them.

Mongoose countDocuments() ignores sanitizeFilter (CVE-2026-125120)

  • What: countDocuments() does not apply the configured sanitizeFilter query-selector injection defense. An app that enables sanitizeFilter and passes attacker-controlled filter values to countDocuments() can have values like {"$ne": null} treated as MongoDB operators, inflating counts and potentially undermining authorization or logic built on that count (NVD, GHSA-pcrw-h46h-c93h).
  • Severity: Critical, CVSS 3.1 9.8 (GitHub CNA).
  • Exploited: Not on the CISA KEV catalog.
  • Fixed in: 6.13.11, 7.8.12, 8.24.3, 9.9.2.

Mongoose inherited-property writes (CVE-2026-125117) and related advisories

  • What: While hydrating documents, setting dotted paths and merging updates, Mongoose can walk into inherited properties, so keys like toString or valueOf can overwrite shared built-in functions, causing denial of service across unrelated models (NVD, GHSA-8332-j7wj-wjw4). The same release also fixes connection-level sanitizeFilter not being applied (CVE-2026-125119, high), discriminator keys that bypass schema casting (CVE-2026-125116, medium) and prototype pollution via Schema.prototype.virtual() (CVE-2026-125118, medium).
  • Severity: CVE-2026-125117 is High, CVSS 3.1 8.2.
  • Exploited: Not on the CISA KEV catalog.
  • Fixed in: 6.13.12, 7.8.13, 8.24.7, 9.11.4.

What to do

Upgrade mongoose to 6.13.12, 7.8.13, 8.24.7 or 9.11.4 or later (these cover every issue above), then rebuild and redeploy. Check lockfiles for transitive copies with npm ls mongoose or pnpm why mongoose. Until patched, don't pass raw request bodies or query strings into Mongoose filters, and cast or allow-list filter values explicitly rather than relying on sanitizeFilter alone.

General information only. Confirm fixed versions in the linked official advisories before patching.