mongoose

Ecosystem: npm

Downloads: 29.18 Mln

Vulnerabilities from the last (months)
  • 4CriticalAffects 10 versions
  • 3HighAffects 10 versions
  • 0MediumAffects 0 versions
  • 2ModerateAffects 6 versions
  • 0LowAffects 0 versions
Severity distribution (all time)
9vulnerabilities
  • Critical4 (44.4%)
  • High3 (33.3%)
  • Medium0 (0.0%)
  • Moderate2 (22.2%)
  • Low0 (0.0%)

Monthly breakdown

  • Critical
  • High
  • Medium
  • Moderate
  • Low
  • 1 vulnerabilities
    • Critical: 0
    • High: 0
    • Medium: 0
    • Moderate: 1
    • Low: 0
  • 1 vulnerabilities
    • Critical: 0
    • High: 1
    • Medium: 0
    • Moderate: 0
    • Low: 0
  • 1 vulnerabilities
    • Critical: 1
    • High: 0
    • Medium: 0
    • Moderate: 0
    • Low: 0
  • 1 vulnerabilities
    • Critical: 0
    • High: 1
    • Medium: 0
    • Moderate: 0
    • Low: 0
  • 1 vulnerabilities
    • Critical: 1
    • High: 0
    • Medium: 0
    • Moderate: 0
    • Low: 0
  • 1 vulnerabilities
    • Critical: 1
    • High: 0
    • Medium: 0
    • Moderate: 0
    • Low: 0
  • 1 vulnerabilities
    • Critical: 0
    • High: 1
    • Medium: 0
    • Moderate: 0
    • Low: 0
  • 1 vulnerabilities
    • Critical: 0
    • High: 0
    • Medium: 0
    • Moderate: 1
    • Low: 0
  • 1 vulnerabilities
    • Critical: 1
    • High: 0
    • Medium: 0
    • Moderate: 0
    • Low: 0

Vulnerabilities (9)

Known vulnerabilities affecting mongoose, based on data from OSV.

Vulnerabilities affecting mongoose
IDSeveritySummaryAffected versionsPublishedSource
GHSA-664h-wqgq-64gwModerateMongoose: Prototype pollution in mongoose update casting via __proto__-prefixed dotted path (Schema._getSchema/path getter)### 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-control
  • < 6.13.10
  • >= 7.0.0, < 7.8.10
  • >= 8.0.0, < 8.24.1
  • >= 9.0.0, < 9.7.2
GitHub (opens in a new tab)
GHSA-wpg9-53fq-2r8hHighMongoose's Improper Sanitization of $nor in sanitizeFilter May Allow NoSQL Injection### Impact This vulnerability allows bypassing Mongoose’s sanitizeFilter query sanitization mechanism via the `$nor` operator. When sanitizeFilter is enabled, Mongoose wraps query operators in `$eq` to neutralize them. However, prior to the fix, `$nor` was not included in the set of logical operators that are recursively sanitized. Because `$nor` accepts an array (like `$and` and `$or`), and arrays do not trigger `hasDollarKeys()`, malicious operators such as `$ne`, `$gt`, or `$regex` could be injected inside a `$nor` clause without being sanitized. This may lead to: - Authentication bypas
  • < 6.13.9
  • >= 7.0.0, < 7.8.9
  • >= 8.0.0, < 8.22.1
  • >= 9.0.0, < 9.1.6
GitHub (opens in a new tab)
GHSA-vg7j-7cwx-8wgwCriticalMongoose search injection vulnerabilityMongoose versions prior to 8.9.5, 7.8.4, and 6.13.6 are vulnerable to improper use of the `$where` operator. This vulnerability arises from the ability of the `$where` clause to execute arbitrary JavaScript code in MongoDB queries, potentially leading to code injection attacks and unauthorized access or manipulation of database data. NOTE: this issue exists because of an incomplete fix for CVE-2024-53900.
  • >= 8.0.0-rc0, < 8.9.5
  • >= 7.0.0-rc0, < 7.8.4
  • < 6.13.6
GitHub (opens in a new tab)
GHSA-m7xq-9374-9rvxHighMongoose search injection vulnerabilityMongoose versions prior to 8.8.3, 7.8.3, 6.13.5, and 5.13.23 are vulnerable to improper use of the $where operator. This vulnerability arises from the ability of the $where clause to execute arbitrary JavaScript code in MongoDB queries, potentially leading to code injection attacks and unauthorized access or manipulation of database data.
  • >= 8.0.0-rc0, < 8.8.3
  • >= 7.0.0-rc0, < 7.8.3
  • >= 6.0.0-rc0, < 6.13.5
  • >= 3.6.0-rc0, < 5.13.23
GitHub (opens in a new tab)
GHSA-9m93-w8w6-76hhCriticalMongoose Prototype Pollution vulnerabilityPrototype Pollution in GitHub repository automattic/mongoose prior to 7.3.3, 6.11.3, and 5.13.20.
  • >= 7.0.0, < 7.3.3
  • >= 6.0.0, < 6.11.3
  • < 5.13.20
GitHub (opens in a new tab)
GHSA-h8hf-x3f4-xwgpCriticalMongoose Vulnerable to Prototype Pollution in Schema Object### Description Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. Affected versions of this package are vulnerable to Prototype Pollution. The `Schema.path()` function is vulnerable to prototype pollution when setting the `schema` object. This vulnerability allows modification of the Object prototype and could be manipulated into a Denial of Service (DoS) attack. ### Proof of Concept ```js // poc.js const mongoose = require('mongoose'); const schema = new mongoose.Schema(); malicious_payload = '__proto__.toString' schema.path(malicious_payload, [St
  • >= 6.0.0, < 6.4.6
  • < 5.13.15
GitHub (opens in a new tab)
GHSA-f825-f98c-gj3gHighautomattic/mongoose vulnerable to Prototype pollution via Schema.pathMongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. Affected versions of this package are vulnerable to Prototype Pollution. The `Schema.path()` function is vulnerable to prototype pollution when setting the schema object. This vulnerability allows modification of the Object prototype and could be manipulated into a Denial of Service (DoS) attack.
  • >= 6.0.0, < 6.4.6
  • < 5.13.15
GitHub (opens in a new tab)
GHSA-r5xw-q988-826mModerateRemote Memory Exposure in mongooseVersions of `mongoose` before 4.3.6, 3.8.39 are vulnerable to remote memory exposure. Trying to save a number to a field of type Buffer on the affected mongoose versions allocates a chunk of uninitialized memory and stores it in the database. ## Recommendation Update to version 4.3.6, 3.8.39 or later.
  • >= 3.5.5, < 3.8.39
  • >= 4.0.0, < 4.3.6
GitHub (opens in a new tab)
GHSA-8687-vv9j-hgphCriticalImproper Input Validation in Automattic MongooseAutomattic Mongoose through 5.7.4 allows attackers to bypass access control (in some applications) because any query object with a `_bsontype` attribute is ignored. For example, adding `"_bsontype":"a"` can sometimes interfere with a query filter. NOTE: this CVE is about Mongoose's failure to work around this _bsontype special case that exists in older versions of the bson parser (aka the mongodb/js-bson project).
  • >= 5.0.0, < 5.7.5
  • < 4.13.21
GitHub (opens in a new tab)
  • GHSA-664h-wqgq-64gwModerate
    Mongoose: Prototype pollution in mongoose update casting via __proto__-prefixed dotted path (Schema._getSchema/path getter)
    • < 6.13.10
    • >= 7.0.0, < 7.8.10
    • +2 more
    Affected versions:
    • < 6.13.10
    • >= 7.0.0, < 7.8.10
    • >= 8.0.0, < 8.24.1
    • >= 9.0.0, < 9.7.2

    ### 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-control

    CVE: CVE-2026-73562

  • GHSA-wpg9-53fq-2r8hHigh
    Mongoose's Improper Sanitization of $nor in sanitizeFilter May Allow NoSQL Injection
    • < 6.13.9
    • >= 7.0.0, < 7.8.9
    • +2 more
    Affected versions:
    • < 6.13.9
    • >= 7.0.0, < 7.8.9
    • >= 8.0.0, < 8.22.1
    • >= 9.0.0, < 9.1.6

    ### Impact This vulnerability allows bypassing Mongoose’s sanitizeFilter query sanitization mechanism via the `$nor` operator. When sanitizeFilter is enabled, Mongoose wraps query operators in `$eq` to neutralize them. However, prior to the fix, `$nor` was not included in the set of logical operators that are recursively sanitized. Because `$nor` accepts an array (like `$and` and `$or`), and arrays do not trigger `hasDollarKeys()`, malicious operators such as `$ne`, `$gt`, or `$regex` could be injected inside a `$nor` clause without being sanitized. This may lead to: - Authentication bypas

    CVE: CVE-2026-42334

  • GHSA-vg7j-7cwx-8wgwCritical
    Mongoose search injection vulnerability
    • >= 8.0.0-rc0, < 8.9.5
    • >= 7.0.0-rc0, < 7.8.4
    • +1 more
    Affected versions:
    • >= 8.0.0-rc0, < 8.9.5
    • >= 7.0.0-rc0, < 7.8.4
    • < 6.13.6

    Mongoose versions prior to 8.9.5, 7.8.4, and 6.13.6 are vulnerable to improper use of the `$where` operator. This vulnerability arises from the ability of the `$where` clause to execute arbitrary JavaScript code in MongoDB queries, potentially leading to code injection attacks and unauthorized access or manipulation of database data. NOTE: this issue exists because of an incomplete fix for CVE-2024-53900.

    CVE: CVE-2025-23061

  • GHSA-m7xq-9374-9rvxHigh
    Mongoose search injection vulnerability
    • >= 8.0.0-rc0, < 8.8.3
    • >= 7.0.0-rc0, < 7.8.3
    • +2 more
    Affected versions:
    • >= 8.0.0-rc0, < 8.8.3
    • >= 7.0.0-rc0, < 7.8.3
    • >= 6.0.0-rc0, < 6.13.5
    • >= 3.6.0-rc0, < 5.13.23

    Mongoose versions prior to 8.8.3, 7.8.3, 6.13.5, and 5.13.23 are vulnerable to improper use of the $where operator. This vulnerability arises from the ability of the $where clause to execute arbitrary JavaScript code in MongoDB queries, potentially leading to code injection attacks and unauthorized access or manipulation of database data.

    CVE: CVE-2024-53900

  • GHSA-9m93-w8w6-76hhCritical
    Mongoose Prototype Pollution vulnerability
    • >= 7.0.0, < 7.3.3
    • >= 6.0.0, < 6.11.3
    • +1 more
    Affected versions:
    • >= 7.0.0, < 7.3.3
    • >= 6.0.0, < 6.11.3
    • < 5.13.20

    Prototype Pollution in GitHub repository automattic/mongoose prior to 7.3.3, 6.11.3, and 5.13.20.

    CVE: CVE-2023-3696

  • GHSA-h8hf-x3f4-xwgpCritical
    Mongoose Vulnerable to Prototype Pollution in Schema Object
    • >= 6.0.0, < 6.4.6
    • < 5.13.15

    ### Description Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. Affected versions of this package are vulnerable to Prototype Pollution. The `Schema.path()` function is vulnerable to prototype pollution when setting the `schema` object. This vulnerability allows modification of the Object prototype and could be manipulated into a Denial of Service (DoS) attack. ### Proof of Concept ```js // poc.js const mongoose = require('mongoose'); const schema = new mongoose.Schema(); malicious_payload = '__proto__.toString' schema.path(malicious_payload, [St

    CVE: CVE-2022-24304

  • GHSA-f825-f98c-gj3gHigh
    automattic/mongoose vulnerable to Prototype pollution via Schema.path
    • >= 6.0.0, < 6.4.6
    • < 5.13.15

    Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. Affected versions of this package are vulnerable to Prototype Pollution. The `Schema.path()` function is vulnerable to prototype pollution when setting the schema object. This vulnerability allows modification of the Object prototype and could be manipulated into a Denial of Service (DoS) attack.

    CVE: CVE-2022-2564

  • GHSA-r5xw-q988-826mModerate
    Remote Memory Exposure in mongoose
    • >= 3.5.5, < 3.8.39
    • >= 4.0.0, < 4.3.6

    Versions of `mongoose` before 4.3.6, 3.8.39 are vulnerable to remote memory exposure. Trying to save a number to a field of type Buffer on the affected mongoose versions allocates a chunk of uninitialized memory and stores it in the database. ## Recommendation Update to version 4.3.6, 3.8.39 or later.

  • GHSA-8687-vv9j-hgphCritical
    Improper Input Validation in Automattic Mongoose
    • >= 5.0.0, < 5.7.5
    • < 4.13.21

    Automattic Mongoose through 5.7.4 allows attackers to bypass access control (in some applications) because any query object with a `_bsontype` attribute is ignored. For example, adding `"_bsontype":"a"` can sometimes interfere with a query filter. NOTE: this CVE is about Mongoose's failure to work around this _bsontype special case that exists in older versions of the bson parser (aka the mongodb/js-bson project).

    CVE: CVE-2019-17426

Showing 1-9 of 9 vulnerabilities