Repository navigation
chore(deps): update dependency mongoose to v6 [security] - #815
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
renovate/npm-mongoose-vulnerability
branch
from
July 19, 2023 00:35
ef3fbc6 to
f7b3864
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
from
December 3, 2024 04:28
f7b3864 to
1a5539e
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
from
December 4, 2024 17:48
1a5539e to
d5c8a8c
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
from
December 4, 2024 23:06
d5c8a8c to
ea61bbb
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
from
December 8, 2024 21:05
4b18866 to
ea61bbb
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
2 times, most recently
from
January 23, 2025 17:01
c213009 to
c3c02f2
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
from
January 30, 2025 18:31
c3c02f2 to
bdaec61
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
from
February 9, 2025 14:12
bdaec61 to
0807294
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
from
March 3, 2025 15:11
0807294 to
0b02631
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
2 times, most recently
from
March 17, 2025 13:31
7c79f11 to
a57c176
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
from
April 1, 2025 12:23
a57c176 to
7540864
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
from
April 8, 2025 13:24
7540864 to
c185b1d
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
from
April 24, 2025 05:52
c185b1d to
8b558bc
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
from
May 19, 2025 17:05
8b558bc to
a8cc67b
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
from
May 28, 2025 09:09
a8cc67b to
dc743ec
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
from
June 4, 2025 13:17
dc743ec to
fc82c5d
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
from
June 22, 2025 15:24
fc82c5d to
94a4ea0
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
from
July 2, 2025 15:42
94a4ea0 to
017cafd
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
from
August 10, 2025 14:55
017cafd to
ad57c70
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
from
January 19, 2026 15:55
757e999 to
f5abbd1
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
from
February 2, 2026 20:38
f5abbd1 to
bc60ca7
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
2 times, most recently
from
February 17, 2026 21:33
63cb9c4 to
91117c3
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
from
March 5, 2026 15:56
91117c3 to
9a1b42c
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
from
March 13, 2026 15:56
9a1b42c to
b723c6e
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
3 times, most recently
from
April 1, 2026 17:45
789a985 to
9814e11
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
from
April 8, 2026 17:20
9814e11 to
e3abb07
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
from
April 29, 2026 16:29
e3abb07 to
d1fca04
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
2 times, most recently
from
May 18, 2026 19:38
1b044b3 to
c6de680
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
from
May 30, 2026 22:57
c6de680 to
ae267fc
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
from
June 11, 2026 11:06
ae267fc to
780a59c
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
2 times, most recently
from
July 16, 2026 14:58
e3ab01a to
b527788
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
2 times, most recently
from
July 24, 2026 19:35
de4f6ad to
a41a800
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
from
July 30, 2026 16:10
a41a800 to
1b8af1c
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
2 times, most recently
from
August 14, 2026 18:29
638e496 to
e5e39dc
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
2 times, most recently
from
September 2, 2026 16:59
315d260 to
cf3e5ea
Compare
renovate
Bot
force-pushed
the
renovate/npm-mongoose-vulnerability
branch
from
September 3, 2026 16:56
cf3e5ea to
24ada41
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.6.7→6.13.12Improper Input Validation in Automattic Mongoose
CVE-2019-17426 / GHSA-8687-vv9j-hgph
More information
Details
Automattic Mongoose through 5.7.4 allows attackers to bypass access control (in some applications) because any query object with a
_bsontypeattribute 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).Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
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:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:HReferences
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:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:HReferences
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 theschemaobject. This vulnerability allows modification of the Object prototype and could be manipulated into a Denial of Service (DoS) attack.Proof of Concept
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: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 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.2](https://rConfiguration
📅 Schedule: (UTC)
🚦 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.
This PR was generated by Mend Renovate. View the repository job log.