mongoose
Affected
- introduced
0, fixed6.13.11(semver)
Fixed versions
6.13.11
Fix
- Fixed version
6.13.11npm install [email protected]
Advisory
Also known as: CVE-2026-125120
Mongoose: sanitizeFilter not applied on countDocuments
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.11Workarounds
Middleware:
mongoose.plugin(function() {
schema.pre('countDocuments', function() {
// This will always apply `sanitizeFilter` on `countDocuments`
mongoose.sanitizeFilter(this.getFilter());
});
});Critical Basis: The source's own band: CRITICAL
0, fixed 6.13.11 (semver)6.13.11
6.13.11npm install [email protected]7.0.0, fixed 7.8.12 (semver)7.8.12
7.8.12npm install [email protected]8.0.0, fixed 8.24.3 (semver)8.24.3
8.24.3npm install [email protected]9.0.0, fixed 9.9.2 (semver)9.9.2
9.9.2npm install [email protected]Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0