Skip to content

fix(deps): update dependency mongoose to v6 [security] - #409

Open
renovate[bot] wants to merge 1 commit into
masterfrom
renovate/npm-mongoose-vulnerability
Open

fix(deps): update dependency mongoose to v6 [security]#409
renovate[bot] wants to merge 1 commit into
masterfrom
renovate/npm-mongoose-vulnerability

Conversation

@renovate

@renovate renovate Bot commented Mar 17, 2023

Copy link
Copy Markdown

ℹ️ Note

This PR body was truncated due to platform limits.

This PR contains the following updates:

Package Change Age Confidence
mongoose (source) ^5.11.3^6.0.0 age confidence

automattic/mongoose vulnerable to Prototype pollution via Schema.path

CVE-2022-2564 / GHSA-f825-f98c-gj3g

More information

Details

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.

Severity

  • CVSS Score: 7.0 / 10 (High)
  • Vector String: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:H

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Mongoose Prototype Pollution vulnerability

CVE-2023-3696 / GHSA-9m93-w8w6-76hh

More information

Details

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

Severity

  • CVSS Score: 10.0 / 10 (Critical)
  • Vector String: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:H

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Mongoose Vulnerable to Prototype Pollution in Schema Object

CVE-2022-24304 / GHSA-h8hf-x3f4-xwgp

More information

Details

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
// poc.js
const mongoose = require('mongoose');
const schema = new mongoose.Schema();

malicious_payload = '__proto__.toString'

schema.path(malicious_payload, [String])

x = {}
console.log(x.toString()) // crashed (Denial of service (DoS) attack)
Impact

This vulnerability can be manipulated to exploit other types of attacks, such as Denial of service (DoS), Remote Code Execution, or Property Injection.

Severity

  • CVSS Score: 9.8 / 10 (Critical)
  • Vector String: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Mongoose search injection vulnerability

CVE-2025-23061 / GHSA-vg7j-7cwx-8wgw

More information

Details

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.

Severity

  • CVSS Score: 9.0 / 10 (Critical)
  • Vector String: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Mongoose search injection vulnerability

CVE-2024-53900 / GHSA-m7xq-9374-9rvx

More information

Details

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.

Severity

  • CVSS Score: 8.7 / 10 (High)
  • Vector String: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Mongoose's Improper Sanitization of $nor in sanitizeFilter May Allow NoSQL Injection

CVE-2026-42334 / GHSA-wpg9-53fq-2r8h

More information

Details

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 bypass
  • Unauthorized data access
  • Data exfiltration

Affected users:

Applications that:

  • Explicitly enable sanitizeFilter
  • Pass unsanitized user-controlled input directly into query methods (e.g., Model.findOne(req.body)) and rely on sanitizeFilter to strip out query selectors

Applications that validate input schemas, whitelist fields, or avoid passing raw request bodies into queries are not affected. For example, Model.findOne({ user: req.body.user, pwd: req.body.pwd }) is not affected.

Patches

Patches have been released for all supported Mongoose release lines:

  • ^6.13.9
  • ^7.8.9
  • ^8.22.1
  • ^9.1.6
Workarounds

Delete $nor keys, use an additional schema validation library, or write middleware to strip out $nor from query filters.

Resources

sanitizeFilter documentation: https://mongoosejs.com/docs/api/mongoose.html#Mongoose.prototype.sanitizeFilter()

Original blog post on sanitizeFilter: https://thecodebarbarian.com/whats-new-in-mongoose-6-sanitizefilter.html

Severity

  • CVSS Score: 7.5 / 10 (High)
  • Vector String: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


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

CVE-2026-73562 / GHSA-664h-wqgq-64gw

More information

Details

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?

Severity

  • CVSS Score: 6.5 / 10 (Medium)
  • Vector String: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Release Notes

Automattic/mongoose (mongoose)

v6.13.10

Compare Source

v6.13.9

Compare Source

6.13.9 / 2026-02-04

  • fix: handle other top-level query operators in sanitizeFilter
  • types(aggregate): add $firstN, $lastN, $bottom, $bottomN, $minN and $maxN operators #​15303 #​15299
  • docs(compatibility): add note that Mongoose ^6.5 works with MongoDB server 7.x #​15427

v6.13.8

Compare Source

===================

  • chore: remove coverage output from bundle

v6.13.7

Compare Source

===================

  • chore: re-release to force npm audit to pick up 6.x fix for CVE-2025-23061

v6.13.6

Compare Source

===================

v6.13.5

Compare Source

===================

  • fix: disallow using $where in match

v6.13.4

Compare Source

===================

v6.13.3

Compare Source

===================

  • docs(migrating_to_6): document that Lodash _.isEmpty() with ObjectId() as a parameter returns true in Mongoose 6 #​11152

v6.13.2

Compare Source

===================

  • fix(document): make set() respect merge option on deeply nested objects #​14870 #​14878

v6.13.1

Compare Source

===================

v6.13.0

Compare Source

===================

  • feat(model): add throwOnValidationError option for opting into getting MongooseBulkWriteError if all valid operations succeed in bulkWrite() and insertMany() #​14599 #​14587 #​14572 #​13410

v6.12.9

Compare Source

===================

v6.12.8

Compare Source

===================

  • fix(document): handle virtuals that are stored as objects but getter returns string with toJSON #​14468 #​14446
  • fix(schematype): consistently set wasPopulated to object with value property rather than boolean #​14418
  • docs(model): add extra note about lean option for insertMany() skipping casting #​14415 #​14376

v6.12.7

Compare Source

===================

v6.12.6

Compare Source

===================

  • fix(collection): correctly handle buffer timeouts with find() #​14277
  • fix(document): allow calling push() with different $position arguments #​14254

v6.12.5

Compare Source

===================

  • perf(schema): remove unnecessary lookahead in numeric subpath check
  • fix(document): allow setting nested path to null #​14226
  • fix(document): avoid flattening dotted paths in mixed path underneath nested path #​14198 #​14178
  • fix: add ignoreAtomics option to isModified() for better backwards compatibility with Mongoose 5 #​14213

v6.12.4

Compare Source

===================

  • fix: upgrade mongodb driver -> 4.17.2
  • fix(document): avoid treating nested projection as inclusive when applying defaults #​14173 #​14115
  • fix: account for null values when assigning isNew property #​14172 #​13883

v6.12.3

Compare Source

===================

  • fix(ChangeStream): correctly handle hydrate option when using change stream as stream instead of iterator #​14052
  • fix(schema): fix dangling reference to virtual in tree after removeVirtual() #​14019 #​13085
  • fix(document): avoid unmarking modified on nested path if no initial value stored and already modified #​14053 #​14024
  • fix(document): consistently avoid marking subpaths of nested paths as modified #​14053 #​14022

v6.12.2

Compare Source

===================

v6.12.1

Compare Source

===================

v6.12.0

Compare Source

===================

  • feat: use mongodb driver v4.17.1
  • fix(model): make Model.bulkWrite() with empty array and ordered false not throw an error #​13664
  • fix(document): correctly handle inclusive/exclusive projections when applying subdocument defaults #​13763 #​13720

v6.11.6

Compare Source

===================

v6.11.5

Compare Source

===================

  • fix(schema): make Schema.prototype.clone() avoid creating different copies of subdocuments and single nested paths underneath single nested paths #​13671 #​13626
  • fix: custom debug function not processing all args #​13418

v6.11.4

Compare Source

===================

  • perf: speed up mapOfSubdocs benchmark by 4x by avoiding unnecessary O(n^2) loop in getPathsToValidate() #​13614

v6.11.3

Compare Source

===================

  • fix: avoid prototype pollution on init
  • fix(schema): correctly handle uuids with populate() #​13317 #​13595

v6.11.2

Compare Source

===================

v6.11.1

Compare Source

===================

  • fix(query): apply schema-level paths before calculating projection for findOneAndUpdate() #​13348 #​13340
  • fix: add SUPPRESS_JEST_WARNINGS environment variable to hide jest warnings #​13384 #​13373
  • types(model): allow overwriting expected param type for bulkWrite() #​13292 hasezoey

v6.11.0

Compare Source

===================

v6.10.5

Compare Source

===================

  • perf(document): avoid unnecessary loops, conditionals, string manipulation on Document.prototype.get() for 10x speedup on top-level properties #​12953
  • fix(model): execute valid write operations if calling bulkWrite() with ordered: false #​13218 #​13176
  • fix(array): pass-through all parameters #​13202 #​13201 hasezoey
  • fix: improve error message when sorting by empty string #​13249 #​10182
  • docs: add version support and check version docs #​13251 #​13193

v6.10.4

Compare Source

===================

  • fix(document): apply setters on resulting value when calling Document.prototype.$inc() #​13178 #​13158
  • fix(model): add results property to unordered insertMany() to make it easy to identify exactly which documents were inserted #​13163 #​12791
  • docs(guide+schematypes): add UUID to schematypes guide #​13184

v6.10.3

Compare Source

===================

v6.10.2

Compare Source

===================

  • fix(document): avoid setting array default if document array projected out by sibling projection #​13135 #​13043 #​13003
  • fix(documentarray): set correct document array path if making map of document arrays #​13133
  • fix: undo accidental change to engines in package.json #​13124 lorand-horvath
  • docs: quick improvement to Model.init() docs #​13054

v6.10.1

Compare Source

===================

v6.10.0

Compare Source

===================

v6.9.3

Compare Source

==================

v6.9.2

Compare Source

==================

v6.9.1

Compare Source

==================

  • fix(document): isModified should not be triggered when setting a nested boolean to the same value as previously #​12994 lpizzinidev
  • fix(document): save newly set defaults underneath single nested subdocuments #​13002 #​12905
  • fix(update): handle custom discriminator model name when casting update #​12947 wassil
  • fix(connection): handles unique autoincrement ID for connections #​12990 lpizzinidev
  • fix(types): fix type of options of Model.aggregate #​12933 ghost91-
  • fix(types): fix "near" aggregation operator input type #​12954 Jokero
  • fix(types): add missing Top operator to AccumulatorOperator type declaration #​12952 lpizzinidev
  • docs(transactions): added example for Connection.transaction() method #​12943 #​12934 lpizzinidev
  • docs(populate): fix out of date comment referencing onModel property #​13000
  • docs(transactions): fix typo in transactions.md #​12995 Parth86

v6.9.0

Compare Source

==================

v6.8.4

Compare Source

==================

v6.8.3

Compare Source

==================

  • perf: improve performance of assignRawDocsToIdStructure for faster populate on large docs #​12867 Uzlopak
  • fix(model): ensure consistent ordering of validation errors in insertMany() with ordered: false and rawResult: true #​12866
  • fix: avoid passing final callback to pre hook, because calling the callback can mess up hook execution #​12836
  • fix(types): avoid inferring timestamps if methods, virtuals, or statics set #​12871
  • fix(types): correctly infer string enums on const arrays #​12870 JavaScriptBach
  • fix(types): allow virtuals to be invoked in the definition of other virtuals #​12874 sffc
  • fix(types): add type def for Aggregate#model without arguments #​12864 hasezoey
  • docs(discriminators): add section about changing discriminator key #​12861
  • docs(typescript): explain that virtuals inferred from schema only show up on Model, not raw document type #​12860 #​12684

v6.8.2

Compare Source

==================

Note

PR body was truncated to here.


Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate Bot changed the title chore(deps): update dependency mongoose to 5.13.15 [security] fix(deps): update dependency mongoose to v5.13.15 [security] Mar 23, 2023
@renovate renovate Bot changed the title fix(deps): update dependency mongoose to v5.13.15 [security] fix(deps): update dependency mongoose to v5.13.15 [security] - autoclosed Jul 14, 2023
@renovate renovate Bot closed this Jul 14, 2023
@renovate
renovate Bot deleted the renovate/npm-mongoose-vulnerability branch July 14, 2023 15:46
@renovate renovate Bot changed the title fix(deps): update dependency mongoose to v5.13.15 [security] - autoclosed fix(deps): update dependency mongoose to v5.13.15 [security] Jul 18, 2023
@renovate renovate Bot reopened this Jul 18, 2023
@renovate
renovate Bot restored the renovate/npm-mongoose-vulnerability branch July 18, 2023 20:09
@renovate renovate Bot changed the title fix(deps): update dependency mongoose to v5.13.15 [security] fix(deps): update dependency mongoose to v5.13.20 [security] Jul 18, 2023
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from 92656e0 to 3a1ac0f Compare July 18, 2023 20:10
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from 3a1ac0f to 263ac29 Compare August 6, 2024 09:27
@renovate renovate Bot changed the title fix(deps): update dependency mongoose to v5.13.20 [security] fix(deps): update dependency mongoose to v5.13.15 [security] Aug 6, 2024
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from 263ac29 to 0d65582 Compare January 23, 2025 16:57
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from 0d65582 to 419a9f0 Compare February 9, 2025 12:47
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from 419a9f0 to 4125171 Compare March 3, 2025 12:31
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from 4125171 to 69268a8 Compare March 11, 2025 11:27
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from 69268a8 to 97ce6af Compare April 1, 2025 11:16
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from 97ce6af to 151572f Compare April 8, 2025 13:15
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from 151572f to edb2efe Compare April 24, 2025 07:52
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from edb2efe to 1ef52ce Compare May 19, 2025 20:36
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from 1ef52ce to 421c5b7 Compare May 28, 2025 08:13
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from 421c5b7 to 4d16d43 Compare June 4, 2025 12:28
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from 4d16d43 to 55fbeed Compare June 22, 2025 12:35
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from 55fbeed to 9d6d46b Compare July 2, 2025 19:32
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch 2 times, most recently from 1553049 to 971e70f Compare August 13, 2025 11:56
@renovate renovate Bot changed the title fix(deps): update dependency mongoose to v5.13.15 [security] fix(deps): update dependency mongoose to v6 [security] Aug 13, 2025
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from 971e70f to f1d4ae1 Compare August 19, 2025 18:02
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from f1d4ae1 to f6b5f3e Compare August 31, 2025 13:26
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from f6b5f3e to 987b65c Compare September 25, 2025 16:55
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch 2 times, most recently from 89ed6ef to 53e00fe Compare January 23, 2026 19:34
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from 53e00fe to 7c11c26 Compare February 2, 2026 15:35
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from 7c11c26 to 6078a70 Compare February 12, 2026 11:32
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from 6078a70 to b101b41 Compare March 5, 2026 18:56
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from b101b41 to d7e7c54 Compare March 13, 2026 10:51
@renovate renovate Bot changed the title chore(deps): update dependency mongoose to v5.13.15 [security] chore(deps): update dependency mongoose to v5.13.15 [security] - autoclosed Mar 27, 2026
@renovate renovate Bot closed this Mar 27, 2026
@renovate
renovate Bot deleted the renovate/npm-mongoose-vulnerability branch March 27, 2026 01:17
@renovate renovate Bot changed the title chore(deps): update dependency mongoose to v5.13.15 [security] - autoclosed chore(deps): update dependency mongoose to v5.13.15 [security] Mar 30, 2026
@renovate renovate Bot reopened this Mar 30, 2026
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch 2 times, most recently from d7e7c54 to a6e4525 Compare March 30, 2026 17:36
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from a6e4525 to 03a9d38 Compare April 8, 2026 17:49
@renovate renovate Bot changed the title chore(deps): update dependency mongoose to v5.13.15 [security] chore(deps): update dependency mongoose to v5.13.15 [security] - autoclosed Apr 27, 2026
@renovate renovate Bot closed this Apr 27, 2026
@renovate renovate Bot changed the title chore(deps): update dependency mongoose to v5.13.15 [security] - autoclosed chore(deps): update dependency mongoose to v5.13.15 [security] Apr 27, 2026
@renovate renovate Bot reopened this Apr 27, 2026
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch 2 times, most recently from 03a9d38 to 9a4d2aa Compare April 27, 2026 23:38
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch 2 times, most recently from 8215e27 to 0af11fe Compare May 18, 2026 12:37
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from 0af11fe to 421448e Compare May 28, 2026 19:48
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from 421448e to 64fd852 Compare June 11, 2026 17:42
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from 64fd852 to 20f9af3 Compare July 12, 2026 16:04
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from 20f9af3 to c694b80 Compare July 30, 2026 18:51
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from c694b80 to f6bd2a2 Compare August 12, 2026 01:47
@renovate
renovate Bot force-pushed the renovate/npm-mongoose-vulnerability branch from f6bd2a2 to 3f845e6 Compare August 26, 2026 13:59
@renovate renovate Bot changed the title chore(deps): update dependency mongoose to v5.13.15 [security] fix(deps): update dependency mongoose to v6 [security] Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants