Mongoose: Connection-level sanitizeFilter bypass (CVE-2026-125119)
A bug in Mongoose allows MongoDB query selector injection due to the failure of connection-level sanitizeFilter configurations to apply, potentially enabling unauthorized record access.
CVE search metadata
CVE search record: CVE-2026-125119. Severity: high. CVSS: 7.5. EPSS: 0.54%. KEV: no. Product: Mongoose (>= 6.0.0, < 6.13.12), Mongoose (>= 7.0.0, < 7.8.13), Mongoose (>= 8.0.0, < 8.24.7), Mongoose (>= 9.0.0, < 9.11.4). Brief: Mongoose: Connection-level sanitizeFilter bypass (CVE-2026-125119). Brief link: https://feed.craftedsignal.io/briefs/2026-11-mongoose-sanitizefilter/
Triage facts
Revision 1- Applicability
- Mongoose (>= 6.0.0, < 6.13.12), Mongoose (>= 7.0.0, < 7.8.13) +2
- Evidence
- Unknown
- Severity
- High
- Action
- Elevated
- Sources
- 1 public source
- Freshness
- Revision 1Nov 11, 02:05 UTC
- Vulnerabilities
- 1 CVE
- Source quality
- A1Likely
Mongoose fails to apply the sanitizeFilter security option when configured at the connection level via mongoose.connect() or createConnection(). While the connection reports the option as enabled, internal query casting logic fails to reference the configuration, rendering it ineffective. Applications relying on this setting to mitigate query selector injection remain vulnerable to attacks where malicious operators, such as { $ne: null }, are passed into query filters. This issue affects Mongoose versions 6.x, 7.x, 8.x, and 9.x.
Impact
Attackers can bypass application-level authentication and data filtering by injecting MongoDB query operators into user-controlled input fields. For instance, passing an operator object as a password or username value can cause the database to return documents that should otherwise be restricted.
Recommendation
- Upgrade Mongoose to a patched version: v6.13.12, v7.8.13, v8.24.7, or v9.11.4.
- Until patching is possible, shift from connection-level configuration to global or query-level sanitization:
- Use global settings:
mongoose.set('sanitizeFilter', true). - Use query-level settings:
Model.find().sanitizeFilter(true). - Audit existing application logic for dependencies on connection-level security configurations.
Immediate actions
Patch Mongoose to the versions specified in the affected products section.
Threat Hunt
Identify applications using connection-level sanitizeFilter and query parameters containing MongoDB operator objects.
Data: Application logs capturing raw query filter structures, Web server access logs capturing POST bodies
Mitigations
Implement global or query-level sanitizeFilter as a temporary workaround.
CVE-2026-125119