Pentest api

From OpenAisec/Miko · View interactive version

Pentest api is an AI agent skill from the GitHub repository OpenAisec/Miko. API发现与未授权测试入口 - 主动探测各类API端点,对发现的API进行未授权访问测试

How to use this skill

Skill file

API 发现与未授权测试

文件组织

tmp/<时间戳>/raw/api/
├── rest_probes.json
├── api_endpoints.txt      # 合并去重后的全部API端点
├── rest_unauth.txt
├── auth_bypass.txt
├── swagger/
├── soap/
└── graphql/

阶段1:REST API 主动探测

# httpx 探针批量检测
"{{AITOOLS_DIR}}/httpx_1.9.0_windows_amd64/httpx.exe" \
  -u <target> \
  -path /api/,/api/v1/,/api/v2/,/api/admin/,/api/user/,/api/login,/api/register,/rest/,/v1/,/v2/,/openapi/ \
  -title -status-code -content-length -json -o <项目tmp>/api/rest_probes.json

# ffuf API路径模糊
"{{AITOOLS_DIR}}/ffuf_2.1.0_windows_amd64/ffuf.exe" \
  -w <api_wordlist> -u <target>/api/FUZZ \
  -mc 200,201,401,403 -fs <default_page_size> -t 30 -maxtime 300 \
  -o <项目tmp>/api/ffuf_fuzz.json -of json

阶段2:未授权访问测试

对所有发现的API端点发送不携带认证信息的请求。

判断规则(必须看响应内容):

| 响应 | 判断 |

|------|------|

| 200 + JSON数据 | 未授权漏洞 |

| 200 + index.html(SPA) | SPA fallback,API不存在 |

| 200 + {"code":"xxx"} | API存在,需认证 |

| 401/403 | API存在,需认证 |

| 302 → 登录页 | 需认证 |

阶段3:通用认证绕过(快速)

重点:无Token直接访问(阶段2已做)→ 伪造简单Token(Bearer test/Bearer admin) → HTTP方法变换(GET→POST/PUT) → Content-Type变换。

完整认证绕过测试见 pentest-login 阶段3(空Token伪造/JWT none/自定义头/路径修改/参数覆盖/IP绕过)。

阶段4:API端点汇总

所有来源(本阶段主动探测 + pentest-js JS提取 + 子技能发现)合并去重,按分类整理:认证相关/数据操作/文件操作/管理功能/敏感信息。

子技能触发

| 检测特征 | 触发 |

|----------|------|

| Swagger/OpenAPI端点可访问 | swagger.md |

| ?wsdl返回XML或.asmx | soap.md |

| /graphql端点存活 | graphql.md |

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.