Mongooseに組み込み関数を上書きされる脆弱性、後続のクエリが失敗するおそれ
Summary
Mongooseには、攻撃者が制御するキーによって共有の組み込み関数やスキーマの状態を書き換えられる脆弱性(CVE-2026-125117)があります。書き換えられると、プロセスを再起動するまで無関係なモデルへのクエリが失敗するおそれがあり、CVSSは8.2です。影響するのは6.13.12より前の6系、7.8.13より前の7系、8.24.7より前の8系、9.11.4より前の9系で、6.13.12、7.8.13、8.24.7、9.11.4で修正されています。修正版への更新をお勧めします。
AI summary
Produced by SecPulse using an external AI model; it may contain mistakes. Check the original description and references below before acting on it.
Mongooseには、攻撃者が制御するキーによって共有の組み込み関数やスキーマの状態を書き換えられる脆弱性(CVE-2026-125117)があります。書き換えられると、プロセスを再起動するまで無関係なモデルへのクエリが失敗するおそれがあり、CVSSは8.2です。影響するのは6.13.12より前の6系、7.8.13より前の7系、8.24.7より前の8系、9.11.4より前の9系で、6.13.12、7.8.13、8.24.7、9.11.4で修正されています。修正版への更新をお勧めします。
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| Automatticmongoose | — | Not listed |
| npmmongoose |
≥ 9.0.0, < 9.11.4→ 9.11.4 |
9.11.4 |
| Bitnamimongoose |
< 6.13.12→ 6.13.12 ≥ 7.0.0, < 7.8.13→ 7.8.13 ≥ 8.0.0, < 8.24.7→ 8.24.7 ≥ 9.0.0, < 9.11.4→ 9.11.4 |
6.13.12 7.8.13 8.24.7 9.11.4 |
Original description The description as published by the source.
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:
- Loading a document from the database (
init(), also used byModel.hydrate()) - Setting a dotted path on a document (
$__set, used bynew Model(obj),doc.set()anddoc.$set()) - Merging update documents (
utils.mergeClone, used byfindOneAndReplace(), chained update calls andQuery.prototype.merge())
When a key names an inherited property, such as toString or valueOf, or a document internal such as $__schema, Mongoose writes into the shared object behind that property. The data comes from the attacker.
- Denial of service. For example,
{ "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. - Changing shared schema state. Through a subdocument with
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__, constructor and prototype, so these bugs cannot add properties to Object.prototype itself.…
Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory
References
- advisory github.com
- advisory nvd.nist.gov
- package github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web github.com