MEDIUMCVSS v3.1 4.8Vulnerability

CVE-2026-125116

### Summary 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. After that, every query that returns the stored document throws, until the document is removed from the database. ### Details The registries that hold discriminators are plain objects: `Model.discriminators`, `schema.discriminators`, and the embedded discriminator registries on document arrays and single nested subdocuments. Several code paths indexed them directly with a value taken from the document or filter: | Code path | Input | |---|---| | Model constructor (`new Model(doc)`) | document | | `Model.create()`, `insertMany()`, `bulkWrite()`, `bulkSave()` | documents | | Hydrating query results (`find()`, `findOne()`, etc.) and `Model.hydrate()` | stored documents | | Casting query filters, including flat paths such as `'events.__t'` and `$elemMatch` | query filter | | Casting updates and array filters | update filter, `arrayFilters` | | Document array `push()` / `create()`, document array and single nested casting | subdocuments | | Populate on embedded discriminators | stored subdocument

Properties

Summary
Mongoose: Discriminator key values matching inherited properties (e.g. __t: 'constructor') bypass schema casting and can poison collections
Severity
medium
Nvd fetched at
2026-11-10T23:33:48.924589+00:00
Epss score
0.00339
Cvss score
4.8
Cvss severity
MEDIUM
Retrieved at
2026-11-10T23:35:17+00:00
Ghsa published
2026-11-10T20:57:18Z
Source url
https://github.com/advisories/GHSA-wr5m-5jph-8m96
Ghsa updated
2026-11-10T20:57:19Z
Ghsa id
GHSA-wr5m-5jph-8m96
Last source
FIRST EPSS
Score
4.8
Cvss version
3.1
Cve id
CVE-2026-125116
Cvss vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:L
First seen by Signal
2026-11-10T03:20:43+00:00
Is ghsa only
false
Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:L
Published at
2026-11-09T23:17:21.907

Related Entities (3)

AFFECTS (1)

→[Software]npm/mongoose

HAS_WEAKNESS (1)

VULNERABLE_TO (1)

←[Software]npm/mongoose

Related research

Explore deeper with Ninja Signal's threat intelligence graph

CVE-2026-125116 (CVSS v3.1 4.8) — Ninja Signal Threat Intelligence | Ninja Signal