npm
CVE-2026-125118
Mongoose: Prototype pollution via Schema.prototype.virtual()
- Severity
- Medium 6.5
- Published
- 10 Nov 2026
- Last changed
- 10 Nov 2026
- Added to UpHeron
- 23 Nov 2026
- Fixed in
- 6.13.12, 7.8.13, 8.24.7, 9.11.4
- Exploit chance
- 0.6% in the next 30 daysHigher than 49% of CVEs. EPSS by FIRST, 24 Nov 2026
- Weakness
- Prototype pollution (CWE-1321)
- Attack
- Over the network · No login needed · No user action needed
- Attacker can
- Change some data · Slow it down
- CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L- Also known as
- GHSA-6972-9mcm-vhwj
- Sources
- OSV.dev and GitHub
Description
Prototype pollution via Schema.prototype.virtual() — the 2022 fix for CVE-2022-2564 / CVE-2022-24304 protected Schema.path()/add() but never virtual(), so the same class of bug is still exploitable in all maintained release lines.
In lib/schema.js, Schema.prototype.virtual() (defined at line 2643) builds the virtual path via:
Unlike path()/add(), virtual() never received the specialProperties check added for CVE-2022-2564/CVE-2022-24304 (lib/schema.js lines 806, 1308, 1331).
A path containing proto/constructor/prototype segments resolves through the prototype chain and writes onto Object.prototype / Function.prototype.
Attacker-influenced schema field names (dynamic schemas, CMS form builders, schema-as-code) allow pollution of Object.prototype (own, enumerable keys visible on every object — e.g. ({}).isAdmin checks can be spoofed) and Function.prototype (a known gadget primitive in server-side JS).
Affected software
| Software | Affected versions |
|---|---|
mongoosenpm · osv:npm:mongoose |
|
About mongoose
- Weekly downloads (npm)
- 9,379,180npm, 24 Nov 2026
Vulnerabilities in mongoose
- In our list
- 5
- Published in the last 12 months
- 5
- Critical, last 12 months
- 1
- High, last 12 months
- 2
- Known exploited
- 0
- CVE-2026-125116Mongoose: Discriminator key values matching inherited properties (e.g. __t: 'constructor') bypass schema casting and can poison collectionsMedium 4.8 10 Nov 2026
- CVE-2026-125117Mongoose walks into inherited properties when hydrating, setting, and merging, allowing overwrites of built-in functions (denial of service) and shared schema stateHigh 8.2 10 Nov 2026
- CVE-2026-125119Mongoose: Connection-level sanitizeFilter not appliedHigh 7.5 10 Nov 2026
- CVE-2026-125120Mongoose: sanitizeFilter not applied on countDocumentsCritical 9.8 10 Nov 2026
References
- CVE.org https://www.cve.org/CVERecord?id=CVE-2026-125118
- GitHub Advisory Database https://github.com/advisories/GHSA-6972-9mcm-vhwj