제출 #1093952: eosphoros-ai DB-GPT v0.8.2 SQL Injection정보

제목eosphoros-ai DB-GPT v0.8.2 SQL Injection
설명DB-GPT Release, Revision, or Tag `eosphorosai/dbgpt-openai:v0.8.2` (release tag `v0.8.2`, commit `83609c47`) — also present on current `main` (the f-string DAO construction is identical; verified 2026-11-10). ### Description The datasource-registry DAO builds SQL with Python f-strings over caller-controlled values, and two reachable routes feed it: 1. **Read-side** — `GET /api/v1/chat/db/list` passes the caller's declared identity (`user-id` header) into `get_db_list(user_id=...)`, which interpolates it into `user_id='{user_id}'`. A single quote breaks the literal: attacker-controlled predicates and content manipulation. 2. **Write-side (more severe)** — `POST /api/v1/chat/db/edit` feeds body fields into `update_db_info`, which interpolates **every SET column and the WHERE key** into one UPDATE. Injected SET/WHERE fragments let a caller rewrite **arbitrary rows** of the connector registry — other users' datasource connection targets and stored credentials — without passing any ownership check. ```python # connect_config_db.py:229-241, 176-197 (v0.8.2 and main) elif user_id: sql = f"SELECT * FROM connect_config where user_id='{user_id}' or user_id='' or user_id IS NULL" ... update_statement = text( f"UPDATE connect_config set db_type='{db_type}', db_host='{db_host}', " f"db_port={db_port}, db_user='{db_user}', db_pwd='{db_pwd}', " f"comment='{comment}' where db_name='{db_name}'" ) ``` The same file's `get_db_config`/`delete_db` use bound parameters correctly — the fix pattern already exists in the codebase. Backing store is SQLite; `session.execute(text(sql))` executes a single statement (no stacked queries) — UNION extraction and SET/WHERE breakout still apply, stated as such. ### Root cause - Entry routes: `GET /api/v1/chat/db/list` (read), `POST /api/v1/chat/db/edit` (write) - Preconditions: network reachability (declared-identity auth mode) - Vulnerable code: `connect_config_db.py::get_db_list` (L229-241) and `update_db_info` (L176-197); call sites `api_v1.py:174-190` and `:208-213` - Root cause family: CWE-89 (SQL Injection), string-formatted SQL - Controlling factor: quoting in payloads; single-statement engine limit (no stacking) honestly noted # Steps to reproduce Dynamic proofs fired 2026-11-10 on the unmodified v0.8.2 container (evidence: `CrossOp-Lab/results_sqli_know_shots.json`). Setup: `alice` owns datasource `sqli_v1`, `bob` owns `sqli_v2` (both sqlite; `mallory` is a third declared identity). 1. Read-side boolean differentiation: ```bash curl -s 'http://localhost:5670/api/v1/chat/db/list' -H "user-id: x' OR '1'='1" curl -s 'http://localhost:5670/api/v1/chat/db/list' -H "user-id: x' OR '1'='2" ``` Observed: with the tautology payload, **alice's private `sqli_v1` appears** in the response; with the false payload it does not (both HTTP 200) — attacker-controlled predicate execution over the registry query. 2. Write-side cross-row rewrite — `mallory` edits a name he can address, injecting a second WHERE target into `comment`: ```bash cat > body.json <<'EOF' {"db_name":"sqli_v1","db_type":"sqlite","db_path":"","db_host":"","db_port":0, "db_user":"","db_pwd":"", "comment":"legit', db_path='/app/pilot/tmp/xop/attacker.db' WHERE db_name='sqli_v2'-- "} EOF curl -s -X POST http://localhost:5670/api/v1/chat/db/edit -H 'user-id: mallory' \ -H 'Content-Type: application/json' -d @body.json ``` Observed: HTTP 200; the registry row for **`sqli_v2` (bob's datasource)** now shows `db_path=/app/pilot/tmp/xop/attacker.db` — an arbitrary cross-owner registry-row rewrite via the UPDATE injection (`mallory` never had any access to `sqli_v2`; its name was not even visible to him in listings). 3. Control — the same edit without the injected fragment updates only `sqli_v1`'s row. ### Expected behaviour Parameterized statements (the pattern already used by `get_db_config` / `delete_db` in the same file); quotes in `user_id`, `db_name`, and every SET column must be inert. ### Observed Behaviour Attackers control SELECT predicates through the identity header and rewrite arbitrary `connect_config` rows — including other users' connection targets and credentials — through the edit route. # Impact The registry is the resolution source for every database connection the product makes: rewriting one row's `file_path`/`db_host`/`db_user`/`db_pwd` silently redirects every subsequent query under that name to an attacker-chosen database with attacker-chosen credentials (credential capture when the product connects outbound with the rewritten values). UNION-based extraction reads other tables in the same registry database. Type precedent: CVE-2024-10835 established DB-GPT SQL-injection findings are accepted; this is a different component (registry DAO) with a write primitive.
원천⚠️ https://github.com/eosphoros-ai/DB-GPT/issues/3393
사용자
 Anonymous User
제출2026. 11. 13. AM 03:47 (24 날 ago)
모더레이션2026. 12. 06. PM 09:59 (24 days later)
상태수락
VulDB 항목450890 [eosphoros-ai DB-GPT 까지 0.8.2 Datasource Registry Dao connect_config_db.py get_db_list/update_db_info user_id/db_name SQL 주입]
포인트들20

Do you know our Splunk app?

Download it now for free!