DBHub: MySQL and MariaDB comment interpretation bypasses read-only SQL validation
Impact
DBHub is a database MCP server for Postgres, MySQL, SQL Server, Oracle, MariaDB, SQLite. Prior to 0.22.6, read-only SQL validation can be bypassed on the MySQL and MariaDB connectors. In src/utils/sql-parser.ts, scanSingleLineComment treats every double dash as a comment start, whereas MySQL and MariaDB require following whitespace, a control character, or the end of the line. The read-only check in src/tools/execute-sql.ts validates split statements with isReadOnlySQL, but src/connectors/mysql/index.ts and src/connectors/mariadb/index.ts execute the original string with multipleStatements…
Source excerpt · GitHub_MIn src/utils/sql-parser.ts, scanSingleLineComment treats every double dash as a comment start, whereas MySQL and MariaDB require following whitespace, a control character, or the end of the line.
Affected packages
Affected products
Vendor version evidence. Product records are separate from automatic dependency matching.
bytebase · GitHub_M
dbhub
1 range
bytebase · GitHub_M
dbhub
Compare with this publisher’s ranges. This does not inspect your installation.
affected
< 0.22.6
Other versions: unknown
Original source description
DBHub is a database MCP server for Postgres, MySQL, SQL Server, Oracle, MariaDB, SQLite. Prior to 0.22.6, read-only SQL validation can be bypassed on the MySQL and MariaDB connectors. In src/utils/sql-parser.ts, scanSingleLineComment treats every double dash as a comment start, whereas MySQL and MariaDB require following whitespace, a control character, or the end of the line. The read-only check in src/tools/execute-sql.ts validates split statements with isReadOnlySQL, but src/connectors/mysql/index.ts and src/connectors/mariadb/index.ts execute the original string with multipleStatements enabled. A double dash followed by a non-whitespace character can therefore hide a subsequent write or destructive DDL statement from the validator while the database interprets the dashes as minus operators and executes both statements. Anyone able to influence the assistant's SQL, including through prompt injection in content the assistant reads, can bypass read-only mode to modify or drop database data, subject to the database account's privileges. PostgreSQL is not affected by this path because its double-dash parsing agrees with the checker and its connector executes individual split statements. This issue is fixed in version 0.22.6.
Inside the record
Evidence available
Describes the evidence in this view, not whether the product is safe.
Original records
CVE-2026-61789View the latest unmodified CVE JSON from the official source. It may be newer than this imported page.
cve.new JSON →Underlying weaknesses
The source’s classification of what caused the vulnerability.
Contributing organizations · 1
Assigning organization
What changed
Follow changesLarge field values are marked as truncated previews. Original source snapshots remain retained.