VAITP Dataset

← Back to the dataset

CVE-2026-80104

Path traversal in file upload allows unauthenticated arbitrary file write and code execution.

  • CVSS 9.3
  • CWE-22
  • Input Validation and Sanitization
  • Remote

DB-GPT builds the destination path for an uploaded skill from the multipart filename without constraining it to the upload directory. skill_upload in packages/dbgpt-app/src/dbgpt_app/openapi/api_v1/agentic_data_api.py takes file.filename as given and writes the request body to upload_dir / filename. A path composed with that operator discards the left operand when the right one is absolute and follows parent references otherwise, so a filename such as ../../../tmp/x or /tmp/x resolves outside the intended directory; nothing canonicalises the result, checks that it remains under the upload root, or prevents a .py suffix. The route's only dependency is get_user_from_headers in dbgpt_serve/utils/auth.py, which returns a request carrying the admin role whether or not a user_id header is supplied, so the endpoint is reachable without credentials. A remote attacker holding no account can therefore write attacker-controlled bytes to any path the server process can write, place a new Python module inside the application package or replace one the application already imports, and obtain code execution in the server process when that module is next imported.

CVSS base score
9.3
Published
2026-08-25
OWASP
A08 Software and Data Integrity Failures
Orthogonal defect classification
Checking
Code defect classification
Missing Check
Category
Input Validation and Sanitization
Subcategory
Path Traversal
Accessibility scope
Remote
Impact
Arbitrary Code Execution
Affected component
Python

Solution

Upgrade DB‑GPT to v0.2.1 or later, which adds proper filename sanitisation (rejects absolute paths, resolves “..” components, enforces the upload directory and blocks “.py” files) and fixes the authentication bypass in get_user_from_headers. After upgrading, also ensure the server runs with least‑privilege file permissions.

Vulnerable code sample

import pathlib
from fastapi import APIRouter, UploadFile, Depends, Request
from dbgpt_serve.utils.auth import get_user_from_headers

router = APIRouter()
UPLOAD_ROOT = pathlib.Path("/var/dbgpt/uploads")

@router.post("/skill_upload")
async def skill_upload(
    request: Request,
    file: UploadFile,
    user=Depends(get_user_from_headers),
):
    # VULNERABLE: path traversal via unvalidated filename
    dest_path = UPLOAD_ROOT / file.filename
    with dest_path.open("wb") as out_file:
        while chunk := await file.read(1024):
            out_file.write(chunk)
    return {"status": "ok"}

Patched code sample

import pathlib
from fastapi import APIRouter, UploadFile, Depends, Request, HTTPException
from dbgpt_serve.utils.auth import get_user_from_headers

router = APIRouter()
UPLOAD_ROOT = pathlib.Path("/var/dbgpt/uploads")

@router.post("/skill_upload")
async def skill_upload(
    request: Request,
    file: UploadFile,
    user=Depends(get_user_from_headers),
):
    # FIX: sanitize filename and enforce directory confinement
    sanitized_name = pathlib.Path(file.filename).name  # strip any path components
    dest_path = (UPLOAD_ROOT / sanitized_name).resolve()
    if not str(dest_path).startswith(str(UPLOAD_ROOT.resolve())):
        raise HTTPException(status_code=400, detail="Invalid filename")
    if dest_path.suffix == ".py":
        raise HTTPException(status_code=400, detail="Disallowed file type")
    with dest_path.open("wb") as out_file:
        while chunk := await file.read(1024):
            out_file.write(chunk)
    return {"status": "ok"}

Cite this entry

@misc{vaitp:cve202680104,
  title        = {{Path traversal in file upload allows unauthenticated arbitrary file write and code execution.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-80104},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-80104/}}
}

Download this entry as JSON Download the whole dataset

Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.