DB-GPT Absolute Path Traversal in knowledge/{space_name}/document/upload
The knowledge file upload endpoint in DB-GPT 0.6.0 uses a user-controlled filename without sanitisation, allowing absolute path traversal. An attacker could write files to arbitrary locations on the server.
eosphoros-ai/DB-GPT
Originally disclosed on huntr
eosphoros-ai/db-gpt version 0.6.0 is vulnerable to an arbitrary file write through the knowledge API. The endpoint for uploading files as 'knowledge' is susceptible to absolute path traversal, allowing attackers to write files to arbitrary locations on the target server. This vulnerability arises because the 'doc_file.filename' parameter is user-controllable, enabling the construction of absolute paths.
From the GitHub Advisory Database (GHSA-j9g7-mqhh-9hxf, 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
The application used the user-supplied 'doc_file.filename' directly when building the save path, without validating or sanitising it, so absolute paths were accepted.
Impact
An attacker could write files to arbitrary locations on the target server, which may lead to further compromise depending on what files can be overwritten.
What the attacker needed
Access to the knowledge upload endpoint
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.
When you upload a file, the server normally saves it in a specific folder. Here, the server trusted the filename supplied by the user, so someone could give a filename that points to a completely different folder on the computer. That let them create or overwrite files anywhere the server process was allowed to write.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.