MEDIUM · CVSS 4.0 EPSS 0.5% · 38th percentile CWE-436CWE-863

CVE-2026-61789: DBHub: MySQL and MariaDB comment interpretation bypasses read-only SQL validation

Published 2026-11-02 · Updated 2026-11-02 · Also known as GHSA-j656-3hf2-fvjc

Summary

DBHub incorrectly parses SQL comments when interacting with MySQL and MariaDB, allowing attackers to bypass read-only mode protections. Users of @bytebase/dbhub versions prior to 0.22.6 should update immediately to prevent unauthorized write or destructive DDL operations.

Who is affected

The vulnerability affects deployments using MySQL or MariaDB connectors where read-only mode is intended to secure databases accessed by AI agents. By utilizing specific comment-based payload manipulation, an attacker can bypass SQL validation and execute unauthorized write or administrative commands. This exposure is particularly critical in environments where the AI agent processes untrusted input susceptible to prompt injection.

Exploitability

The vulnerability is rated as Medium severity with an AV:N/AC:L/AT:P/PR:N/UI:P vector, indicating it is network-exploitable but requires specific conditions such as user interaction or a vulnerable configuration. While the EPSS score of 0.004 indicates a low current probability of exploit, the flaw poses a significant risk to integrity and availability. It is not currently listed as a CISA Known Exploited Vulnerability.

Remediation

How to check your project

Automated analysis of the published advisory data, generated 2026-11-18. Not human-reviewed; verify against the official advisory. How this works.

Affected packages

EcosystemPackageAffected versionsFixed inUpgrade
npm @bytebase/dbhub >= 0, < 0.22.6 0.22.6 npm install @bytebase/[email protected]

CVSS 4.0 vector

CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:H/VA:H/SC:N/SI:N/SA:N

Attack vectorNetwork
Attack complexityLow
Attack requirementsPresent
Privileges requiredNone
User interactionPassive
Confidentiality (vulnerable system)None
Integrity (vulnerable system)High
Availability (vulnerable system)High
Confidentiality (subsequent systems)None
Integrity (subsequent systems)None
Availability (subsequent systems)None

Base score is not computed for CVSS 4.0 vectors; severity is taken from the advisory.

FAQ

Is PostgreSQL affected by this vulnerability?

No, PostgreSQL is not affected because its comment parsing consistently treats '--' as a comment regardless of trailing characters, and it executes statements individually.

How does the bypass work?

The application's SQL parser incorrectly identifies malicious commands as comments by failing to require whitespace after '--', while the underlying database engine interprets the characters as active SQL commands.

Does this flaw allow full database control?

Yes, if the bypass is successful, it allows the execution of arbitrary write and DDL statements, such as 'DROP TABLE', which can lead to data loss or unauthorized modifications.

Original advisory description
The read-only mode can be bypassed on the MySQL and MariaDB connectors. In read-only mode a caller can still execute arbitrary write and DDL statements (for example DROP TABLE), which defeats the protection that read-only mode is meant to provide when a database is exposed to an AI agent. Root cause The problem is a mismatch between how DBHub's SQL parser handles single-line comments and how MySQL and MariaDB actually parse them. In src/utils/sql-parser.ts, scanSingleLineComment treats "--" as the start of a comment no matter what character follows it. MySQL and MariaDB only begin a "--" comment when the two dashes are followed by whitespace, a control character, or the end of the line. Otherwise the dashes are read as two minus signs and the rest of the line is ordinary SQL. The read-only check in src/tools/execute-sql.ts splits the input and validates each statement with isReadOnlySQL, but the connector then executes the original, unmodified string. The MySQL and MariaDB connectors open their connection pool with multipleStatements: true (src/connectors/mysql/index.ts:54 and src/connectors/mariadb/index.ts:53) and run the whole string in a single call. Because of this, the following payload: SELECT 1--1;DROP TABLE victim is seen by DBHub as a single SELECT statement, since everything after "--" is treated as a comment and the read-only check passes. MySQL and MariaDB instead parse it as "SELECT 1 - -1" followed by "DROP TABLE victim" and execute both statements. Proof of concept 1) DBHub's own parser. Running splitSQLStatements and isReadOnlySQL from this repository on the payload returns a single statement and readOnly = true, so the query is allowed in read-only mode. The same code correctly rejects "SELECT 1; DROP TABLE victim", which confirms that the "--1" is what gets through. 2) Execution. Connecting to MariaDB 11.4 with mysql2 and multipleStatements: true (the same option the connector uses) and sending the payload returns 2 for the first statement, which confirms "--" was not treated as a comment, and then drops the table. The table exists before the call and is gone afterwards. Impact Read-only mode is the control operators rely on to let an assistant read from a database without being able to change it. With this bypass, anyone who can influence the SQL the assistant sends, most realistically through prompt injection in content the assistant reads, can perform writes and destructive DDL against MySQL and MariaDB. PostgreSQL is not affected by this path, because it treats "--" as a comment regardless and executes each split statement individually. Affected code (current main, commit e99c3aa9, package version 0.22.3) - src/utils/sql-parser.ts - scanSingleLineComment does not require whitespace after "--" - src/tools/execute-sql.ts - validates the split statements but executes the original string - src/connectors/mysql/index.ts and src/connectors/mariadb/index.ts - multipleStatements: true Suggested fix The most reliable fix is to stop executing the original string: run only the statements that were validated, and disable multipleStatements on the MySQL and MariaDB connections unless it is genuinely required. As defense in depth, make the comment scanner dialect-aware so that for MySQL and MariaDB "--" only starts a comment when it is followed by whitespace, a control character, or the end of the line, similar to the handling already in place for MySQL conditional comments.

References

Source records: GHSA-j656-3hf2-fvjc (OSV.dev) · EPSS by FIRST, 2026-11-26.