DB-GPT Arbitrary File Write vulnerability
The web API endpoint for running chart SQL queries lacks access control, allowing arbitrary SQL execution. An attacker could use this to write arbitrary files to the victim's file system, potentially leading to remote code execution by placing malicious Python files in site-packages.
eosphoros-ai/DB-GPT
Originally disclosed on huntr
In eosphoros-ai/db-gpt version v0.6.3 and earlier, the web API POST /api/v1/editor/chart/run allows execution of arbitrary SQL queries without any access control. This vulnerability can be exploited by attackers to perform Arbitrary File Write, enabling them to write arbitrary files to the victim's file system. This can potentially lead to Remote Code Execution (RCE) by writing malicious files such as __init__.py in the Python's /site-packages/ directory.
From the GitHub Advisory Database (GHSA-7gj6-22m4-qfhx, 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 API endpoint lacks authentication and authorization checks, and the underlying database user has file write privileges, allowing SQL queries to write files to the server's filesystem.
Impact
An attacker could write arbitrary files to the victim's file system, potentially leading to remote code execution by writing malicious files such as __init__.py in the Python site-packages directory.
What the attacker needed
Access to the web API 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.
This is a web application that lets users run database queries. The endpoint that runs these queries does not check who is calling it, so anyone can send SQL commands. Because the database can write files to disk, an attacker can use SQL to create files on the server, and if they write a Python file in the right place, the server might run it as code.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.