Repository navigation
fix(deps): update dependency mongoose to v6 [security] - #346
Open
renovate[bot] wants to merge 1 commit into
Open
renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
renovate
Bot
force-pushed
the
fix/deps/npm-mongoose-vulnerability
branch
from
December 4, 2024 20:23
0b1df70 to
8d870e8
Compare
renovate
Bot
force-pushed
the
fix/deps/npm-mongoose-vulnerability
branch
from
December 4, 2024 23:14
8d870e8 to
49d3c32
Compare
renovate
Bot
force-pushed
the
fix/deps/npm-mongoose-vulnerability
branch
from
January 16, 2025 18:37
49d3c32 to
56cc659
Compare
renovate
Bot
force-pushed
the
fix/deps/npm-mongoose-vulnerability
branch
from
January 17, 2025 18:18
56cc659 to
dd25089
Compare
renovate
Bot
force-pushed
the
fix/deps/npm-mongoose-vulnerability
branch
from
January 17, 2025 22:06
dd25089 to
20afd4c
Compare
renovate
Bot
force-pushed
the
fix/deps/npm-mongoose-vulnerability
branch
2 times, most recently
from
August 13, 2025 15:36
28d6d33 to
7e80d28
Compare
renovate
Bot
force-pushed
the
fix/deps/npm-mongoose-vulnerability
branch
from
August 31, 2025 10:34
7e80d28 to
72f92aa
Compare
renovate
Bot
force-pushed
the
fix/deps/npm-mongoose-vulnerability
branch
from
September 25, 2025 15:00
72f92aa to
c266702
Compare
renovate
Bot
force-pushed
the
fix/deps/npm-mongoose-vulnerability
branch
from
October 21, 2025 15:45
c266702 to
a7caeb8
Compare
renovate
Bot
force-pushed
the
fix/deps/npm-mongoose-vulnerability
branch
from
November 11, 2025 01:16
a7caeb8 to
a615899
Compare
renovate
Bot
force-pushed
the
fix/deps/npm-mongoose-vulnerability
branch
3 times, most recently
from
November 18, 2025 10:08
3e5214a to
e0c3f02
Compare
renovate
Bot
force-pushed
the
fix/deps/npm-mongoose-vulnerability
branch
2 times, most recently
from
February 17, 2026 20:29
dcead61 to
ee6e26a
Compare
renovate
Bot
force-pushed
the
fix/deps/npm-mongoose-vulnerability
branch
from
March 5, 2026 17:17
ee6e26a to
9dbca21
Compare
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
renovate
Bot
force-pushed
the
fix/deps/npm-mongoose-vulnerability
branch
from
March 13, 2026 17:58
9dbca21 to
ad4d5f0
Compare
renovate
Bot
force-pushed
the
fix/deps/npm-mongoose-vulnerability
branch
3 times, most recently
from
April 1, 2026 20:47
e5ef5f3 to
7a92a12
Compare
renovate
Bot
force-pushed
the
fix/deps/npm-mongoose-vulnerability
branch
from
April 8, 2026 16:37
7a92a12 to
489969f
Compare
renovate
Bot
force-pushed
the
fix/deps/npm-mongoose-vulnerability
branch
from
April 29, 2026 14:51
489969f to
dd62df7
Compare
renovate
Bot
force-pushed
the
fix/deps/npm-mongoose-vulnerability
branch
2 times, most recently
from
May 12, 2026 15:02
af9e2ff to
3158fe1
Compare
renovate
Bot
force-pushed
the
fix/deps/npm-mongoose-vulnerability
branch
from
May 18, 2026 09:47
3158fe1 to
86e1437
Compare
renovate
Bot
force-pushed
the
fix/deps/npm-mongoose-vulnerability
branch
2 times, most recently
from
June 1, 2026 23:13
b92917c to
6ed7058
Compare
renovate
Bot
force-pushed
the
fix/deps/npm-mongoose-vulnerability
branch
from
June 11, 2026 15:12
6ed7058 to
94eabf5
Compare
renovate
Bot
force-pushed
the
fix/deps/npm-mongoose-vulnerability
branch
from
July 12, 2026 15:50
94eabf5 to
1ab60b7
Compare
renovate
Bot
force-pushed
the
fix/deps/npm-mongoose-vulnerability
branch
from
July 25, 2026 21:26
1ab60b7 to
7791c28
Compare
renovate
Bot
force-pushed
the
fix/deps/npm-mongoose-vulnerability
branch
3 times, most recently
from
October 27, 2026 00:57
a36a03a to
16d0231
Compare
renovate
Bot
force-pushed
the
fix/deps/npm-mongoose-vulnerability
branch
2 times, most recently
from
November 10, 2026 23:58
f514309 to
a877574
Compare
| datasource | package | from | to | | ---------- | -------- | ------- | ------- | | npm | mongoose | 5.13.20 | 6.13.12 |
renovate
Bot
force-pushed
the
fix/deps/npm-mongoose-vulnerability
branch
from
November 11, 2026 01:48
a877574 to
870a405
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This PR body was truncated due to platform limits.
This PR contains the following updates:
5.13.20→6.13.12Mongoose 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
$whereoperator. This vulnerability arises from the ability of the$whereclause 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:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:HReferences
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:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:NReferences
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
$noroperator.When sanitizeFilter is enabled, Mongoose wraps query operators in
$eqto neutralize them. However, prior to the fix,$norwas not included in the set of logical operators that are recursively sanitized. Because$noraccepts an array (like$andand$or), and arrays do not triggerhasDollarKeys(), malicious operators such as$ne,$gt, or$regexcould be injected inside a$norclause without being sanitized.This may lead to:
Affected users:
Applications that:
Model.findOne(req.body)) and rely onsanitizeFilterto strip out query selectorsApplications 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.6Workarounds
Delete
$norkeys, use an additional schema validation library, or write middleware to strip out$norfrom 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:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:NReferences
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$fullPathand$parentSchemaDocArrayonObject.prototype.Example:
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 MongooseReferences
Are there any links users can visit to find out more?
Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:LReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Mongoose: sanitizeFilter not applied on countDocuments
CVE-2026-125120 / GHSA-pcrw-h46h-c93h
More information
Details
Impact
sanitizeFilteris Mongoose's mechanism for protecting against query selector injection attacks. In older versions of Mongoose,sanitizeFilterwas not applied forcountDocuments()queries.Patches
Patches have been released for all supported Mongoose major release lines. Please upgrade to the following versions depending on which major version of Mongoose applications are using.
^9.9.2^8.24.3^7.8.12^6.13.11Workarounds
Middleware:
Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:HReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Mongoose: Prototype pollution via Schema.prototype.virtual()
CVE-2026-125118 / GHSA-6972-9mcm-vhwj
More information
Details
Summary
Prototype pollution via Schema.prototype.virtual() — the 2022 fix for CVE-2022-2564 / CVE-2022-24304 protected Schema.path()/add() but never virtual(), so the same class of bug is still exploitable in all maintained release lines.
Details
In lib/schema.js, Schema.prototype.virtual() (defined at line 2643) builds the virtual path via:
Unlike
path()/add(),virtual()never received thespecialPropertiescheck added for CVE-2022-2564/CVE-2022-24304 (lib/schema.jslines 806, 1308, 1331).A path containing
__proto__/constructor/prototypesegments resolves through the prototype chain and writes ontoObject.prototype/Function.prototype.Proof of concept
Impact
Attacker-influenced schema field names (dynamic schemas, CMS form builders, schema-as-code) allow pollution of Object.prototype (own, enumerable keys visible on every object — e.g.
({}).isAdminchecks can be spoofed) and Function.prototype (a known gadget primitive in server-side JS).Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:LReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Mongoose walks into inherited properties when hydrating, setting, and merging, allowing overwrites of built-in functions (denial of service) and shared schema state
CVE-2026-125117 / GHSA-8332-j7wj-wjw4
More information
Details
Summary
Three Mongoose code paths copy data into objects by property name without checking whether the property is the object's own or inherited from its prototype:
init(), also used byModel.hydrate())$__set, used bynew Model(obj),doc.set()anddoc.$set())utils.mergeClone, used byfindOneAndReplace(), chained update calls andQuery.prototype.merge())When a key names an inherited property, such as
toStringorvalueOf, or a document internal such as$__schema, Mongoose writes into the shared object behind that property. The data comes from the attacker.{ "toString": { "call": 1 } }overwritesObject.prototype.toString.call. Mongoose and most other libraries rely onObject.prototype.toString.call(). After the overwrite, every later query in the process throwsTypeError: _toString.call is not a functionuntil the process restarts. This includes queries on unrelated models.strict: false, a path such asprofile.$__schema.paths.email.validatorsreaches the subdocument's schema, which every document shares. Setting it to[]removes therequiredvalidator for every document in the process.Mongoose already blocked
__proto__,constructorandprototype, so these bugs cannot add properties toObject.prototypeitself. They can still overwrite methods and properties of shared built-in functions and of Mongoose's internal objects.Details
1. Loading documents:
init()For a stored field named
toString,doc[i]is the inheritedObject.prototype.toString. It is truthy, soinit()recurses into that function and copies the stored subfields onto it.This runs for every document Mongoose loads:
find(),findOne(), cursors, populated documents andModel.hydrate(). It runs whatever thestrictsetting, and it applies to top-level and nested paths alike.lean()queries are not affected.A malicious document can get into the collection in several ways:
strict: false, for examplenew Model(req.body).save();2. Setting dotted paths:
$__setWhen it walks a dotted path,
$__setreadobj[parts[i]]and descended into whatever it found. That included inherited functions, such asObject.prototype.toStringon a plain object orDocument.prototype.toObjecton a subdocument. On subdocuments it also included non-function internals that are prototype getters, such as$__schema,schema,$__middlewareand$__schemaTypeOptions. Those point at objects that every document of the model shares.Attacker-controlled input reaches this path through:
Mixedpath on a default, strict schema:new Model({ "mixed.toString.call": 1 }), ordoc.set({ "mixed.toString.call": 1 }). Nothing needs to be saved.strict: false: for exampledoc.set('toString.call', 1).strict: false, when the application passes a user-controlled path todoc.set(path, value): for exampledoc.set('profile.$__schema.paths.email.validators', []).3. Merging updates:
utils.mergeCloneto[key]was read without an own-property check, so a key such astoStringrecursed intoObject.prototype.toString. This affects:Model.findOneAndReplace(filter, replacement). It always merges the replacement into the query's update, so a single call with an untrusted replacement is enough.Model.updateOne(filter, { $set: {...} }).updateOne({}, untrustedUpdate), the same pattern withfindOneAndUpdate(), or middleware that callsthis.updateOne(...).Query.prototype.merge()with a source query whose update came from untrusted input.Proof of concept
Impact
Denial of service (paths 1, 2 and 3). One request overwrites
Object.prototype.toString.call. After that, every query in the process fails, and so does much other code, until the process restarts. Ways in:new Model(req.body)on any schema with aMixedpath;findOneAndReplace()with an untrusted replacement;{ "toString": { "call": 1 } }.In the stored-document case, the attacker does not need any write path through Mongoose at the moment of the attack. Any later read of that document triggers the overwrite. If the document is read on startup or by a scheduled job, the application can be kept down.
Changes to shared state (path 2,
strict: falsesubdocuments). An attacker who controls the path passed todoc.set(path, value)can change a subdocument schema that every document shares. For example, they can remove validators or change schema options for every later document in the process.Properties on built-in functions. More generally, an attacker can attach properties they choose to built-in functions such as
Object.prototype.toString,Object.prototype.valueOfandFunction.prototype.call. Any other code that reads properties of those functions sees the attacker's values.Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:HReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Mongoose: Discriminator key values matching inherited properties (e.g. __t: 'constructor') bypass schema casting and can poison collections
CVE-2026-125116 / GHSA-wr5m-5jph-8m96
More information
Details
Summary
Mongoose chooses which discriminator model or schema to use by looking up the discriminator key value (
__tby default) in a plain object of registered discriminators, for exampleModel.discriminators[doc.__t]. That value comes from user documents and query filters. Because the lookup did not check own properties, a value that names a property inherited fromObject.prototyperesolves to that inherited value instead of a discriminator. Examples are'constructor','toString'and'hasOwnProperty'.__t: 'constructor'resolves to the globalObjectfunction. Mongoose then callsnew Object(doc), which returns the raw user object where a Mongoose document is expected.__t: 'toString'and similar names resolve to built-in functions that throw when used as a constructor or schema.The most serious effect: through
bulkWrite()insertOnewithskipValidation: true, the raw user object is stored as-is, without schema casting orstrictfiltering. After that, every query that returns the stored document throws, until the document is removed from the database.Details
The registries that hold discriminators are plain objects:
Model.discriminators,schema.discriminators, and the embedded discriminator registries on document arrays and single nested subdocuments. Several code paths indexed them directly with a value taken from the document or filter:new Model(doc))Model.create(),insertMany(),bulkWrite(),bulkSave()find(),findOne(), etc.) andModel.hydrate()'events.__t'and$elemMatcharrayFilterspush()/create(), document array and single nested castinggetDiscriminatorByValue()already iterated the registry's own keys safely. But most callers tried the direct lookup first and only fell back to it afterwards, so a truthy inherited value took precedence.The lookups only read inherited properties. They do not write to
Object.prototypeor any other shared object, and they do not change in-memory state that affects other requests. This is NOT a prototype pollution vector.Proof of concept
Impact
TypeErroror a non-document object returned to application code. Ways in includeModel.create(req.body),new Model(req.body),Model.find(req.query)-style filters, and pushing user input onto embedded discriminator arrays. The effect is limited to the request carrying the value.bulkWrite({ skipValidation: true }). When an application passes untrusted documents tobulkWrite()insertOnewithskipValidation: true, the raw object is stored without casting orstrictfiltering. Fields the schema would normally strip are persisted, such as anisAdminthat isn't in the schema. Fields with wrong types are also persisted.bulkWrite()path above, the document can get into the collection through another application, the raw MongoDB driver, or any other writer that does not go through Mongoose casting.This issue doesn't let an attacker modify
Object.prototype, built-in functions, schemas or other shared in-memory state. The schema bypass requires the application to opt in toskipValidationwith untrusted input.Severity
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:LReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes
Automattic/mongoose (mongoose)
v6.13.12Compare Source
v6.13.11Compare Source
6.13.11 / 2026-08-10
v6.13.10Compare Source
v6.13.9Compare Source
6.13.9 / 2026-02-04
v6.13.8Compare Source
===================
v6.13.7Compare Source
===================
v6.13.6Compare Source
===================
v6.13.5Compare Source
===================
v6.13.4Compare Source
===================
v6.13.3Compare Source
===================
v6.13.2Compare Source
===================
v6.13.1Compare Source
===================
v6.13.0Compare Source
===================
v6.12.9Compare Source
===================
v6.12.8Compare Source
===================
valueproperty rather than boolean #14418v6.12.7Compare Source
===================
openUri()#14370 #13376 #13335v6.12.6Compare Source
===================
v6.12.5Compare Source
===================
v6.12.4Compare Source
===================
v6.12.3Compare Source
===================
removeVirtual()#14019 #13085v6.12.2Compare Source
===================
v6.12.1Compare Source
===================
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.