Skip to content
NewCybercrime Report 2026 · Eight Chapters · A Post Is Not An Incident → Explore The ChaptersCybercrime Report 2026 → Explore

Mongoose sanitizeFilter Bypass on countDocuments (CVE-2026-125120)

CVE-2026-125120 is a gap in sanitizeFilter, the query-operator injection defense built into Mongoose, the object modeling tool for MongoDB and Node.js.

Published
Reading Time
3 min read
Dark glass security mesh screen with one unguarded gap and a mechanical counter beside it, coral-red neon lines, cover art for: Mongoose sanitizeFilter Bypass on countDocuments (CVE-2026-125120)

The maintainers say that defense was not applied to the countDocuments() method. GitHub, the CNA, scores it CVSS 3.1 9.8 Critical, and the maintainers fixed it in 6.13.11, 7.8.12, 8.24.3 and 9.9.2.

What it allows

CVE-2026-125120 is a gap in sanitizeFilter, Mongoose's own defense against query-operator injection. Mongoose is an object modeling tool that Node.js applications use to work with MongoDB.

The GitHub advisory says sanitizeFilter was not applied to the countDocuments() method in the affected releases. sanitizeFilter normally strips MongoDB query operators out of a filter object before it reaches the database, so a caller-supplied value is read as literal data rather than as query logic.

What the Flaw Lets an Attacker Do

The CVE record says an application that enables sanitizeFilter and passes attacker-controlled filter values to countDocuments() processes those values as query operators rather than literal values. The count that comes back can then include documents that should not match the intended filter.

The record adds that this can undermine authorization or application logic that depends on that count. One example is a check that uses a document count to decide whether a record exists or an action is allowed. We leave the filter values that trigger this behavior out of this page on purpose.

How the Score Reads

GitHub, the CNA, scores it CVSS 3.1 9.8 Critical, vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H. See our CVSS glossary entry for how to read that vector. NVD lists the same score from GitHub as a secondary source and shows the record's status as Received, meaning NVD has not yet published its own analysis. There is no CVSS 4.0 score in the record or NVD.

The CVE record assigns CWE-943, Improper Neutralization of Special Elements in Data Query Logic. The advisory's own GitHub page lists no CWE for the issue.

What the Advisory and CISA KEV Say

Neither the GitHub advisory nor the CVE record states whether the flaw has been exploited. As of CISA catalog version 2026.11.09, the CVE is not in our Known Exploited Vulnerabilities catalog.

The advisory also describes a workaround for applications that cannot upgrade immediately: a Mongoose middleware hook that runs sanitizeFilter on the countDocuments() filter before the query executes. See our vulnerability management guide for how to plan a rollout around a workaround like this.

Who is affected

The GitHub advisory and the CVE record give the same four affected ranges. Each range covers one major release line that was still supported when the fix shipped.

The advisory says patches exist for every supported major line, so an application upgrades within its current major version rather than across major versions. Mongoose is the standard object modeling layer for MongoDB in the Node.js ecosystem, so this fix reaches a large number of dependent applications at once.

GitHub credits koyokr as the reporter. The maintainer, vkarpov15, published the advisory, GHSA-pcrw-h46h-c93h, on 2 November 2026.

Timeline

  1. 2 Nov 2026

    The maintainer, vkarpov15, publishes the GitHub Security Advisory GHSA-pcrw-h46h-c93h, listing patched versions 6.13.11, 7.8.12, 8.24.3 and 9.9.2.

  2. 9 Nov 2026

    GitHub, acting as CNA, publishes the CVE record for CVE-2026-125120, and NVD publishes its entry the same day.

What to do

  1. Find Mongoose in Your Dependency Tree

    List every service that depends on mongoose, directly or through another package, and note which major version line each one runs.

  2. Upgrade to the Fixed Release for Your Line

    Move to 6.13.11, 7.8.12, 8.24.3 or 9.9.2, whichever matches the major version already in use, as the GitHub advisory lists.

  3. Apply the Middleware Workaround if You Cannot Upgrade Yet

    The advisory describes a Mongoose middleware hook that runs sanitizeFilter on the countDocuments() filter before the query executes, for teams that need more time.

  4. Check Where countDocuments() Reads Caller-Supplied Input

    We recommend reviewing code paths where a filter passed to countDocuments() comes from a request body, query string or other caller-supplied value, since that is the condition the CVE record describes.

  5. Review Logic That Depends on the Count

    We recommend checking whether any authorization or application decision relies on a countDocuments() result, since the CVE record says that logic can be undermined.

Frequently Asked Questions

Which Mongoose versions does CVE-2026-125120 affect?

The GitHub advisory lists versions before 6.13.11, 7.0.0 to 7.8.11, 8.0.0 to 8.24.2, and 9.0.0 to 9.9.1 as affected, one range per major release line.

Which Mongoose versions fix CVE-2026-125120?

6.13.11, 7.8.12, 8.24.3 and 9.9.2, per the GitHub advisory GHSA-pcrw-h46h-c93h.

Does an application need sanitizeFilter enabled to be exposed?

Yes. The CVE record describes the issue for applications that enable sanitizeFilter and pass attacker-controlled values to countDocuments().

Is there a fix for applications that cannot upgrade yet?

The advisory describes a middleware workaround that applies sanitizeFilter to the countDocuments() filter directly, for teams that need more time to upgrade.

Is CVE-2026-125120 in the CISA KEV catalog?

It is not in catalog version 2026.11.09. Neither the advisory nor the CVE record states whether the flaw has been exploited.

Sources

  1. GHSA-pcrw-h46h-c93h, sanitizeFilter not applied on countDocumentsAutomattic/mongoose on GitHub
  2. CVE-2026-125120 RecordCVE Program / GitHub CNA
  3. CVE-2026-125120NVD
  4. Known Exploited Vulnerabilities CatalogCISA
ShareLinkedInX
Brandefense logo

Stay Ahead of Digital Threats.

Take control of your digital security with an exclusive demo of our AI-driven threat intelligence platform.

Open The Full Demo Form →