What happened#
Mongoose is the widely used MongoDB object-modelling library for Node.js. The advisories were published by the maintainer on GitHub on 2 November 2026, added to the NVD on 9 November, and to GitHub’s advisory database on 10 November, which is why they are showing up now. Three researchers are credited: koyokr for the two sanitizeFilter issues, Linus-Shyu for the virtual() one and Fcmam5 for the discriminator one. The inherited-properties advisory names no finder.
sanitizeFilter is a Mongoose option meant to stop “query selector injection”, where user-supplied input that is really an object of MongoDB operators changes what a query matches. Three of the five advisories are about places where that protection, or the object model underneath it, did not do what developers would expect.
The five advisories#
| Issue | ID | Severity | Fixed in |
|---|---|---|---|
| sanitizeFilter not applied on countDocuments() | CVE-2026-125120 | Critical, 9.8 | 6.13.11, 7.8.12, 8.24.3, 9.9.2 |
| Connection-level sanitizeFilter not applied | CVE-2026-125119 | High, 7.5 | 6.13.12, 7.8.13, 8.24.7, 9.11.4 |
| Inherited properties walked when hydrating, setting and merging (denial of service, shared schema state) | CVE-2026-125117 | High, 8.2 | 6.13.12, 7.8.13, 8.24.7, 9.11.4 |
| Prototype pollution via Schema.prototype.virtual() | CVE-2026-125118 | Moderate, 6.5 | 6.13.12, 7.8.13, 8.24.7, 9.11.4 |
| Discriminator key values that match inherited properties | CVE-2026-125116 | Moderate, 4.8 | 6.13.12, 7.8.13, 8.24.7, 9.11.4 |
In plain terms, per the advisories:
- countDocuments (Critical).
sanitizeFilterprotects against selector injection, but older versions did not apply it tocountDocuments()queries. The advisory’s vector is network-reachable, no privileges, no user interaction. - Connection-level option (High). If you set
sanitizeFilter: trueon the connection (inmongoose.connect()orcreateConnection()), the connection reports it as enabled, but queries do not apply it. The advisory says this has been the case since 6.0.0 and was still present in 9.11.2. It says setting it globally withmongoose.set()or per query with.sanitizeFilter()is not affected. - Inherited properties (High). Three code paths wrote into inherited properties without checking they were the object’s own. The advisory says a crafted key such as
toStringcan break every later query in the process until restart, including queries on unrelated models, and that onstrict: falsesubdocuments an attacker who controls the path passed todoc.set()could change shared schema state, such as removing arequiredvalidator for all documents. - Schema.virtual() (Moderate). Fixes from 2022 covered
Schema.path()andadd()but notvirtual(). The advisory says the risk is highest where field names are attacker-influenced, such as dynamic schemas or CMS form builders. - Discriminator keys (Moderate). Values like
constructorin the discriminator key resolve to inherited members. The advisory says this can make requests fail or let a raw document be stored without casting (withbulkWrite()andskipValidation: true), and that queries returning that document then fail until it is deleted in the database. It says this does not allow modifying shared state.
Am I affected?#
All five share the same affected ranges as far as the pages I read show: below 6.13.12, 7.0.0 to below 7.8.13, 8.0.0 to below 8.24.7, and 9.0.0 to below 9.11.4. The Critical advisory’s own ranges are slightly older (below 6.13.11, 7.8.12, 8.24.3 and 9.9.2), because that fix shipped first.
- You use Mongoose at all: check your version. Anything below the versions above is in range for at least some of these.
- You build query filters from request data: look for
sanitizeFilterin your code. If you relied on it, check where you set it. The connection-level form was not applied on any version before the patches. - You call countDocuments() with user-influenced filters: the Critical advisory is about exactly that call.
- Users can influence schema field names or the names of fields in stored documents: the three object-model advisories matter most there. The advisories do not say a typical app with fixed schemas is exposed to the prototype-pollution one.
What to do now#
- Find your version in every project, including monorepo packages and anything that pulls Mongoose in indirectly.
- Upgrade to the newest release on your major line. On the registry’s tags at the time I checked, that is 6.13.12 (6.x), 7.8.13 (7.x), 8.24.8 (8.x) and 9.12.1 (9.x). All are at or above the patched versions listed above.
- Check how you use
sanitizeFilter. If it is set on the connection, also set it globally or per query until you have upgraded and tested. Those two forms are the ones the advisory says are unaffected. - If you cannot upgrade a Critical-affected version yet, the advisory gives a workaround: a plugin that adds a
pre("countDocuments")hook callingmongoose.sanitizeFilter(this.getFilter()). It notes its snippet is a rough sketch that needs adapting, so test it before relying on it. - Validate input at the edge too. Do not depend on one Mongoose option as the only guard: check that values you expect to be strings are strings before they reach a query.
# Which Mongoose versions are installed (direct and indirect)?
npm ls mongoose
# Upgrade within your current major line, for example:
npm install mongoose@^9.12.1 # 9.x
npm install mongoose@^8.24.8 # 8.x
# Find where sanitizeFilter is configured in your code
grep -rn "sanitizeFilter" src/ app/ lib/ 2>/dev/nullMongoose 9 may have changes that affect your app, so read its release notes before a major jump, and test after any upgrade.
How I checked this site#
This site is a Next.js project on Vercel. I searched its package.json and package-lock.json for mongoose and found no match, so it does not use Mongoose. That covers this repository only.
What the sources don’t say#
- Whether anyone has exploited any of these. The pages I read do not claim exploitation. The Critical advisory shows an EPSS score of 0.566%, which is a probability estimate, not evidence.
- Why the Critical fix (August 2026 releases, per the registry) was disclosed on 2 November. The advisories do not explain the gap, and I will not guess.
- How many real apps are exposed. That depends on whether they use
sanitizeFilterand what reachescountDocuments(). - I did not read independent coverage. My second source is the npm registry, for versions and release dates.
My take#
My own opinion, not from the advisories.
The lesson I take from the sanitizeFilter pair is that a safety option you set once and trust is only as good as its test. A connection that reports the option as enabled while queries ignore it is a quiet failure. If your app depends on a guard like this, write one test that sends an operator object where a string should be and confirm it is rejected, on every query path you care about, including counts.
Sources#
- GitHub Advisory Database: GHSA-pcrw-h46h-c93h / CVE-2026-125120 (countDocuments), primary source
- GHSA-gg4r-jv3p-qx3c / CVE-2026-125119 (connection-level sanitizeFilter)
- GHSA-8332-j7wj-wjw4 / CVE-2026-125117 (inherited properties)
- GHSA-6972-9mcm-vhwj / CVE-2026-125118 (Schema.prototype.virtual)
- GHSA-wr5m-5jph-8m96 / CVE-2026-125116 (discriminator keys)
- npm: mongoose package metadata (patched version numbers, release dates and current tags)
Keep reading
7 min read
Hono advisories, November 2026 (CVE-2026-126355 to 126359 and more): what to upgrade to, and how to check your middleware
Hono 4.13.16 fixes five advisories: mount() and RegExpRouter middleware bypasses, a csrf() gap and a form validator skip. Plus two @hono/node-server fixes. What to check.
8 min read
Nuxt 4.6.4 security release: eight advisories, including two route-rule and middleware bypasses. What to upgrade to, and how to check your app
Nuxt 4.6.4 fixes eight advisories: a leading // and an encoded %2F that can skip middleware and route rules, a dev-server file read, leaked error details and more.