Intel

AIKIDO-2026-943691

mongoose is vulnerable to NoSQL Injection

NoSQL Injection Pre-CVE
Found by Aikido Intel before public disclosure or CVE publication.
Published 4 days ago

59

Medium Risk

This Affects:

JSmongoose
6.0.0 - 6.13.10
Fixed in 6.13.11
7.0.0 - 7.8.11
Fixed in 7.8.12
8.0.0 - 8.24.2
Fixed in 8.24.3
9.0.0 - 9.9.1
Fixed in 9.9.2
Are you affected? Scan for Free

TL;DR

Mongoose executes count, countDocuments, and cursor queries by casting the filter through a path that does not apply the sanitizeFilter option. When an application enables sanitizeFilter and passes user-controlled input into these query methods, embedded MongoDB query operators such as $ne or $where are not neutralized the way they are for other query methods. Untrusted operators can therefore alter query semantics or evaluate server-side predicates, defeating the sanitization the application relies on. The fix routes these executions through _castConditions, applying sanitizeFilter and rejecting disallowed operators.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and your application enables the sanitizeFilter option and passes user-controlled input directly into count, countDocuments, or cursor queries.

Background info

mongoose is vulnerable to NoSQL Injection in versions 9.0.0 - 9.9.1, 8.0.0 - 8.24.2, 7.0.0 - 7.8.11 and 6.0.0 - 6.13.10.

How to fix this

Upgrade the mongoose library to the patch version.