Packages / mongoose / Security

ModerateVulnerabilityGHSA-664h-wqgq-64gwBIT-mongoose-2026-73562CVE-2026-73562Published 24 Jul 2026

Mongoose: Prototype pollution in mongoose update casting via __proto__-prefixed dotted path (Schema._getSchema/path getter)

Your version

Affected releases · mongoose

  • 9.x9.0.0 – 9.7.1Fixed in 9.7.2
  • 8.x8.0.0 – 8.24.0Fixed in 8.24.1
  • 7.x7.0.0 – 7.8.9Fixed in 7.8.10
  • 6.x6.0.0 – 6.13.9Fixed in 6.13.10
  • 5.x and older0.0.1 – 5.13.23No fix, no longer updated

On 9.x, the newest line:

npm install mongoose@9.7.2
Every release on a timeline
9.x
  1. Affected

    9.0.0 – 9.7.1

    28 releases

  2. Fixed

    9.7.2 – 9.11.4

    21 releases, latest

8.x
  1. Affected

    8.0.0 – 8.24.0

    102 releases

  2. Fixed

    8.24.1 – 8.24.7

    7 releases

7.x
  1. Affected

    7.0.0 – 7.8.9

    55 releases

  2. Fixed

    7.8.10 – 7.8.13

    4 releases

6.x
  1. Affected

    6.0.0 – 6.13.9

    119 releases

  2. Fixed

    6.13.10 – 6.13.12

    3 releases

5.x
  1. Affected

    5.0.0 – 5.13.23

    255 releases

4.x
  1. Affected

    4.0.0 – 4.13.21

    164 releases

3.x
  1. Affected

    3.0.0 – 3.9.7

    104 releases

2.x
  1. Affected

    2.0.0 – 2.9.10

    84 releases

1.x
  1. Affected

    1.0.0 – 1.8.4

    64 releases

0.x
  1. Affected

    0.0.1 – 0.0.6

    6 releases

1016 stable releases of mongoose, oldest to newest, one row per major.

What happens

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?