DBHub MCP database server: 'SELECT 1--1;DROP TABLE victim' slips past read-only mode on MySQL and MariaDB, so a prompt-injected agent can write and drop tables; fixed in 0.22.6
- Bug:
scanSingleLineCommentinsrc/utils/sql-parser.tsstarts a comment at any--. MySQL and MariaDB only do so when whitespace, a control character or end of line follows. - Why it executes:
execute-sql.tschecks each split statement withisReadOnlySQLbut sends the original string, and the MySQL/MariaDB connectors open their pools withmultipleStatements: true. - Proof: the advisory shows DBHub's own parser returning one read-only statement for
SELECT 1--1;DROP TABLE victim, and MariaDB 11.4 executingSELECT 1 - -1and then dropping the table. - Realistic attacker: anyone who can influence the SQL the agent writes, most likely via prompt injection in content the agent reads. Severity: GitHub rates it medium (CVSS 4.0 6.1, user interaction required).
- Fix:
@bytebase/dbhub0.22.6 (PR #342).
Lesson for any agent database tool: a parser-based read-only filter is not a security boundary. Give the agent a database user that only has SELECT grants (or a read replica), execute only the statements you validated, and keep multi-statement execution off.
Sources: GitHub advisory GHSA-j656-3hf2-fvjc (Nov 2) · bytebase/dbhub security advisory · Fix PR #342 · dbhub v0.22.6 release