DB-GPT vulnerable to Arbitrary File Upload with Path Traversal
The file upload endpoint in DB-GPT v0.6.0 did not restrict where uploaded files were written, so an unauthenticated attacker could place arbitrary files anywhere on the server's filesystem. By writing a malicious Python file into the site-packages directory, an attacker could potentially achieve remote code execution.
dbgpt
Originally disclosed on huntr
In eosphoros-ai/db-gpt version v0.6.0, the web API POST /v1/personal/agent/upload is vulnerable to Arbitrary File Upload with Path Traversal. This vulnerability allows unauthorized attackers to upload arbitrary files to the victim's file system at any location. The impact of this vulnerability includes the potential for remote code execution (RCE) by writing malicious files, such as a malicious __init__.py in the Python's /site-packages/ directory.
From the GitHub Advisory Database (GHSA-3xq5-x4fj-rff7, CC BY 4.0).
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the upload handler used the user-supplied filename or path without sanitising path traversal sequences or restricting the destination directory.
Impact
An unauthenticated attacker could write files anywhere on the server, potentially leading to remote code execution by planting a malicious Python module in site-packages.
What the attacker needed
Network access to the web API; no authentication required
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A file upload feature is supposed to save files into one safe folder. Here the server trusted the name the uploader gave and used it to decide where to save, so someone could use path tricks to save a file outside that folder. If they can save a Python file in a place the application later imports, they can run their own code on the server.
What is File upload?
An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.