c0tton-fluff/burp-mcp-server

GitHub: c0tton-fluff/burp-mcp-server

为Burp Suite Pro提供MCP服务器和CLI客户端,使AI助手能够以结构化方式交互Burp,解决原生扩展输出冗长、浪费上下文的问题。

Stars: 1 | Forks: 0

# burp-mcp-server [![Go](https://img.shields.io/badge/Go-1.23+-00ADD8?logo=go&logoColor=white)](https://go.dev) [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![Release](https://img.shields.io/github/v/release/c0tton-fluff/burp-mcp-server)](https://github.com/c0tton-fluff/burp-mcp-server/releases) [Burp Suite Professional](https://portswigger.net/burp) 的 MCP server + 独立 CLI。允许像 Claude Code 这样的 AI 助手发送请求、读取 Proxy 历史记录、访问 Scanner 扫描结果、在 Repeater/Intruder 中暂存请求,以及运行 Race condition 攻击 —— 提供整洁的结构化响应、Body 限制和智能 Header 过滤。 ## 为什么开发这个 Burp 原生的 MCP 扩展会返回冗长的 `HttpRequestResponse{...}` 数据块,没有 Body 限制,HTTP/1.1 和 HTTP/2 工具是分开的,而且有 14+ 个工具浪费上下文。本项目用 11 个精简工具、10KB Body 限制、智能 Header 过滤、协议缓存、批量请求和结构化 JSON 输出取代了这一切。 ## 功能 - **智能 Header 过滤** -- 默认仅返回安全相关的 Header(Set-Cookie, CSP, CORS 等)。使用 `allHeaders: true` 获取所有内容。 - **统一 HTTP 发送** -- 自动检测 HTTP/2,超时 15 秒,回退到 HTTP/1.1。按主机缓存协议,以在重复请求时跳过失败的 HTTP/2。 - **Body 限制** -- 默认 10KB,可按请求配置(不再有 873KB 的响应数据块) - **仅 Header 模式** -- `headersOnly: true` 完全跳过 Body,用于快速侦察/指纹识别 - **批量发送** -- 在单个工具调用中并行发起多达 10 个请求,用于 IDOR/BAC 测试 - **整洁输出** -- `{statusCode, headers, body, bodySize, truncated}` 而非 Java toString 数据块 - **Proxy 历史记录** -- 精简摘要,支持可选正则过滤,并可按索引获取完整请求/响应 - **Scanner 扫描结果** -- 结构化的 `{name, severity, confidence, url, issueDetail}` - **Repeater/Intruder** -- 暂存请求以便手动跟进 - **Race condition 攻击** -- 跨并行连接的最后字节同步,输出去重 - **本地编/解码** -- URL 和 Base64 编码在 Go 中本地处理(无 SSE 往返)

MCP Server(用于 Claude Code / AI 助手)

### 架构 ``` Claude Code --> stdio --> burp-mcp-server (Go) --> SSE --> Burp Extension (port 9876) ``` ### 安装 ``` curl -fsSL https://raw.githubusercontent.com/c0tton-fluff/burp-mcp-server/main/install.sh | bash ``` 或从 [Releases](https://github.com/c0tton-fluff/burp-mcp-server/releases) 下载。
从源码构建 ``` git clone https://github.com/c0tton-fluff/burp-mcp-server.git cd burp-mcp-server go build -o burp-mcp-server . ```
### 快速开始 **1. 在 Burp 中启用 MCP** 在 Burp Suite 中:**MCP** 标签页 > 切换 **Enabled**(默认 `127.0.0.1:9876`)。 对于渗透测试/CTF 使用,取消勾选 "Require approval for history access"。 **2. 配置 MCP 客户端** 添加到 `~/.mcp.json`: ``` { "mcpServers": { "burp": { "command": "burp-mcp-server", "args": ["serve"], "env": { "BURP_MCP_URL": "http://127.0.0.1:9876/sse" } } } } ``` **3. 配合 Claude Code 使用** ``` "Send a GET request to https://example.com" "Check proxy history for requests to /api" "Show scanner findings" "Create a Repeater tab for this login request" "Batch send these 5 IDOR requests" "Race the transfer endpoint with 20 requests" ``` ### 工具参考 #### HTTP | 工具 | 描述 | |------|-------------| | `burp_send_request` | 发送 HTTP 请求,自动协议检测,智能 Header,Body 限制 | | `burp_batch_send` | 并行发送多达 10 个请求(用于 IDOR/BAC 测试) | | `burp_race_request` | 单包 Race condition 攻击,输出去重 | #### Proxy & Scanner | 工具 | 描述 | |------|-------------| | `burp_get_proxy_history` | 列出 Proxy 历史记录,支持可选正则过滤 | | `burp_get_request` | 按索引从 Proxy 历史记录获取完整请求 + 响应 | | `burp_get_scanner_issues` | 获取结构化的 Scanner 扫描结果 | #### 暂存 | 工具 | 描述 | |------|-------------| | `burp_create_repeater_tab` | 创建带请求的命名 Repeater 标签页 | | `burp_send_to_intruder` | 发送请求到 Intruder | #### 编码 | 工具 | 描述 | |------|-------------| | `burp_encode` | URL 或 Base64 编码(本地,无 Burp 往返) | | `burp_decode` | URL 或 Base64 解码(本地,无 Burp 往返) |
完整参数参考 #### burp_send_request | 参数 | 类型 | 默认值 | 描述 | |-----------|------|---------|-------------| | `raw` | string | required | 包含 Header 和 Body 的原始 HTTP 请求 | | `host` | string | from Host header | 目标主机(覆盖 Host Header) | | `port` | int | 443/80 | 目标端口 | | `tls` | bool | true | 使用 HTTPS | | `bodyLimit` | int | 10000 | 响应 Body 字节限制 | | `bodyOffset` | int | 0 | 响应 Body 字节偏移 | | `allHeaders` | bool | false | 返回所有 Header(默认:仅安全相关) | | `headersOnly` | bool | false | 仅返回状态 + Header,跳过 Body | #### burp_batch_send | 参数 | 类型 | 默认值 | 描述 | |-----------|------|---------|-------------| | `requests` | array | required | `{raw, host, port, tls, tag}` 对象数组(最多 10 个) | | `bodyLimit` | int | 10000 | 每个响应的 Body 限制 | | `allHeaders` | bool | false | 返回所有 Header | 数组中的每个请求: | 字段 | 类型 | 描述 | |-------|------|-------------| | `raw` | string | 原始 HTTP 请求 | | `host` | string | 目标主机 | | `port` | int | 目标端口 | | `tls` | bool | 使用 HTTPS | | `tag` | string | 用于在结果中标识此请求的标签 | #### burp_race_request | 参数 | 类型 | 默认值 | 描述 | |-----------|------|---------|-------------| | `raw` | string | required | 包含 Header 和 Body 的原始 HTTP 请求 | | `host` | string | from Host header | 目标主机 | | `port` | int | 443/80 | 目标端口 | | `tls` | bool | true | 使用 HTTPS | | `count` | int | 10 | 并发请求数(最多 50) | | `bodyLimit` | int | 500 | 每个响应的 Body 字节限制 | | `showAll` | bool | false | 返回所有单独响应而非去重分组 | #### burp_get_proxy_history | 参数 | 类型 | 默认值 | 描述 | |-----------|------|---------|-------------| | `count` | int | 10 | 条目数(最多 50) | | `offset` | int | 0 | 分页偏移 | | `regex` | string | | URL/内容正则过滤 | #### burp_get_request | 参数 | 类型 | 默认值 | 描述 | |-----------|------|---------|-------------| | `index` | int | required | Proxy 历史索引(从 1 开始,来自 burp_get_proxy_history) | | `bodyLimit` | int | 10000 | 响应 Body 字节限制 | | `bodyOffset` | int | 0 | 响应 Body 字节偏移 | | `allHeaders` | bool | false | 返回所有 Header | #### burp_get_scanner_issues | 参数 | 类型 | 默认值 | 描述 | |-----------|------|---------|-------------| | `count` | int | 10 | Issue 数量(最多 50) | | `offset` | int | 0 | 分页偏移 | | `detailLimit` | int | 500 | 每个 Issue 详情的最大字符数(-1 = 无限制) | #### burp_create_repeater_tab / burp_send_to_intruder | 参数 | 类型 | 默认值 | 描述 | |-----------|------|---------|-------------| | `raw` | string | required | 原始 HTTP 请求 | | `host` | string | required | 目标主机名 | | `port` | int | 443/80 | 目标端口 | | `tls` | bool | true | 使用 HTTPS | | `tabName` | string | | 标签页名称 | #### burp_encode / burp_decode | 参数 | 类型 | 描述 | |-----------|------|-------------| | `content` | string | 要编码/解码的内容 | | `type` | string | `url` 或 `base64` |
### 响应格式 默认响应(仅安全 Header): ``` { "statusCode": 200, "headers": { "Content-Type": "application/json; charset=utf-8", "Set-Cookie": "session=abc123; HttpOnly; Secure" }, "body": "{\"id\":1,\"username\":\"admin\",\"role\":\"superuser\"}", "bodySize": 52, "truncated": false } ``` 仅 Header 模式(`headersOnly: true`)省略 `body` —— 适用于侦察: ``` { "statusCode": 200, "headers": { "Content-Type": "text/html", "Server": "nginx/1.24.0", "X-Powered-By": "Express" }, "bodySize": 87342 } ``` ### Race Condition 攻击 `burp_race_request` 实现了 James Kettle 研究中的 [single-packet attack](https://portswigger.net/research/smashing-the-state-machine) 技术。它完全绕过 Burp 的代理以确保计时精度。 **工作原理:** 1. 打开 N 个到目标的并行 TLS/TCP 连接 2. 在每个连接上发送 HTTP 请求的所有非最后字节 3. 同时在所有连接上发送最后一个字节(last-byte sync) 4. 并行读取并解析所有响应 这与 Turbo Intruder 使用的技术相同 —— 但可以直接从 Claude Code 调用,无需 Burp UI 交互。 **功能:** - 根据实际 Body 自动计算 `Content-Length`(无需手动数字节) - 通过 TLS ALPN 强制使用 HTTP/1.1(避免 HTTP/2 升级问题) - 默认对相同响应进行去重(节省 token) - 返回带有每个响应 Body 限制的结构化结果 **配合 Claude Code 使用示例:** ``` "Race the convert-currency endpoint with 20 concurrent requests" ``` **默认响应(去重):** ``` { "groups": [ { "statusCode": 200, "body": "{\"message\":\"Currency converted successfully\"}", "count": 18, "indices": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17] }, { "statusCode": 400, "body": "{\"error\":\"Insufficient balance\"}", "count": 2, "indices": [18, 19] } ], "summary": "20 requests sent, responses: 18x 200, 2x 400" } ``` 使用 `showAll: true` 获取单独响应而非分组。 ### 批量请求 `burp_batch_send` 并行发送多达 10 个请求。为每个请求打上标签以便在结果中识别: ``` { "requests": [ {"raw": "GET /api/users/1 HTTP/1.1\r\nHost: target.com\r\nAuthorization: Bearer user_token", "tag": "user-view-own"}, {"raw": "GET /api/users/2 HTTP/1.1\r\nHost: target.com\r\nAuthorization: Bearer user_token", "tag": "user-view-other"}, {"raw": "GET /api/users/1 HTTP/1.1\r\nHost: target.com", "tag": "no-auth"} ] } ``` 响应: ``` { "responses": [ {"tag": "user-view-own", "statusCode": 200, "body": "{\"id\":1,...}"}, {"tag": "user-view-other", "statusCode": 200, "body": "{\"id\":2,...}"}, {"tag": "no-auth", "statusCode": 401, "body": "{\"error\":\"unauthorized\"}"} ], "summary": "3 requests, responses: 2x 200, 1x 401" } ```

独立 CLI(用于终端使用)

用于 Burp Suite 的独立命令行客户端。无需 MCP —— 通过 Burp 的代理监听器发送请求,使其显示在 Proxy > HTTP History 中。除 Python stdlib 外零依赖。 ### 安装 ``` curl -fsSL https://raw.githubusercontent.com/c0tton-fluff/burp-mcp-server/main/install.sh | TOOL=cli bash ``` 或从 [Releases](https://github.com/c0tton-fluff/burp-mcp-server/releases) 下载。 ### 用法 要求 Burp Suite 运行并在 `127.0.0.1:8080` 上开启代理监听器(默认)。 ``` # 发送结构化请求(通过 Burp 代理) burp send GET https://target.com/api/users burp send POST https://target.com/api/login -j '{"user":"admin","pass":"test"}' burp send PUT https://target.com/api/profile -H "Authorization: Bearer tok" -j '{"role":"admin"}' # 发送原始 HTTP 请求 burp raw -f request.txt target.com echo -e 'GET / HTTP/1.1\r\nHost: example.com\r\n\r\n' | burp raw # 竞态条件攻击(末字节同步,直接发送 -- 绕过代理) burp race target.com -f transfer.txt -n 20 # 跳过代理,直接发送 burp send GET https://target.com/api/health --direct # 编码/解码 burp encode base64 "hello world" burp decode url "%3Cscript%3E" burp encode hex "test" ``` ### CLI 命令 | 命令 | 描述 | |---------|-------------| | `send METHOD URL` | 通过 Burp 代理发送结构化 HTTP 请求 | | `raw [HOST]` | 从文件或标准输入发送原始 HTTP 请求 | | `race [HOST]` | 单包最后字节同步 Race condition 攻击(直连) | | `encode TYPE VALUE` | 编码值(url, base64, hex) | | `decode TYPE VALUE` | 解码值(url, base64, hex) | ### 全局参数 | 参数 | 描述 | |------|-------------| | `--proxy` | Burp 代理地址(默认 `127.0.0.1:8080`,或设置 `BURP_PROXY`) | | `--direct` | 跳过代理,直接连接目标 | | `--all-headers` | 返回所有响应 Header(默认:仅安全相关) | | `-b, --body-limit` | 响应 Body 字节限制(默认 10000) | | `-t, --timeout` | 请求超时秒数(默认 30) |
## 故障排除 | 错误 | 修复 | |-------|-----| | 工具未出现 | 验证 `~/.mcp.json` 中的二进制路径,重启 Claude Code | | 连接被拒绝 (MCP) | 确保 Burp 正在运行且 MCP 已在端口 9876 上启用 | | 连接被拒绝 (CLI) | 确保 Burp 代理监听器在端口 8080 上 | | 请求挂起 | HTTP/2 超时 + 回退会自动处理此问题(首次 15 秒,之后缓存) | | Proxy 历史为空 | 仅显示浏览器通过代理的流量,而非 MCP `send_request` 调用 | 检查 MCP 日志:`~/.cache/claude-cli-nodejs/*/mcp-logs-burp/` ## 前置条件 - Burp Suite Professional(Community 版 MCP 支持有限) 来自 BApp Store 的 Burp MCP Server 扩展 - 在启动 Claude Code 之前运行 Burp 并启用 MCP ## 许可证 MIT
标签:AI辅助, API安全, BAC测试, Burp Suite, C2日志可视化, CISA项目, Claude Code, EVTX分析, Go语言, HTTP/2, HTTP请求, IDOR测试, Intruder, JSON输出, Linux取证, MCP服务器, PortSwigger, Repeater, Web安全, 代理历史, 协议缓存, 响应结构化, 指纹识别, 日志审计, 程序破解, 竞态条件, 网络安全, 蓝队分析, 请求批处理, 隐私保护