CVE-2025-59333: @executeautomation/database-server does not properly restrict access, bypassing a "read-only" mode
The "read-only" mode of the `@executeautomation/database-server` MCP server only checks that a query starts with `SELECT`. Chained statements and functions such as `pg_terminate_backend()` get through, so an agent, or a prompt injection against it, can disrupt the database and read data it should not. The advisory lists versions up to 1.1.0 and no patched version.
Published Sep 16, 2025 · Analysis Nov 1, 2026
What an attacker can do
The read_query tool in index.ts lowercases the query and checks startsWith("select"), then runs it through dbAll. That check does not make a query read-only. The pg driver accepts several statements separated by ;, so SELECT 1; INSERT INTO ... passes. A SELECT can also call functions with side effects, such as a stored procedure that updates data.
The reporter's reproduction on PostgreSQL starts SELECT pg_sleep(5 * 60), lists running queries with SELECT pid, usename, state, query FROM pg_stat_activity;, then calls SELECT pg_terminate_backend(PID); through the same tool. The long query is killed. That is a denial of service even on a database with no custom procedures. The advisory says similar effects may exist in MySQL and SQLite.
Reading pg_stat_activity also exposes queries from other sessions, which can leak data. The CVSS vector requires low privileges, meaning access to the MCP interface, and rates confidentiality and availability impact high. In practice the caller is often an AI agent, and prompt injection from a document or ticket can make it send these queries. The database account the server uses sets the limit of the damage.
Who is affected
Affected: @executeautomation/database-server up to and including 1.1.0. The advisory shows the PostgreSQL case and says other databases with elevated functions may be affected. Any agent setup that relies on "read-only" mode as a safety boundary is exposed.
Check your install:
npm ls -g @executeautomation/database-serverAlso check the mcpServers entries of your client config for the package.
@executeautomation/database-server
- Ecosystem
- npm
- Affected
- <= 1.1.0
- Fixed in
- No patched version yet
- Check
npm ls @executeautomation/database-server
How to fix it
The data lists no patched version. Do not trust the server's read-only mode. The advisory recommends these controls:
- Do not rely on a "starts with SELECT" check.
- Limit access to the specific tables the user may query.
- Do not allow several SQL statements to be chained.
- Give the database account fine-grained permissions with explicit access to only what it needs.
In practice, connect the server with a database role that has only SELECT on chosen tables and no execute rights on administrative functions, or point it at a read replica. Check the project's repository for a release newer than 1.1.0 before assuming a fix.
How to tell if you were hit
Search database logs for statements from the MCP server's database user that contain ; followed by another statement, pg_terminate_backend, pg_sleep, or reads of pg_stat_activity. Look for backends terminated unexpectedly and for sessions that ran very long. Check MCP tool-call logs for read_query calls with those strings. Beam records MCP tool calls from agents, so a read_query call with a chained statement can be reviewed there.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
The MCP Server provided by ExecuteAutomation at https://github.com/executeautomation/mcp-database-server provides an MCP interface for agentic workflows to interact with different kinds of database servers such as PostgreSQL database. However, the mcp-database-server MCP Server distributed via the npm package @executeautomation/database-server fails to implement proper security control that properly enforce a "read-only" mode and as such it is vulnerable to abuse and attacks on the affected database servers such as PostgreSQL (and potentially other db servers that expose elevated functionalities) and which may result in denial of service and other unexpected behavior.
This MCP Server is also publicly published in the npm registry: https://www.npmjs.com/package/@executeautomation/database-server
Vulnerable code
The vulnerable code to SQL injection takes shape in several ways:
startsWith("SELECT")can include multiple queries because the pg driver for theclient.query()supports multi queries if terminated with a;startsWith("SELECT")can include denial of service queries for stored procedures and other internal db functions
The tool call here in index.ts is vulnerable:
// Handle tool calls
server.setRequestHandler(CallToolRequestSchema, async (request) => {
switch (request.params.name) {
case "read_query": {
const query = request.params.arguments?.query as string;
if (!query.trim().toLowerCase().startsWith("select")) {
throw new Error("Only SELECT queries are allowed with read_query");
}
try {
const result = await dbAll(query);
return {
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
isError: false,
};
} catch (error: any) {
throw new Error(`SQL Error: ${error.message}`);
}
}The MCP Server exposes the tool read_query with a naive attempt to guard for exclusive "read-only" mode that allows only data retrieval from the server by performing a check on the provided query string to ensure that it starts with a "SELECT" query.
In short, the code check startWith("select") is not an adequate security control to strict for read-only mode queries and can be abused for side-effects and database-level operations.
Exploitation
While allowing only SELECT type queries might seem like a good defense to allow only data retrieval and not data manipulation in any way (hence, "read-only" mode), it is a non-suficient way of protecting against database servers that expose extra functionality through internal function calls.
Several examples that will allow side effects through SELECT queries:
- Stored procedures:
SELECT some_function_that_updates_data(); - Internal database administrative operations:
SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE ...;
Even when the database is known not to have any stored procedures defined, an attacker can still cause significant availability and service disruption by executing pg_terminate_backend().
Following is a reproduction:
- Simulate a long-running query, for example:
query = "SELECT pg_sleep(5 * 60)" - Now, from the MCP programmatic interface, execute the following query
SELECT pid, usename, state, query FROM pg_stat_activity;to get the PID for the long running query - Next, use the same MCP interface to then request to run the following query:
SELECT pg_terminate_backend(PID);and observe the long running query is now terminated
Similar database side-effects may be found in MySQL or SQLite.
Impact
The above exploitation surfaces two significant security risks: a denial of service that affects availability and confidentiality dislcosure that allows users unauthorized access to queries running on the server and potential leak of data.
Recommendation
- Don't rely solely on the "starts with"
SELECT - Strict access to specific tables that the user is only authorized to query for
- Do not allow multiple SQL queries to be chained together like
SELECT * ...; INSERT INTO ... - Require users that adopt this MCP Server to use fine-grained permissions on the database server with strict and explicit access to specific capabilities on the server.
CVE Details
Recommended CWE: CWE-284: Improper Access Control Recommendec CVSS: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H
References and Prior work
- GitHub Kanban MCP Server found vulnerable to command injection.
- iOS Simulator MCP Server found vulnerable to command injection.
- Liran's Node.js Secure Coding for educational materials on injection attacks and secure coding practices.
- How to Bypass Access Control in PostgreSQL in Simple PSQL MCP Server for SQL Injection
- Reference example from prior security research on this topic, demonstrating how vulnerable MCP Server connected to Cursor is abused with prompt injection to bypass the developer's intended logic:
Cursor defined MCP Server vulnerable to command injection
Credit
Disclosed by Liran Tal
Credited to lirantal.
Questions
- Is there a fixed version of @executeautomation/database-server?
Not in the advisory data. It lists 1.1.0 and earlier as vulnerable and gives no patched version. Use a restricted database role as the real control.
- Why does the SELECT check fail?
The
pgdriver runs multiple statements separated by;, and aSELECTcan call functions such aspg_terminate_backend()or a stored procedure that changes data.- Can an attacker use this without database credentials?
They need to reach the MCP interface, which already holds the database credentials. Prompt injection against an agent connected to it is the route the research describes.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More Other MCP servers and tools vulnerabilities
All Other MCP servers and tools entriesCVE-2026-102943
Dagu MCP DAG specification read bypasses path containment and workspace isolation
medium6.5Nov 10, 2026CVE-2026-102610
fast-agent: `fast-agent serve` binds HTTP to 0.0.0.0 with no authentication by default; with --shell this is unauthenticated remote command execution
medium6.4Nov 9, 2026CVE-2026-63655
tsParticles: Unbounded HTTP Request Body Buffering in @tsparticles/mcp-server Leads to Remote DoS
high7.5Nov 9, 2026CVE-2026-76892
tsParticles: Malformed JSON requests can terminate the @tsparticles/mcp-server HTTP process
high8.7Nov 9, 2026CVE-2026-76893
tsParticles: A single anonymous MCP session can monopolize HTTP mode and deny new clients
medium6.9Nov 9, 2026CVE-2026-77604
Code Graph RAG: MCP paginated read_file path traversal / arbitrary file read
high7.5Nov 9, 2026
