GHSA-j656-3hf2-fvjc: DBHub: read-only bypass via MySQL comment parsing

GHSA-j656-3hf2-fvjcMEDIUM
Published November 2, 2026
CISO Take

DBHub, an MCP-style database gateway used to give AI agents controlled database access, has a flaw where its read-only mode can be bypassed on MySQL and MariaDB. Its SQL parser treats any "--" as a comment, but MySQL only does so when followed by whitespace, so a payload like "SELECT 1--1;DROP TABLE victim" passes validation and then executes both statements. Anyone who can influence the agent's SQL, most realistically through prompt injection in content the agent reads, can run writes and destructive DDL on databases that operators believed were protected. There is no KEV listing, no EPSS score and no public exploit or scanner template, but the advisory includes a full proof of concept and the payload is trivial. Upgrade @bytebase/dbhub to 0.22.6 or later, and until then use a least-privilege database account (SELECT only) for agent connections, since that control does not depend on the parser.

Sources:GitHub AdvisoryNVDATLASbytebase/dbhub GitHub repository

What is the risk?

Medium severity by the advisory rating, but the practical risk is higher wherever DBHub fronts production MySQL or MariaDB with an agent. Exploitation needs only the ability to influence SQL sent by the agent (prompt injection or a malicious user), the payload is a one-line string, and a public PoC is described. The impact is integrity and availability loss (data modification, DROP TABLE), defeating the single control operators rely on. PostgreSQL connectors are not affected. No known active exploitation, no KEV entry, and EPSS is unavailable.

How does the attack unfold?

Initial Access
Attacker plants a prompt injection in content the database-connected agent reads, or directly controls agent input.
AML.T0051.001
Tool Invocation
The agent sends a crafted payload like 'SELECT 1--1;DROP TABLE victim' to DBHub's execute-sql tool.
AML.T0053
Guard Bypass
DBHub's parser treats '--1' as a comment and approves the query, while MySQL/MariaDB runs both statements via multipleStatements.
AML.T0107
Impact
Arbitrary writes and DDL execute despite read-only mode, destroying or altering database contents.
AML.T0101

What systems are affected?

PackageEcosystemVulnerable RangePatched
@bytebase/dbhubnpm< 0.22.60.22.6

Do you use @bytebase/dbhub? You're affected.

How severe is it?

CVSS 3.1
N/A
EPSS
N/A
Exploitation Status
No known exploitation
Sophistication
Trivial

What should I do?

1 step
  1. 1) Upgrade @bytebase/dbhub to 0.22.6 or later (fix in PR #342). 2) Connect agents with a database user that has only SELECT privileges; never rely on application-level read-only mode alone. 3) Disable multipleStatements on MySQL/MariaDB connections where possible. 4) Enable DB audit or general query logging and alert on DDL/DML statements from the agent's account, and on queries containing "--" immediately followed by a non-whitespace character. 5) Restrict the agent's exposure to untrusted content and require human approval for SQL tool calls on sensitive databases. 6) Take backups and test restore for databases reachable by agents.

How is it classified?

Which compliance frameworks are affected?

This CVE is relevant to:

ISO 42001
A.6.2.6-AI system operation and monitoring
NIST AI RMF
MANAGE 2.3-Responding to unknown risks and controls
OWASP LLM Top 10
LLM01-Prompt InjectionLLM06-Excessive Agency

Frequently Asked Questions

What is GHSA-j656-3hf2-fvjc?

DBHub, an MCP-style database gateway used to give AI agents controlled database access, has a flaw where its read-only mode can be bypassed on MySQL and MariaDB. Its SQL parser treats any "--" as a comment, but MySQL only does so when followed by whitespace, so a payload like "SELECT 1--1;DROP TABLE victim" passes validation and then executes both statements. Anyone who can influence the agent's SQL, most realistically through prompt injection in content the agent reads, can run writes and destructive DDL on databases that operators believed were protected. There is no KEV listing, no EPSS score and no public exploit or scanner template, but the advisory includes a full proof of concept and the payload is trivial. Upgrade @bytebase/dbhub to 0.22.6 or later, and until then use a least-privilege database account (SELECT only) for agent connections, since that control does not depend on the parser.

Is GHSA-j656-3hf2-fvjc actively exploited?

No confirmed active exploitation of GHSA-j656-3hf2-fvjc has been reported, but organizations should still patch proactively.

How to fix GHSA-j656-3hf2-fvjc?

1) Upgrade @bytebase/dbhub to 0.22.6 or later (fix in PR #342). 2) Connect agents with a database user that has only SELECT privileges; never rely on application-level read-only mode alone. 3) Disable multipleStatements on MySQL/MariaDB connections where possible. 4) Enable DB audit or general query logging and alert on DDL/DML statements from the agent's account, and on queries containing "--" immediately followed by a non-whitespace character. 5) Restrict the agent's exposure to untrusted content and require human approval for SQL tool calls on sensitive databases. 6) Take backups and test restore for databases reachable by agents.

What systems are affected by GHSA-j656-3hf2-fvjc?

This vulnerability affects the following AI/ML architecture patterns: Agent frameworks, MCP tool servers, Text-to-SQL assistants, Database-connected LLM applications.

What is the CVSS score for GHSA-j656-3hf2-fvjc?

No CVSS score has been assigned yet.

What is the AI security impact?

Affected AI Architectures

Agent frameworksMCP tool serversText-to-SQL assistantsDatabase-connected LLM applications

MITRE ATLAS Techniques

AML.T0051.001Indirect
AML.T0053AI Agent Tool Invocation
AML.T0101Data Destruction via AI Agent Tool Invocation
AML.T0107Exploitation for Defense Evasion

Compliance Controls Affected

ISO 42001: A.6.2.6
NIST AI RMF: MANAGE 2.3
OWASP LLM Top 10: LLM01, LLM06

What are the technical details?

Original Advisory

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.

Exploitation Scenario

An attacker plants a hidden instruction in a support ticket or web page that a database-connected assistant later reads. The instruction makes the agent run a query such as "SELECT 1--1;DROP TABLE customers" through DBHub. DBHub's parser sees one harmless SELECT and allows it in read-only mode, while MariaDB parses "--1" as arithmetic and executes the DROP TABLE as a second statement. The attacker has destroyed or altered production data without any direct database access.

Weaknesses (CWE)

CWE-436 — Interpretation Conflict: Product A handles inputs or steps differently than Product B, which causes A to perform incorrect actions based on its perception of B's state.

Source: MITRE CWE corpus.

Timeline

Published
November 2, 2026
Last Modified
November 2, 2026
First Seen
November 2, 2026

Related Vulnerabilities