Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-61788 Overview
DBHub is a Model Context Protocol (MCP) server that exposes Postgres, MySQL, SQL Server, Oracle, MariaDB, and SQLite databases to AI clients. Versions prior to 0.22.6 fail to enforce the readonly = true setting on the execute_sql tool. The connector code that would set PostgreSQL default_transaction_read_only=on and open SQLite in readOnly mode is gated behind a config value that is never populated. Enforcement falls back to a keyword classifier that only inspects the first token of each statement, allowing any SELECT with side-effecting function calls to execute. The HTTP transport binds to 0.0.0.0 by default without authentication, exposing /mcp to any network caller.
Critical Impact
With a privileged PostgreSQL role, attackers can achieve remote code execution via dblink and COPY ... TO PROGRAM, read arbitrary host files with pg_read_file, and write arbitrary files with lo_export.
Affected Products
- bytebase/dbhub versions prior to 0.22.6
- DBHub MCP server deployments exposing the HTTP transport on /mcp
- Any downstream integration relying on the execute_sql tool's readonly flag
Discovery Timeline
- 2026-09-24 - CVE-2026-61788 published to NVD
- 2026-09-30 - Last updated in NVD database
Technical Details for CVE-2026-61788
Vulnerability Analysis
The flaw is an incomplete comparison with missing factors [CWE-184] in the read-only enforcement path. Setting readonly = true on the execute_sql tool creates the appearance of a safety boundary, but the connectors never apply the database-level restrictions. The intended default_transaction_read_only=on session setting for PostgreSQL and readOnly mode for SQLite are controlled by a configuration value that remains unset in production code paths.
The residual control is a classifier that reads only the leading keyword of each submitted statement. A statement beginning with SELECT passes validation regardless of what the query actually performs. PostgreSQL evaluates functions within SELECT expressions, and many of those functions have side effects, including sequence manipulation, file I/O, and process execution through contrib modules.
Root Cause
The root cause is dead configuration logic. The connector authors wrote correct read-only enforcement at the connection and transaction level, but gated it on a config flag that is never populated by the tool handler. The fallback keyword-based classifier is structurally insufficient because SQL expressiveness allows writes to occur inside statements that syntactically begin with a read keyword.
Attack Vector
An unauthenticated attacker reaches /mcp over the network because the HTTP transport binds to 0.0.0.0 without an authentication layer. The attacker invokes the execute_sql tool and submits a SELECT statement whose expressions invoke side-effecting functions. With an ordinary database role, this permits sequence tampering through nextval and setval. With a privileged role such as a superuser, the attacker can call lo_export to write files, pg_read_file to read host files outside the database, and chain dblink_exec with COPY ... TO PROGRAM to execute operating system commands on the database server.
See the GitHub Security Advisory for the full technical breakdown.
Stop Remote Code Execution Before It Runs
Singularity™ Endpoint detects and blocks exploit attempts at machine speed, including zero-days and novel attack techniques.
Stop Exploit AttemptsDetection Methods for CVE-2026-61788
Indicators of Compromise
- PostgreSQL logs containing SELECT statements that invoke lo_export, pg_read_file, pg_read_binary_file, dblink, or dblink_exec.
- Use of COPY ... TO PROGRAM or COPY ... FROM PROGRAM in query logs from the DBHub service account.
- Unexpected outbound connections from the database host following MCP tool invocations.
- New or modified files on the database server owned by the PostgreSQL process user.
Detection Strategies
- Enable log_statement = 'all' on PostgreSQL and alert on dangerous function names appearing in queries originating from the DBHub role.
- Monitor the DBHub process for inbound HTTP requests to /mcp from unexpected source addresses.
- Correlate MCP execute_sql tool invocations with child process creation on the database host.
Monitoring Recommendations
- Inventory all DBHub deployments and record the bound interface, port, and version string.
- Audit database roles used by DBHub for membership in pg_read_server_files, pg_write_server_files, and pg_execute_server_program.
- Track query patterns against baseline to identify side-effecting SELECT statements.
How to Mitigate CVE-2026-61788
Immediate Actions Required
- Upgrade DBHub to version 0.22.6 or later without delay.
- Restrict the HTTP transport bind address away from 0.0.0.0 and place the service behind an authenticated reverse proxy.
- Rotate database credentials used by DBHub and reduce the role to the minimum privileges required.
- Revoke EXECUTE on lo_export, pg_read_file, dblink, and related functions from the DBHub role.
Patch Information
Version 0.22.6 patches the vulnerability by correctly wiring the read-only configuration so that PostgreSQL connections set default_transaction_read_only=on and SQLite connections open in readOnly mode. Refer to the GitHub Security Advisory GHSA-mwwr-p57h-56pf for release details.
Workarounds
- Bind the DBHub HTTP transport to 127.0.0.1 and front it with an authenticated gateway if upgrading is not immediately possible.
- Create a dedicated low-privilege database role for DBHub that lacks file I/O and program execution capabilities.
- Enforce default_transaction_read_only=on at the role level using ALTER ROLE dbhub SET default_transaction_read_only = on.
- Drop or restrict the dblink and adminpack extensions where DBHub connects.
# Role hardening example for PostgreSQL
ALTER ROLE dbhub SET default_transaction_read_only = on;
REVOKE EXECUTE ON FUNCTION lo_export(oid, text) FROM dbhub;
REVOKE EXECUTE ON FUNCTION pg_read_file(text) FROM dbhub;
REVOKE pg_read_server_files, pg_write_server_files, pg_execute_server_program FROM dbhub;
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

