Skip to main content

Mongoose CVE-2026-125116

| EUVDEUVD-2026-120497 MEDIUM
Access of Resource Using Incompatible Type (Type Confusion) (CWE-843)
2026-11-09 GitHub_M GHSA-wr5m-5jph-8m96
4.8
CVSS 3.1 · Vendor: GitHub_M
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Submit document or filter with __t set to 'constructor'
  2. Exploit
    Inherited Object.prototype value resolves as a discriminator
  3. Execution
    Type confusion bypasses schema casting and strict filtering
  4. Impact
    Request crashes or unvalidated poison document persisted

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Type safety enforcement
MITRE ATT&CK

1 technique across 1 tactic: Execution

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires the application to pass attacker-controlled values into Mongoose's discriminator key (the default __t field, or a custom discriminatorKey) through document-construction, create/insertMany/bulkWrite, hydration, query/update/arrayFilter casting, embedded-discriminator array pushes, or populate - typically where req.body or req.query reaches these APIs on a schema that uses discriminators. The low-impact request-crash needs no special configuration. The high-impact outcomes are gated: the schema/strict bypass and the resulting persistent per-document query DoS require the application to explicitly call bulkWrite() insertOne with skipValidation:true on untrusted input (or for a poisoned document to be written via the raw MongoDB driver or another non-Mongoose writer). Limiting factors: only affects deployments on vulnerable versions (<6.13.12, 7.0.0-7.8.12, 8.0.0-8.24.6, 9.0.0-9.11.3) that both use discriminators and feed untrusted values into the discriminator key; the serious persistence path additionally requires the non-default skipValidation opt-in. Mitigation per the vendor is upgrading to a fixed release.

Impact

This is a moderate-severity type-confusion flaw (CWE-843) whose signals are internally consistent and point to a limited, mostly availability/integrity-oriented risk rather than a top-tier emergency. The input CVSS of 4.8 (AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:L) and the vuln.today 'this_month' decision label both describe a real but non-urgent issue. No KEV listing is present, so there is no confirmed active exploitation; no EPSS score was supplied, so widespread-exploitation probability cannot be quantified from this data. A public PoC does exist - the GHSA-wr5m-5jph-8m96 advisory embeds concrete JavaScript PoC snippets - but it is not flagged in the input as confirmed working weaponized exploit code, and PoC availability must not be conflated with active exploitation. The AC:H rating is justified by the advisory's own framing: the trivial outcome (crashing a single request with __t:'constructor') is easy, but the more damaging outcomes - schema/strict bypass and a persistent query-breaking 'poison' document - require the application to opt into bulkWrite({skipValidation:true}) on untrusted input, a condition outside the attacker's control. Net: a genuine priority for teams running the affected versions with user-controlled document/filter input, but not a drop-everything network RCE; confidentiality impact is absent per the vector, and the headline persistent-DoS impact is config-gated.

Exploit ScenarioDerived

An attacker submits a document or query filter whose discriminator key (default __t) is set to an inherited Object.prototype property name such as 'constructor', 'toString', or 'hasOwnProperty' (e.g. via Model.create(req.body), new Model(req.body), or a req.query-driven find filter). The lookup resolves to a built-in function instead of a registered discriminator, so 'constructor' makes Mongoose call new Object(doc) and return a raw non-document object, while names like 'toString' throw - crashing that request. Where the application calls bulkWrite() insertOne with skipValidation:true on that input, the raw object is stored uncast, and the poisoned document then makes every query that hydrates it throw for all users until it is deleted directly in the database; the GHSA advisory includes working PoC code for both paths.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.3% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Nov 09, 2026

Type confusion in Mongoose's discriminator lookups allows remote unauthenticated attackers to make attacker-controlled discriminator key values such as 'constructor', 'toString' or 'hasOwnProperty' resolve to inherited built-in functions instead of registered discriminators, breaking model construction, document creation, query/update casting, hydration, embedded discriminators and populate. Only deployments on versions before 6.13.12, 7.8.13, 8.24.7 and 9.11.4 that both use discriminators and pass untrusted values (for example req.body or req.query) into the discriminator key are reachable; most outcomes are limited to a TypeError that crashes the individual request, while the more serious schema/strict bypass and persistent per-document query denial-of-service additionally require bulkWrite() insertOne with skipValidation:true or a write from a non-Mongoose writer. A public proof-of-concept reference is included in the upstream advisory but is not verified as working exploit code, no CISA KEV entry or EPSS signal was supplied, and the vendor has released fixed versions.

RemediationAI

Vendor-released patch: upgrade to mongoose 6.13.12, 7.8.13, 8.24.7 or 9.11.4 (npm ranges ^6.13.12, ^7.8.13, ^8.24.7, ^9.11.4) as documented in the advisory at https://github.com/Automattic/mongoose/security/advisories/GHSA-wr5m-5jph-8m96 and the corresponding release tags; the commits (for example https://github.com/Automattic/mongoose/commit/0ecd8040d9b446f36535d79938c130c800f91766) show the fix replacing direct registry indexing with an own-property-safe getDiscriminatorByKey() lookup across casting, hydration, populate and model construction. The advisory describes upgrading as the vendor fix and notes that the highest-impact outcome - storage of a raw, uncast document that then makes every query hydrating it throw until it is deleted from the database - depends on the application opting in to bulkWrite() insertOne with skipValidation:true on untrusted input, so removing that combination and ensuring poisoned documents are not written by the raw MongoDB driver or other non-Mongoose writers limits exposure for code that cannot be upgraded immediately, at the cost of losing the skipValidation fast path for trusted bulk loads. Applications on unfixed versions that cannot upgrade ahead of the released patches should also expect per-request TypeErrors wherever req.body or req.query flows into discriminator-bearing model construction, create, query filters, arrayFilters, embedded-discriminator pushes or populate.

Affected VersionsENISA

Mongoose < 6.13.12
Mongoose 8.0.0, < 8.24.7
Mongoose 9.0.0, < 9.11.4
Mongoose 7.0.0, < 7.8.13

Affected Packages

npm mongoose fix: 6.13.12, 7.8.13, 8.24.7, 9.11.4

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in npm

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Mongoose stores discriminator models and schemas in plain JavaScript objects - Model.discriminators, schema.discriminators, and the embedded discriminator registries on document arrays and single nested subdocuments - and previously indexed them directly with a value taken from a user document or filter (Model.discriminators[doc.__t]). Because those registries are ordinary objects, they inherit from Object.prototype, so a discriminator key naming an inherited member resolves to a built-in function rather than a registered discriminator. With __t: 'constructor' the resolved value is the global Object function and Mongoose returns the raw user object where a Mongoose Document is expected; names such as 'toString' resolve to built-ins that throw when used as a constructor or schema. This is CWE-843 type confusion: the lookup reads inherited properties only and never writes to Object.prototype, so it is explicitly not prototype pollution and does not alter shared in-memory state across requests. The affected paths are the model constructor (new Model(doc)), Model.create/insertMany/bulkWrite/bulkSave, hydration of query results and Model.hydrate(), casting of query filters including flat 'events.__t' and $elemMatch forms, casting of updates and arrayFilters, document array push()/create() and single nested casting, and populate on embedded discriminators. The safe helper getDiscriminatorByValue() already iterated own keys, but callers attempted the direct lookup first and only fell back afterwards, so any truthy inherited value took precedence. The upstream fix introduces getDiscriminatorByKey(), which gates every lookup on Object.prototype.hasOwnProperty.call(discriminators, key), and wires it into lib/cast.js, getConstructor, getEmbeddedDiscriminatorPath, getModelsMapForPopulate, castArrayFilters, Model.create and Model.compile.

Know when Mongoose gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (GitHub_M) PRIMARY 4.8 MEDIUM
AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:L
vuln.today AI 4.8 MEDIUM

No auth needed to supply the value (PR:N), but the integrity bypass and persistent-DoS impacts depend on the non-default skipValidation option (AC:H); type confusion yields low integrity and availability impact, no confidentiality.

3.1 AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:L
4.0 AV:N/AC:H/AT:N/PR:N/UI:N/VC:N/VI:L/VA:L/SC:N/SI:N/SA:N

Primary rating from Vendor (GitHub_M).

CVSS VectorVendor: GitHub_M

Attack Vector
Network
Attack Complexity
High
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
Low
Availability
Low

Lifecycle Timeline

2
Patch available
Nov 09, 2026 - 23:18 EUVD
CVE Published
Nov 09, 2026 - 22:20 cve.org
MEDIUM 4.8

DescriptionCVE.org

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.

Blast Radius

ecosystem impact
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 2 npm packages depend on mongoose (2 direct, 0 indirect)

Ecosystem-wide dependent count for version 7.0.0.

Threat Intelligence Overview

EPSS Score
0.3%
Top 72% exploitable
Prevalence
High
most widely used MongoDB ODM for Node.js, millions of weekly npm downloads
Threat Intel
1
1 source
Social Media
1
Sightings
Data Quality
5 sources
Confidence: Medium

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.3%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
No
Human Impact· derived
High

Priority Score

24
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +24
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.

CVE-2025-23061 CRITICAL POC
9.0 Jan 15

Mongoose ODM for Node.js before version 8.9.5 contains a search injection vulnerability when using $where filters with p

CVE-2017-2894 CRITICAL POC
9.8 Nov 07

An exploitable stack buffer overflow vulnerability exists in the MQTT packet parsing functionality of Cesanta Mongoose 6

CVE-2017-2891 CRITICAL POC
9.8 Nov 07

An exploitable use-after-free vulnerability exists in the HTTP server implementation of Cesanta Mongoose 6.8. Rated crit

CVE-2017-2922 CRITICAL POC
9.8 Nov 07

An exploitable memory corruption vulnerability exists in the Websocket protocol implementation of Cesanta Mongoose 6.8.

CVE-2017-2921 CRITICAL POC
9.8 Nov 07

An exploitable memory corruption vulnerability exists in the Websocket protocol implementation of Cesanta Mongoose 6.8.

CVE-2023-3696 CRITICAL POC
9.8 Jul 17

Prototype Pollution in GitHub repository automattic/mongoose prior to 7.3.4. Rated critical severity (CVSS 9.8), this vu

CVE-2022-2564 CRITICAL POC
9.8 Jul 28

Prototype Pollution in GitHub repository automattic/mongoose prior to 6.4.6. Rated critical severity (CVSS 9.8), this vu

CVE-2019-19307 CRITICAL POC
9.8 Nov 26

An integer overflow in parse_mqtt in mongoose.c in Cesanta Mongoose 6.16 allows an attacker to achieve remote DoS (infin

CVE-2024-53900 CRITICAL POC
9.1 Dec 02

Mongoose before 8.8.3 can improperly use $where in match, leading to search injection. Rated critical severity (CVSS 9.1

CVE-2021-26530 CRITICAL POC
9.1 Feb 08

The mg_tls_init function in Cesanta Mongoose HTTPS server 7.0 (compiled with OpenSSL support) is vulnerable to remote OO

CVE-2021-26529 CRITICAL POC
9.1 Feb 08

The mg_tls_init function in Cesanta Mongoose HTTPS server 7.0 and 6.7-6.18 (compiled with mbedTLS support) is vulnerable

CVE-2021-26528 CRITICAL POC
9.1 Feb 08

The mg_http_serve_file function in Cesanta Mongoose HTTP server 7.0 is vulnerable to remote OOB write attack via connect

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy