SQL injection flaw hits mssql-mcp-core database agent tools
A GitHub advisory published on 19 November 2026 says caller-supplied table names and WHERE clauses were pasted straight into T-SQL queries.
By The Agentic Times ·

A set of Model Context Protocol packages that let AI agents query Microsoft SQL Server contained a SQL injection flaw that allowed arbitrary database commands, according to a GitHub security advisory published on 19 November 2026.
The advisory, tracked as GHSA-2m9m-6cr5-9x25 and CVE-2026-63129, covers the npm packages @connorbritain/mssql-mcp-core, mssql-mcp-reader, mssql-mcp-writer and mssql-mcp-server. MCP is the protocol that connects AI assistants to external tools and data sources, so these packages act as the bridge between a language model and a live SQL Server database.
According to the advisory, several tools built T-SQL statements by string-interpolating caller-supplied identifiers and predicates directly into the query handed to the node-mssql Request.query() batch interface. Only data values were parameterised, meaning the database treated everything else as executable code rather than input.
The list of affected tools is long. The advisory says update_data and delete_data interpolated both the table name and a free-form whereClause raw; insert_data interpolated the table name and column names; execute_transaction repeated the same pattern for each operation; and create_table, create_index and drop_table interpolated table, column, index and schema identifiers with no or insufficient validation. In the read-only tier, list_databases interpolated its stateFilter argument, guarded only by a non-enforced schema enum.
The only check performed on the whereClause was that it was not empty, the advisory says. Row-count and preview queries ran before the confirmUpdate and confirmDelete steps, so a malicious clause or table name executed on the very first call. That bypassed the preview and confirmation flow as well as the maxRows limit intended to cap how much data a tool could touch.
Because Request.query() submits a multi-statement batch, the advisory says a crafted input enabled stacked statements, arbitrary data definition and manipulation commands, and sub-selects. With a privileged SQL login and xp_cmdshell enabled, operating system command execution was also possible.
On impact, the advisory states that anyone able to supply tool arguments, including a malicious or compromised MCP client or a language model agent steered by indirect prompt injection, could read, modify or drop arbitrary data and bypass the read_data allow and deny validation. Indirect prompt injection means hostile instructions hidden in content the agent reads, such as a document or database row, which the model then follows as if they came from the user. The presence of the stateFilter sink in list_databases means the reader package is injectable too, even though the tool is nominally read-only.
The issue is fixed in @connorbritain/mssql-mcp-core 0.6.0. The advisory says all identifiers are now validated against a strict allowlist and bracket-quoted through a shared helper, and the free-form whereClause parameter has been removed as a breaking change. It is replaced by structured filters of the form column, operator and value, using an operator allowlist, with values always bound rather than interpolated. The stateFilter argument is now checked against a fixed allowlist.
Consumers should upgrade to mssql-mcp-reader 0.5.0, mssql-mcp-writer 0.5.0 and mssql-mcp-server 0.6.0, all of which depend on core version 0.6.0 or later. The advisory says upgrading is the only complete fix, because the stateFilter sink remains reachable even with READONLY=true set. As defence in depth, it recommends running the server under a least-privilege SQL login with xp_cmdshell disabled, and restricting which MCP clients may invoke the tools.
Sources
- github.comhttps://github.com/advisories/GHSA-2m9m-6cr5-9x25
