# We connect Claude and Cursor to our MySQL and PostgreSQL databases through Bytebase's DBHub MCP server with execute_sql set to read-only. Two DBHub advisories came out in late November 2026. Could an agent or a prompt injection have written to or dropped our tables, which version fixes it, and is read-only mode enough on its own?

**Short answer:** Yes, before DBHub 1.7.0 a query could look like one harmless SELECT to DBHub's read-only check and still run writes on MySQL, MariaDB or PostgreSQL. CVE-2026-134803 (GHSA-p6h8-6r97-q9rf, published November 22, 2026, CVSS 4.0 score 7.2) says the SQL scanner ended a quoted string at the first quote that wasn't doubled, but MySQL and MariaDB strings, and PostgreSQL E'...' strings, also skip a quote escaped with a backslash. So a SELECT could hide stacked statements that clear transaction_read_only, COMMIT and DROP a table. Pull request 505 fixed it, merged November 12 and released in 1.7.0 on November 16, 2026; npm listed 2.1.0 as the latest on November 28. Separately, Trend's Zero Day Initiative published ZDI-26-1067 (CVE-2026-136441, CVSS 9.8) on November 24, 2026 as a zero-day: an incorrect authorization decision when DBHub's MCP server parses untrusted SQL lets a remote caller bypass authentication. ZDI names no fixed version, and DBHub's repository listed no advisory for it on November 28. So upgrade, but don't let read-only mode be the only thing between an agent and your data: connect with a database account that can only read.

## Checklist
1. Check the DBHub version on every machine and container that runs it: anything before 1.7.0 has the backslash-quote bypass. Upgrade to the current release (2.1.0 on npm on November 28, 2026).
2. Give DBHub a database user that has only SELECT on the schemas it needs. Then a statement the read-only check misses is still refused by the database itself.
3. On PostgreSQL, also make that user's sessions read-only on the server side (for example default_transaction_read_only on the role), and don't grant superuser, pg_read_server_files or pg_write_server_files.
4. On MySQL and MariaDB, don't grant the FILE privilege or any write privilege to DBHub's user, and set secure_file_priv.
5. If you run DBHub over HTTP, keep it on localhost or behind an authenticating proxy, and don't expose it to other machines. ZDI's only listed mitigation for ZDI-26-1067 is to restrict interaction with the product.
6. Look at the database's own logs for DDL, COMMIT or SET statements from DBHub's user since you first connected it, especially statements that arrived inside one long SELECT.
7. Keep a dated record of the version, the database grants and the transport you run, so you can show what was exposed and when it changed.

## How did CVE-2026-134803 let writes past DBHub's read-only check?
- DBHub's execute_sql tool can be set to read-only. Before it sends a query, it splits the text into statements and checks each one. The connector then runs the original string, and the MySQL and MariaDB connectors allow several statements in one call.
- The splitter ended a quoted string at the first quote that wasn't doubled. MySQL and MariaDB also treat a backslash before a quote as an escape, and so do PostgreSQL E'...' strings. Pull request 505 gives the example of a single SELECT with a string that, to the server, closes early: DBHub saw one SELECT, the server saw five statements, including SET SESSION transaction_read_only = 0, COMMIT and DROP TABLE.
- GitHub's advisory database entry says an MCP client restricted to read-only execute_sql could modify or drop MySQL, MariaDB or PostgreSQL data this way. The trigger is just query text, so a prompt injection that gets an agent to send a crafted query would do.

## What did DBHub 1.7.0 change, and what does it still not cover?
- The fix scans MySQL and MariaDB strings with backslash escapes and PostgreSQL E'...' strings the way the servers do. Because DBHub can't see the server's sql_mode, it checks MySQL and MariaDB text three ways (the server default, NO_BACKSLASH_ESCAPES and ANSI_QUOTES) and refuses the query if any reading shows a statement that isn't a read. explain_sql now needs exactly one statement under every reading.
- There are side effects. A harmless query with a backslash-escaped quote and a semicolon in the same string can be refused, as it already was before, and text with a backslash before a quote is now split where the server splits it. The pull request also names a known limit: PostgreSQL with standard_conforming_strings turned off treats backslashes as escapes in plain strings too, which still isn't handled. That setting has been on by default since PostgreSQL 9.1.
- This is the third read-only bypass DBHub has fixed in 2026. In June its repository published GHSA-mwwr-p57h-56pf (CVE-2026-61788), where the database-level read-only setting was never applied and a SELECT calling a function could write, and GHSA-j656-3hf2-fvjc (CVE-2026-61789), where a statement hidden after two dashes got past the check on MySQL and MariaDB. Both were fixed in 0.22.6.

## Why does ZDI-26-1067 mean DBHub's read-only mode can't be the only control?
- ZDI's advisory, published November 24, 2026, says the flaw is in DBHub's MCP server implementation and comes from an incorrect authorization decision when parsing untrusted SQL, letting a remote attacker bypass authentication without credentials. ZDI says it reported the issue to the vendor on July 18, 2025, asked for updates later in 2025, and told the vendor on November 9, 2026 that it would publish as a zero-day.
- The advisory doesn't say which versions are affected or whether any later release, including the June and November fixes above, addresses it. Treat every version as possibly affected until DBHub or ZDI says otherwise.
- The pattern across all of these is the same: a check that reads SQL text in DBHub and decides whether it's safe, followed by a database that runs the text its own way. A database account that can only read, and a server that enforces read-only sessions, don't depend on DBHub parsing anything correctly.

## Ask Rightshold (free, no key)
Add the MCP server https://www.rightshold.com/mcp to Claude, Cursor, ChatGPT, Grok or VS Code (one-click setup: https://www.rightshold.com/start?ref=seo), then ask: "After upgrading DBHub and switching it to a read-only database user, record a receipt with a hash of the new grants and the config we now run, so we can show what changed and when."

```json
{
  "tool": "record_action",
  "arguments": {
    "action_type": "security.config_change",
    "outcome": "success",
    "occurred_at": "2026-11-28T20:00:00Z",
    "client_event_id": "dbhub:cve-2026-134803:hardening",
    "summary": "DBHub upgraded to 2.1.0 on all hosts; execute_sql readonly kept on; new database user with SELECT only, no FILE privilege, server-side read-only sessions; HTTP transport bound to localhost behind an authenticating proxy; database logs reviewed for DDL/COMMIT/SET from the old user",
    "action_sha256": "<sha256 of the exported grants and the DBHub config file>"
  }
}
```
- Needs your API key (or accept_terms:true once to open a free account; the key comes back once). It returns a ledger-committed receipt of what you submitted and when, kept outside your database and DBHub.
- It doesn't scan DBHub, read your database or check your grants. It shows the grants and config you hashed existed at that time and haven't changed since.

_Rightshold isn't affiliated with Bytebase, DBHub or Trend's Zero Day Initiative. Details are from GitHub's advisory database entry GHSA-p6h8-6r97-q9rf (CVE-2026-134803), DBHub pull request 505 and the v1.7.0 release notes, DBHub's repository advisories GHSA-mwwr-p57h-56pf and GHSA-j656-3hf2-fvjc, and ZDI advisory ZDI-26-1067, with the current version from the npm registry, all read November 28, 2026. Advisories get updated; confirm affected and fixed versions on the linked pages._

## Sources
- [GitHub Advisory Database: GHSA-p6h8-6r97-q9rf / CVE-2026-134803, DBHub read-only mode bypass via backslash-escaped quotes](https://github.com/advisories/GHSA-p6h8-6r97-q9rf)
- [DBHub pull request 505: honor backslash-escaped quotes in MySQL strings and PostgreSQL E strings](https://github.com/bytebase/dbhub/pull/505)
- [DBHub v1.7.0 release notes (November 16, 2026)](https://github.com/bytebase/dbhub/releases/tag/v1.7.0)
- [Zero Day Initiative ZDI-26-1067: Bytebase DBHub MCP Incorrect Authorization Authentication Bypass (November 24, 2026)](https://www.zerodayinitiative.com/advisories/ZDI-26-1067/)
- [DBHub security advisory GHSA-mwwr-p57h-56pf: read-only mode does not prevent database writes](https://github.com/bytebase/dbhub/security/advisories/GHSA-mwwr-p57h-56pf)
- [DBHub security advisory GHSA-j656-3hf2-fvjc: read-only bypass on MySQL and MariaDB via comment parsing](https://github.com/bytebase/dbhub/security/advisories/GHSA-j656-3hf2-fvjc)

## Related
- [How to restrict an MCP database tool to read-only queries](https://www.rightshold.com/answers/how-to-restrict-an-mcp-database-tool-to-read-only-queries)
- [Which AWS Labs Postgres, MySQL and DocumentDB MCP server versions fix the read-only mode bypasses?](https://www.rightshold.com/answers/which-aws-labs-postgres-mysql-and-documentdb-mcp-server-versions-fix-the-read-only-mode-bypasses)
- [Why an MCP server's tool deny list can silently miss dangerous calls](https://www.rightshold.com/answers/why-an-mcp-servers-tool-deny-list-can-silently-miss-dangerous-calls)
- [Is it safe to run an MCP server in HTTP mode without authentication?](https://www.rightshold.com/answers/is-it-safe-to-run-an-mcp-server-in-http-mode-without-authentication)

_Not legal advice. Updated 2026-11-28. JSON: https://www.rightshold.com/answers/can-an-ai-agent-get-around-dbhubs-read-only-mode-cve-2026-134803-and-the-zdi-26-1067-zero-day.json_