Tips

NoSQL injection tips

NoSQL injection changes the meaning of a query in databases such as MongoDB by sending operators instead of plain values. Login forms and search filters that accept JSON are common entry points.

Published tips, newest first. Payloads and commands are shown as plain text.

NoSQL injection: how to hunt it

Where to look

  • JSON bodies where a string can become an object such as {"$ne": null}; keep your own username fixed, or a login bypass picks a real user.
  • Query strings parsed into objects, such as username[$ne]=x.
  • Server-side JavaScript in $where clauses and aggregation pipelines.
  • True-or-false and timing differences that let data be read one character at a time.

What proves it

Show the operator changing the result, such as signing in to your own test account without its password, or a difference on a harmless field.

Read further

Writeups on NoSQL injection, by hunters and researchers, most with a short summary.

Related classes