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.
Written by anthropic/claude-haiku-5.5 from the sources below. Verify against them.
- Exploited
- No known exploitation
- Fix
- Fixed in 6.13.11, 7.8.12, 8.24.3, 9.9.2
- Who is exposed
- Not reported
Do first: Upgrade to a fixed version: 6.13.11, 7.8.12, 8.24.3, 9.9.2.
- Last modified
- A 0-100 score for how much a CVE matters across the industry: exploitation, exposure, how widely the software is used, severity and whether a fix exists.What do these mean? →
- 27/100 · provisional
- How many real-world setups can hit the bug, from the vendor's advisory and CISA data. It does not know your setup.What do these mean? →
- Unclear
- Whether working attack code is public (Exploit-DB, Metasploit, Nuclei or GitHub). Public code makes attacks easier.What do these mean? →
- None on Exploit-DB, Metasploit or GitHub
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.
Read the original 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.
cve.now Index
- Exploitation?/40Unknown. No CISA SSVC exploitation rating yet
- Exposure17/25No login or user action needed, reachable over the network without a login · Unknown: Advisories don't say whether default setups are affected
- Reach?/20Unknown. No tracked technology or package matched
- Severity9.8/10CVSS 9.8
- No patch0/5No signal
What would change the score
- Would score about 72 if added to CISA KEV
- Would score about 67 if CISA's SSVC rates exploitation active
- Would score about 32 if advisories confirm default setups are exposed
What to do
Upgrade to a fixed version: 6.13.11, 7.8.12, 8.24.3, 9.9.2.
Workaround: Add a pre-countDocuments middleware that calls mongoose.sanitizeFilter on the query filter
Timeline
- CVE published
- First seen by cve.now
- Posted on X by cve.now
Affected versions
- 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
Evidence 9
- Advisory
- Repository
- Repository
- Repository
- Repository
Show all 9 sourcesShow fewer sources
- Repository
- Repository
- Repository
- Repository
Corrections
None so far.
Something wrong on this page? Report an error. Every fix is listed here.
Questions about CVE-2026-125120
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: cve.now feed data
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: github.com
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: cve.now feed data
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: github.com
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: github.com