WhoDB MCP read-only and confirmation gates allow privileged database server file operations
Description
WhoDB through version 0.131.0 classifies SQL for the MCP whodb_query tool using a bounded list of mutating keywords. Server-side file operations expressed as read-shaped statements are consequently treated as non-mutating. In the default confirmation mode they execute without approval, and --read-only mode permits them.
The issue has been reproduced through the MCP query handler against disposable PostgreSQL 16.13 and MySQL 8.4.10 instances. It is not only a classifier result: the tests verified returned file contents and files created on the database server.
Confirmed behavior
With database accounts holding the necessary privileges, the following operation classes executed without confirmation in both default and --read-only modes:
- PostgreSQL
pg_read_file(...)returned a server-side marker file. - PostgreSQL
lo_export(...)created a server-side file. - MySQL
LOAD_FILE(...)returned a server-side marker file. - MySQL
SELECT ... INTO OUTFILEandSELECT ... INTO DUMPFILEcreated server-side files.
The exact submitted strings are blocked by --security=strict. That substring-based mitigation is incomplete: for example, separating MySQL INTO and OUTFILE with a newline bypasses its INTO OUTFILE substring check and was confirmed to create a file. --safe-mode and --security=strict should therefore not be described as complete mitigations for affected releases.
Preconditions and scope
An attacker needs a path to invoke whodb_query, such as access to a connected MCP client or malicious instructions accepted by an agent using that tool. A prompt-injection delivery path is plausible but was not independently demonstrated as part of this advisory.
The operations execute with the configured database account and the database server process's operating-system permissions. This issue bypasses WhoDB's confirmation and read-only policy; it does not bypass database authorization or operating-system access controls. In verification, ordinary PostgreSQL and MySQL accounts without server-file privileges were denied. PostgreSQL commonly requires superuser, pg_read_server_files, or explicitly delegated function privileges. MySQL requires the FILE privilege and can further constrain paths with secure_file_priv.
Consequently, file access is limited to paths available to the database server under those database and operating-system permissions. The greatest impact occurs when WhoDB MCP is configured with a database superuser or another account granted server-file capabilities.
Impact
A caller able to invoke whodb_query can violate the operator's explicit confirmation or read-only expectation and use existing database privileges to read or create files on the database host. This can disclose database-host configuration or credentials, export accessible data, or create files in locations writable by the database process. Availability impact was not established.
Remediation
The remediation under development replaces keyword and dangerous-function allow/deny lists as the automatic-execution boundary with a fail-closed, bounded read grammar. Unrecognized syntax, routine calls outside the supported aggregate subset, SELECT INTO, OUTFILE/DUMPFILE, and other dialect extensions require confirmation in the default mode and are rejected in read-only mode. Protected execution also requires connector-level read-only enforcement and fails closed for unsupported connectors.
No patched release is available yet. Until one is released, operators should disable the MCP query tool for untrusted workflows or use dedicated least-privilege database accounts without PostgreSQL server-file/function privileges or MySQL FILE.
Credit
Reported by Syed Anas Mohiuddin (SyedAnas01).