
NoSQL databases such as MongoDB do not use SQL, but they are still vulnerable to injection. NoSQL injection happens when user input is placed into a database query object or operator, changing what the query does.
Many teams assume that moving away from SQL removed injection risk. It did not.
Web frameworks often turn JSON bodies or query strings straight into objects. If an attacker sends an operator such as {"$ne": null} instead of a plain value, a login query that should match one user can match any user.
Server-side JavaScript evaluation in some databases adds a further route to injection.
$ or contain . in user-supplied objects.Yes. If user input is placed into a query object without type checks, attackers can inject operators such as $ne or $gt and change the query's meaning.
Validate input types, reject keys starting with $, use your driver's query builders, and never pass raw request objects into database queries.
Try Vooki Pro free for 7 days
Test your APIs and web app for NoSQL injection in one scan. The trial unlocks every feature for 7 days, and scanning runs on your own machine.
Related: Blind SQL injection: how it works and how to stop it · Server-side template injection (SSTI)