OWASP Hunting

Injection

NoSQL Injection

NoSQL injection manipulates queries in document and key-value databases like MongoDB, Redis, and CouchDB by injecting operators or special syntax.

Payloads are read from main at 35c1f2b (committed 22 Nov 2026). Project version 1.0.2.

These payloads are for authorized testing only: systems you own, authorized bug bounty programs, or controlled lab environments. Unauthorized testing is illegal.

Payload files

Folder on GitHub

Use the arrow keys to move between payloads. Press Enter or C to copy the focused payload.

nosql-injection-payloads.txt

173 payloads · 9.1 KB
Source

Loading payloads for NoSQL Injection…

What it is#

NoSQL injection is a vulnerability where an attacker can inject or manipulate NoSQL queries to bypass authentication, extract data, or perform unauthorized operations. Unlike SQL injection, NoSQL injection often targets operator injection (MongoDB $ne, $gt, $regex), JSON body manipulation, or Redis command injection rather than string-based query manipulation.

Attack vectors#

  • Login forms passing credentials to MongoDB find()/findOne()
  • Search parameters parsed as JSON objects
  • API endpoints accepting JSON request bodies
  • Query string parameters that map to database operators
  • Cookie values used in database lookups

Testing methodology#

  1. Test MongoDB operator injection: replace string values with {$ne: null}
  2. Submit JSON with $gt, $lt, $regex operators in parameter values
  3. Test for authentication bypass by injecting {$gt: ''} in password field
  4. Try array injection in parameters expecting strings
  5. Test Redis command injection in connection string parameters

Indicators of vulnerability#

  • Authentication succeeds with injected operators instead of valid credentials
  • Query returns all documents when operators like $ne or $gt are injected
  • Application reflects or exposes raw MongoDB query errors
  • Unexpected data returned for manipulated query parameters

Detection guidance#

Validate that JSON inputs only contain expected scalar types, not objects. Monitor for MongoDB operator keys ($ne, $gt, $regex, $where) appearing in request parameters. Use schema validation on incoming data.

Mitigation and remediation#

  • Validate that query parameters are expected scalar types before use
  • Reject inputs containing MongoDB operator keys ($ne, $gt, $where, etc.)
  • Use a schema validation library to enforce input structure
  • Avoid constructing queries from raw user-supplied JSON objects
  • Apply field-level encryption for sensitive data in the database

References#

Responsible Use

All content in this reference is for authorized security testing only. Use only on systems you own or have explicit written permission to test.

  • Systems and applications you own
  • Authorized penetration testing engagements
  • Bug bounty programs with defined scope
  • Educational lab environments (DVWA, WebGoat, HackTheBox)