MongooseのcountDocumentsに脆弱性、修正版あり
Summary
MongooseのcountDocuments()で、設定したsanitizeFilterが適用されない脆弱性です。npmのmongooseを使い、外部からの値を条件に渡すアプリが関係します。使用中の版を調べ、修正版へ更新してください。
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のcountDocuments()で、設定したsanitizeFilterが適用されない脆弱性です。npmのmongooseを使い、外部からの値を条件に渡すアプリが関係します。使用中の版を調べ、修正版へ更新してください。
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| Automatticmongoose | — | Not listed |
| npmmongoose |
≥ 9.0.0, < 9.9.2→ 9.9.2 |
9.9.2 |
Original description The description as published by the source.
Impact
sanitizeFilter is Mongoose's mechanism for protecting against query selector injection attacks. In older versions of Mongoose, sanitizeFilter was not applied for countDocuments() 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.11
Workarounds
Middleware:
mongoose.plugin(function() {
schema.pre('countDocuments', function() {
// This will always apply `sanitizeFilter` on `countDocuments`
mongoose.sanitizeFilter(this.getFilter());
});
});
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