GHSA-664h-wqgq-64gw
MEDIUMMongoose: Prototype pollution in mongoose update casting via __proto__-prefixed dotted path (Schema._getSchema/path getter)
Blast Radius
Weekly download volume for affected packages — a proxy for how broadly this vulnerability is deployed.
mongoosenpmDescription
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:
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?
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | mongoose | all versions | 6.13.10 |
| 📦npm | mongoose | ≥ 7.0.0&&< 7.8.10 | 7.8.10 |
| 📦npm | mongoose | ≥ 8.0.0&&< 8.24.1 | 8.24.1 |
| 📦npm | mongoose | ≥ 9.0.0&&< 9.7.2 | 9.7.2 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for mongoose. O3's reachability analysis confirms whether the vulnerable code path is actually invoked in your application, so you act on real exposure instead of every transitive match.
Fix
Update mongoose to 6.13.10 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-664h-wqgq-64gw is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 pinpoints whether GHSA-664h-wqgq-64gw is reachable in your code and exactly where to fix it, then blocks exploitation in production at runtime until the patched version is deployed.
Tailored to GHSA-664h-wqgq-64gw. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is GHSA-664h-wqgq-64gw in your dependencies?
O3 detects GHSA-664h-wqgq-64gw across npm dependencies and uses function-level reachability to confirm whether the vulnerable code path is actually reachable — not just present. No false positives.