Access of Resource Using Incompatible Type ('Type Confusion') Affecting mongoose package, versions <6.13.12>=7.0.0 <7.8.13>=8.0.0 <8.24.7>=9.0.0 <9.11.4


Severity

Recommended
0.0
medium
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.34% (28th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Access of Resource Using Incompatible Type ('Type Confusion') vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-MONGOOSE-22409025
  • published11 Nov 2026
  • disclosed10 Nov 2026
  • creditUnknown

Introduced: 10 Nov 2026

NewCVE-2026-125116  (opens in a new tab)
CWE-843  (opens in a new tab)

How to fix?

Upgrade mongoose to version 6.13.12, 7.8.13, 8.24.7, 9.11.4 or higher.

Overview

mongoose is a Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment.

Affected versions of this package are vulnerable to Access of Resource Using Incompatible Type ('Type Confusion') via the discriminator key lookup in getDiscriminatorByKey and related code paths, when a user-controlled discriminator key value (e.g. __t: 'constructor') is used to index a plain-object discriminator registry (Model.discriminators[doc.__t]) without an own-property check. Because the registry is a plain object, inherited Object.prototype properties such as constructor, toString, and hasOwnProperty resolve to built-in functions instead of discriminator models. This causes a TypeError or returns a raw object where a Mongoose document is expected, crashing the affected request. Through bulkWrite() insertOne with skipValidation: true, the raw user object is stored without schema casting or strict filtering, and every subsequent query returning that document throws until it is manually removed from the database.

Note: The persistent denial of service and schema bypass require the application to call bulkWrite() with skipValidation: true on untrusted input.

CVSS Base Scores

version 4.0
version 3.1