All vulnerabilities

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.

From the GitHub Advisory Database, CC BY 4.0. Shortened; the full text is there.

Affected software

SoftwareAffected versions
mongoosenpm · osv:npm:mongoose
  • Every version before 6.13.12
  • From 7.0.0 before 7.8.13
  • From 8.0.0 before 8.24.7
  • From 9.0.0 before 9.11.4

About mongoose

Weekly downloads (npm)
9,379,180npm, 24 Nov 2026

References