NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · Other MCP servers and tools

CVE-2026-63129: mssql-mcp-core: SQL injection in mssql-mcp write tools via unparameterized table names and WHERE clauses

highCVSS 3.1 8.8GHSA-2m9m-6cr5-9x25

The mssql-mcp-core MCP packages for Microsoft SQL Server built T-SQL by pasting table names, column names and WHERE clauses into queries. A malicious MCP client, or an LLM agent steered by prompt injection, can run arbitrary SQL, including stacked statements. Upgrade @connorbritain/mssql-mcp-core to 0.6.0, reader and writer to 0.5.0, and server to 0.6.0.

Published Nov 19, 2026 · Analysis Nov 19, 2026

What an attacker can do

Several tools passed caller-supplied identifiers and predicates straight into the node-mssql Request.query() batch API. Only data values were parameterized. update_data, delete_data and execute_transaction used a raw tableName and a free-form whereClause. insert_data used raw column names. create_table, create_index and drop_table had weak identifier checks. list_databases interpolated the stateFilter argument, and that tool belongs to the read-only tier.

The only check on whereClause was that it was not empty. The row-count and preview queries run before the confirmUpdate or confirmDelete step. A hostile whereClause or tableName therefore ran on the first call and skipped the preview, the confirmation and the maxRows limit.

Request.query() accepts multi-statement batches. An attacker who controls tool arguments can run stacked DDL and DML, read or change any data the login can reach, and drop tables. They can also get around the read_data allow and deny validation. If the SQL login is privileged and xp_cmdshell is enabled, they can run operating system commands. In practice the attacker is rarely the MCP client itself. More often a web page, ticket or document that the agent reads carries instructions, and the agent turns them into tool arguments.

Who is affected

These npm packages are affected: @connorbritain/mssql-mcp-core up to 0.5.0, @connorbritain/mssql-mcp-reader and @connorbritain/mssql-mcp-writer up to 0.4.2, and @connorbritain/mssql-mcp-server up to 0.5.2. The reader package is affected too, even with READONLY=true, because of list_databases. Check what you have installed:

npm ls @connorbritain/mssql-mcp-core @connorbritain/mssql-mcp-reader @connorbritain/mssql-mcp-writer @connorbritain/mssql-mcp-server

@connorbritain/mssql-mcp-core

Ecosystem
npm
Affected
<= 0.5.0
Fixed in
0.6.0
Check
npm ls @connorbritain/mssql-mcp-core

@connorbritain/mssql-mcp-reader

Ecosystem
npm
Affected
<= 0.4.2
Fixed in
0.5.0
Check
npm ls @connorbritain/mssql-mcp-reader

@connorbritain/mssql-mcp-writer

Ecosystem
npm
Affected
<= 0.4.2
Fixed in
0.5.0
Check
npm ls @connorbritain/mssql-mcp-writer

@connorbritain/mssql-mcp-server

Ecosystem
npm
Affected
<= 0.5.2
Fixed in
0.6.0
Check
npm ls @connorbritain/mssql-mcp-server

How to fix it

Upgrade to the patched versions: @connorbritain/mssql-mcp-core 0.6.0, @connorbritain/mssql-mcp-reader 0.5.0, @connorbritain/mssql-mcp-writer 0.5.0 and @connorbritain/mssql-mcp-server 0.6.0. The consumer packages depend on core ^0.6.0.

npm install @connorbritain/[email protected]

The fix validates all identifiers against a strict allowlist and bracket-quotes them. It also removes the free-form whereClause parameter, which is a breaking change. Callers now send structured filters of the form { column, operator, value }, with an operator allowlist and bound values. stateFilter is checked against a fixed list. The advisory says upgrading is the only complete fix. As defense in depth, run the server under a least-privilege SQL login with xp_cmdshell disabled, and limit which MCP clients can call the tools.

How to tell if you were hit

Review SQL Server logs and any query tracing for batches from the MCP server's login that contain stacked statements, DROP, xp_cmdshell, or odd text in WHERE clauses and table names. Look for list_databases calls whose stateFilter is not one of the normal state values. Check for unexpected tables, indexes or schema changes. Also check whether xp_cmdshell was enabled on the server. Beam records the MCP tool calls an agent makes, so you can search them for tool arguments that carry SQL fragments.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Several tools in mssql-mcp-core built T-SQL by string-interpolating caller-supplied identifiers and predicates directly into the statement passed to the node-mssql Request.query() batch API. Only data values were parameterized.

Affected tools and inputs:

  • update_data, delete_data: tableName and the free-form whereClause were interpolated raw.
  • insert_data: tableName and column names (object keys) were interpolated raw.
  • execute_transaction: the same raw tableName/whereClause interpolation per operation.
  • create_table, create_index, drop_table: table/column/index/schema identifiers were interpolated with no or insufficient validation.
  • list_databases (reader tier): the stateFilter argument was interpolated raw into the query, with only a non-enforced inputSchema enum guarding it.

The only check on whereClause was that it was non-empty. Because the row-count and preview queries run before the confirmUpdate/confirmDelete step, a malicious whereClause or tableName executed on the first call, bypassing the preview/confirmation and maxRows safety controls. Request.query() submits a multi-statement T-SQL batch, so a crafted input enabled stacked statements (arbitrary DDL/DML), sub-selects, and (with a privileged login and xp_cmdshell enabled) OS command execution. Because list_databases is a read-only tool, the stateFilter sink makes the reader package injectable as well.

Impact

An actor who can supply tool arguments (a malicious or compromised MCP client, or an LLM agent steered via indirect prompt injection) could read, modify, or drop arbitrary data, bypass the read_data allow/deny validation and the preview/confirmation/maxRows safeguards, and conditionally achieve OS command execution.

Patches

Fixed in @connorbritain/mssql-mcp-core 0.6.0:

  • All identifiers are validated against a strict allowlist and bracket-quoted via a shared helper.
  • The free-form whereClause string parameter is removed (breaking change) and replaced with structured, parameterized filters ({ column, operator, value }) using an operator allowlist. Values are always bound, never interpolated.
  • list_databases validates stateFilter against a fixed allowlist before use.

Upgrade the consumer packages: mssql-mcp-reader 0.5.0, mssql-mcp-writer 0.5.0, mssql-mcp-server 0.6.0 (all depend on core ^0.6.0).

Workarounds

Upgrading is the only complete fix; the list_databases (stateFilter) sink is reachable even under READONLY=true and in the reader package. As defense in depth, run the server under a least-privilege SQL login with xp_cmdshell disabled, and restrict which MCP clients can invoke the tools.

Credited to novice-22, m10x.

Questions

Does the read-only mode protect me from this SQL injection?

No. The list_databases tool is in the reader tier, and its stateFilter argument was interpolated raw. It is reachable under READONLY=true and in the reader package. Upgrade to fix it.

Can this lead to operating system command execution?

Only conditionally. The advisory says it needs a privileged SQL login with xp_cmdshell enabled. Without that, the attacker is limited to what the SQL login can do in the database, which can still mean reading, changing or dropping data.

Will upgrading to 0.6.0 break my existing prompts or scripts?

It can. The free-form whereClause parameter is removed. Tools now take structured filters with column, operator and value fields. Update any client that sent raw WHERE strings.

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 entries