Description
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.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| eosphoros-ai | DB-GPT | 0.8.0 – < 0.8.1 | 0.8.1 |
References
- https://github.com/eosphoros-ai/DB-GPT product
- https://github.com/eosphoros-ai/DB-GPT/blob/v0.8.0/packages/dbgpt-app/src/dbgpt_app/openapi/api_v1/agentic_data_api.py technical-description
- DB-GPT v0.8.1 Release Notes release-notes
- https://pypi.org/project/dbgpt-app/ product
- VulnCheck Advisory: DB-GPT 0.8.0 Path Traversal Arbitrary File Write via Skill Upload Filename third-party-advisory