Vulnerability GHSA-pcrw-h46h-c93h

Critical
CRITICAL RISK
CVSS Score: 9.8
Score Range: 9.0–10.0
Critical severity vulnerabilities (CVSS 9.0–10.0). These represent the highest impact issues.
9 hours ago
November 10, 2026 at 07:37 PM UTC
Mongoose: sanitizeFilter not applied on countDocuments
<6.13.11, >=7.0.0 <7.8.12, >=8.0.0 <8.24.3, >=9.0.0 <9.9.2
<6.13.11, >=7.0.0 <7.8.12, >=8.0.0 <8.24.3, >=9.0.0 <9.9.2

Summary

Mongoose: sanitizeFilter not applied on countDocuments

Details

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());
  });
});

Related Vulnerabilities

Other vulnerabilities affecting the same packages

View all vulnerabilities for these packages

Impacted packages

Timeline

Published
9 hours ago
November 10, 2026 at 07:37 PM UTC
Fixed (9.9.2)
3 months ago
August 10, 2026 at 06:23 PM UTC
Fixed (8.24.3)
3 months ago
August 10, 2026 at 06:42 PM UTC
Fixed (7.8.12)
3 months ago
August 10, 2026 at 07:27 PM UTC
Fixed (6.13.11)
3 months ago
August 10, 2026 at 08:03 PM UTC
Last Modified
9 hours ago
November 10, 2026 at 07:45 PM UTC