Skip to content
A detailed explainer is available in Japanese. Read the Japanese explainer
Critical 9.8

MongooseのcountDocumentsに脆弱性、修正版あり

CVE-2026-125120 First seen on SecPulse

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

PackageAffected → Fixed
Automatticmongoose —
npmmongoose
≥ 9.0.0, < 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.

  1. ^9.9.2
  2. ^8.24.3
  3. ^7.8.12
  4. ^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

We use cookies for analytics and ad measurement. This setting applies to all Game co., Ltd. sites. Details