Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessSubmit document or filter with __t set to 'constructor'
-
ExploitInherited Object.prototype value resolves as a discriminator
-
ExecutionType confusion bypasses schema casting and strict filtering
-
ImpactRequest 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. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – 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
Affected Packages
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
AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:L
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.
Primary rating from Vendor (GitHub_M).
CVSS VectorVendor: GitHub_M
Lifecycle Timeline
2DescriptionCVE.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- 2 npm packages depend on mongoose (2 direct, 0 indirect)
Ecosystem-wide dependent count for version 7.0.0.
Threat Intelligence Overview
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.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.
Mongoose ODM for Node.js before version 8.9.5 contains a search injection vulnerability when using $where filters with p
An exploitable stack buffer overflow vulnerability exists in the MQTT packet parsing functionality of Cesanta Mongoose 6
An exploitable use-after-free vulnerability exists in the HTTP server implementation of Cesanta Mongoose 6.8. Rated crit
An exploitable memory corruption vulnerability exists in the Websocket protocol implementation of Cesanta Mongoose 6.8.
An exploitable memory corruption vulnerability exists in the Websocket protocol implementation of Cesanta Mongoose 6.8.
Prototype Pollution in GitHub repository automattic/mongoose prior to 7.3.4. Rated critical severity (CVSS 9.8), this vu
Prototype Pollution in GitHub repository automattic/mongoose prior to 6.4.6. Rated critical severity (CVSS 9.8), this vu
An integer overflow in parse_mqtt in mongoose.c in Cesanta Mongoose 6.16 allows an attacker to achieve remote DoS (infin
Mongoose before 8.8.3 can improperly use $where in match, leading to search injection. Rated critical severity (CVSS 9.1
The mg_tls_init function in Cesanta Mongoose HTTPS server 7.0 (compiled with OpenSSL support) is vulnerable to remote OO
The mg_tls_init function in Cesanta Mongoose HTTPS server 7.0 and 6.7-6.18 (compiled with mbedTLS support) is vulnerable
The mg_http_serve_file function in Cesanta Mongoose HTTP server 7.0 is vulnerable to remote OOB write attack via connect
EUVD-2026-120497
GHSA-wr5m-5jph-8m96
NVD
CVE.org
EPSS
Exploit-DB