CVE-2026-125116
Mongoose: Discriminator key values matching inherited properties (e.g. __t: 'constructor') bypass schema casting and can poison collections
Overview
Description
Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. Prior to 6.13.12, 7.8.13, 8.24.7, and 9.11.4, Mongoose uses attacker-controlled discriminator key values, including the default __t field, to index plain-object registries such as Model.discriminators and schema.discriminators without requiring an own property. Values such as constructor, toString, or hasOwnProperty can therefore resolve to inherited built-in functions instead of a registered discriminator, causing type confusion in model construction, document creation, hydration, query and update casting, embedded discriminators, and populate operations. In the bulkWrite() insertOne path with skipValidation enabled, a constructor value can cause a raw input object to be stored without schema casting or strict filtering, and a stored poisoned document can make every query that hydrates it fail until the document is removed. The weakness reads inherited properties but does not modify Object.prototype and is not prototype pollution. This issue is fixed in versions 6.13.12, 7.8.13, 8.24.7, and 9.11.4.
Source: OX vulnerability database
Severity
4.8 · MEDIUM
CVSS 3.1 base score, scored by NVD.
- Attack vector
- Network
- Attack complexity
- High
- Privileges required
- None
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- None
- Integrity
- Low
- Availability
- Low
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:L
Weakness: CWE-843
Affected packages · 3
| Ecosystem | Package | Vulnerable | Fixed in |
|---|---|---|---|
| npm | mongoose | <6.13.12>=7.0.0, <7.8.13>=8.0.0, <8.24.7>=9.0.0, <9.11.4 | 6.13.127.8.138.24.79.11.4 |
| Seal npm | @seal-security/mongoose | >=5.3.3-sp1, <5.3.3-sp999>=7.8.6-sp1, <7.8.6-sp999>=7.8.7-sp1, <7.8.7-sp999>=7.8.8-sp1, <7.8.8-sp999>=8.19.1-sp1, <8.19.1-sp999+7 more | 5.3.3-sp9997.8.6-sp9997.8.7-sp9997.8.8-sp9998.19.1-sp999 |
| Seal npm | mongoose | >=5.3.3-sp0, <5.3.3-sp999>=7.8.6-sp0, <7.8.6-sp999>=7.8.7-sp0, <7.8.7-sp999>=7.8.8-sp0, <7.8.8-sp999>=8.19.1-sp0, <8.19.1-sp999+7 more | 5.3.3-sp9997.8.6-sp9997.8.7-sp9997.8.8-sp9998.19.1-sp999 |
Open a package to see all its vulnerabilities.
Operating systems
No Linux distribution reports this ID.
References
- github.com https://github.com/Automattic/mongoose
- github.com https://github.com/Automattic/mongoose/commit/0ecd8040d9b446f36535d79938c130c800f91766
- github.com https://github.com/Automattic/mongoose/commit/18afab75bea861f625b7c5b54635c84567ec566c
- github.com https://github.com/Automattic/mongoose/commit/390453c8ce1b36b6cfd1e63432a910da1f3d81d5
- github.com https://github.com/Automattic/mongoose/commit/8cee51beead554df1f3d05645edb439c69eb2a9b
- github.com https://github.com/Automattic/mongoose/commit/b26c43554233134ea978c5852babe13be858b2cf
- github.com https://github.com/Automattic/mongoose/commit/b68f90734b50cd22c89a669c8ca1469d7234b296
- github.com https://github.com/Automattic/mongoose/releases/tag/6.13.12
- github.com https://github.com/Automattic/mongoose/releases/tag/7.8.13
- github.com https://github.com/Automattic/mongoose/releases/tag/8.24.7
OX Radar and Response Center
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.