Executive brief
Mongoose is a popular tool used by developers to connect Node.js applications to MongoDB databases. A security flaw in its data cleaning feature allows attackers to bypass safety checks by using specific database commands. This could lead to unauthorized access to sensitive information or allow attackers to bypass login screens if the application handles user input insecurely.
Technical details
A NoSQL injection vulnerability exists in Mongoose's 'sanitizeFilter' mechanism. While the feature is designed to wrap query operators in '$eq' to neutralize them, it failed to include the '$nor' logical operator in its recursive sanitization routine. Because '$nor' accepts an array and arrays do not trigger the internal 'hasDollarKeys()' check, an attacker can inject malicious operators like '$ne', '$gt', or '$regex' within a '$nor' clause. This bypass is effective when applications pass unsanitized user-controlled objects (e.g., 'req.body') directly into query methods. The issue is resolved in versions 6.13.9, 7.8.9, 8.22.1, and 9.1.6.
Affected products
- Automattic Mongoose < 6.13.9, 7.0.0 - 7.8.8, 8.0.0 - 8.22.0, 9.0.0 - 9.1.5
Timeline
- 2026-05-01: advisory: GitHub Security Advisory published
- 2026-05-14: disclosed: CVE published to NVD