npm
CVE-2026-125116
Mongoose: Discriminator key values matching inherited properties (e.g. __t: 'constructor') bypass schema casting and can poison collections
- Severity
- Medium 4.8
- 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.5% in the next 30 daysHigher than 44% of CVEs. EPSS by FIRST, 24 Nov 2026
- Weakness
- CWE-843
- Attack
- Over the network · Only under certain conditions · No login needed · No user action needed
- Attacker can
- Change some data · Slow it down
- CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:L- Also known as
- GHSA-wr5m-5jph-8m96
- Sources
- OSV.dev and GitHub
Description
Mongoose chooses which discriminator model or schema to use by looking up the discriminator key value (t by default) in a plain object of registered discriminators, for example Model.discriminators[doc.t]. That value comes from user documents and query filters. Because the lookup did not check own properties, a value that names a property inherited from Object.prototype resolves to that inherited value instead of a discriminator. Examples are 'constructor', 'toString' and 'hasOwnProperty'.
- __t: 'constructor' resolves to the global Object function. Mongoose then calls new Object(doc), which returns the raw user object where a Mongoose document is expected.
- __t: 'toString' and similar names resolve to built-in functions that throw when used as a constructor or schema.
The most serious effect: through bulkWrite() insertOne with skipValidation: true, the raw user object is stored as-is, without schema casting or strict filtering.
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-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-125118Mongoose: Prototype pollution via Schema.prototype.virtual()Medium 6.5 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-125116
- GitHub Advisory Database https://github.com/advisories/GHSA-wr5m-5jph-8m96