WhoDB's Read-Only MCP Query Was Not Read-Only to the Database Host

A database tool labelled read-only can still change the machine that runs the database. CVE-2026-138032 affected WhoDB from 0.88.0 before 0.132.0 because the MCP whodb_query path used a SQL keyword classifier that did not account for file-writing statements. The CVE record identifies INTO, OUTFILE, and DUMPFILE as omissions.

The control that failed

The deployed expectation was that a read-only tool and a confirmation workflow would prevent state changes. The implementation instead classified SQL by searching for selected keywords. That method misses statements where the database writes a file as part of a query or procedure.

The record names PostgreSQL lo_export and MySQL SELECT INTO OUTFILE as examples. File creation on the database host is a different impact from a row update. It can place files in a location used by another service, interfere with disk use, or create evidence that ordinary query auditing does not treat as a write operation.

Prompt injection reaches a database capability

WhoDB is a database exploration tool exposed to MCP clients. If a client or prompt-injected model can call whodb_query, the model's text is no longer the only object being manipulated. The call carries SQL that reaches a real database account. A weak classifier gives that account capabilities that the user interface described as unavailable.

Database permissions remain the last technical boundary. A database identity with no file-write privileges should reject these operations even when the application misclassifies them. If the configured account has broad file or administrative rights, the application bug is easier to turn into host-level impact.

Risk scope

The CVE publishes CVSS 4.0 at 6.0 and CVSS 3.1 at 5.3. Both require a low-privilege network identity and present attack requirements. The relevant attack surface is an MCP client that can reach the tool, combined with a database account whose permissions allow the operator to create files or execute the relevant functions.

The score does not prove that an exposed WhoDB instance can write to every database host. It identifies a gap between the stated approval and read-only controls and what the database engine can actually do.

Remediation

Upgrade to 0.132.0 or later. Then review database roles used by the application. Remove file-write privileges, broad execute rights, and unnecessary superuser roles from identities that are meant for exploration. Use a read replica for analysis where possible and make sure the replica's operating system permissions do not allow files to land in web roots, cron paths, or service configuration directories.

Do not treat a denylist as the primary authorization model. Parse and classify the statement with a database-aware component, apply a positive allow-list for approved query shapes, and enforce the final decision through database permissions. Confirmation prompts should describe the actual capability being invoked, not just a generic query label.

Detection and testing

Test a harmless file-write construct in an isolated database and verify that it is rejected before execution. Repeat with a procedure or function that writes a file indirectly. Review database logs for file-related calls and for changes in filesystem paths that the database process can reach.

MCP logs should show the authenticated principal, database target, tool name, normalized statement class, and approval decision. Do not store full result rows or database passwords. A rejected query is useful evidence, but an absent application log plus a successful database operation is the more important gap.

The CVE is a new package vulnerability, not proof that every deployment was attacked. The post-upgrade review has to validate the controls managers think they already have.

References