CVE-2026-125116: Mongoose: Discriminator key values matching inherited properties (e.g. __t: 'constructor') bypass schema casting and can poison collections
Published 2026-11-10 · Updated 2026-11-27 · Also known as BIT-mongoose-2026-125116, GHSA-wr5m-5jph-8m96
Summary
Mongoose incorrectly looks up discriminator keys using direct property access instead of checking own properties, allowing inherited values like 'constructor' to bypass schema casting. All users of vulnerable Mongoose versions should upgrade to the respective fixed releases.
Who is affected
Deployments handling untrusted input for documents, queries, updates, or bulk operations are affected. An attacker who can control a discriminator key can cause request-level crashes, bypass schema validation via bulkWrite with skipValidation, or introduce persistent denial-of-service documents that break subsequent queries.
Exploitability
The vulnerability has a CVSS 3.1 base score of 4.8 (MEDIUM) with a vector of AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:L, indicating network accessibility with high complexity and no privileges required. The EPSS score is 0.005 and CISA KEV lists active exploitation as no.
Remediation
- Upgrade npm package mongoose to version 6.13.12, 7.8.13, 8.24.7, 9.11.4, or later.
- Ensure input validation and sanitization are applied to document properties and discriminator keys.
How to check your project
- Check package.json or lockfiles for mongoose versions introduced before 6.13.12, 7.8.13, 8.24.7, or 9.11.4.
- Review dependency tree scans for affected npm mongoose ranges.
Automated analysis of the published advisory data, generated 2026-11-27. Not human-reviewed; verify against the official advisory. How this works.
Affected packages
| Ecosystem | Package | Affected versions | Fixed in | Upgrade |
|---|---|---|---|---|
| npm | mongoose |
>= 0, < 6.13.12 | 6.13.12 | npm install [email protected] |
| npm | mongoose |
>= 7.0.0, < 7.8.13 | 7.8.13 | npm install [email protected] |
| npm | mongoose |
>= 8.0.0, < 8.24.7 | 8.24.7 | npm install [email protected] |
| npm | mongoose |
>= 9.0.0, < 9.11.4 | 9.11.4 | npm install [email protected] |
CVSS 3.1 vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:L
| Attack vector | Network |
|---|---|
| Attack complexity | High |
| Privileges required | None |
| User interaction | None |
| Scope | Unchanged |
| Confidentiality | None |
| Integrity | Low |
| Availability | Low |
FAQ
Is this vulnerability a prototype pollution vector?
No. The lookups only read inherited properties and do not write to Object.prototype or any other shared object.
What happens when __t is set to 'constructor'?
It resolves to the global Object function, causing Mongoose to treat the raw user object as a non-Mongoose document or throw errors during schema operations.
Does the schema bypass occur on all insert operations?
No. The schema bypass specifically requires the application to use bulkWrite() insertOne with skipValidation: true alongside untrusted input.
Original advisory description
References
- WEB https://github.com/Automattic/mongoose/security/advisories/GHSA-wr5m-5jph-8m96
- ADVISORY https://nvd.nist.gov/vuln/detail/CVE-2026-125116
- WEB https://github.com/Automattic/mongoose/commit/0ecd8040d9b446f36535d79938c130c800f91766
- WEB https://github.com/Automattic/mongoose/commit/18afab75bea861f625b7c5b54635c84567ec566c
- WEB https://github.com/Automattic/mongoose/commit/390453c8ce1b36b6cfd1e63432a910da1f3d81d5
- WEB https://github.com/Automattic/mongoose/commit/8cee51beead554df1f3d05645edb439c69eb2a9b
- WEB https://github.com/Automattic/mongoose/commit/b26c43554233134ea978c5852babe13be858b2cf
- WEB https://github.com/Automattic/mongoose/commit/b68f90734b50cd22c89a669c8ca1469d7234b296
- PACKAGE https://github.com/Automattic/mongoose
- WEB https://github.com/Automattic/mongoose/releases/tag/6.13.12
- WEB https://github.com/Automattic/mongoose/releases/tag/7.8.13
- WEB https://github.com/Automattic/mongoose/releases/tag/8.24.7
- WEB https://github.com/Automattic/mongoose/releases/tag/9.11.4
Source records: GHSA-wr5m-5jph-8m96 (OSV.dev) · EPSS by FIRST, 2026-11-27.