/

CVE-2026-63129

Severity:

HIGH RISK

(8.8)

SQL Injection (CWE-89) in MSSQL MCP Database Tools

CVE-2026-63129

Received

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Unauthorized database access and modification, with potential command execution under privileged SQL configurations

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

MSSQL MCP database tools can construct T-SQL batches using caller-controlled identifiers and predicates, while parameterizing only data values. If an attacker can supply crafted arguments to an exposed tool, the resulting SQL injection may allow unauthorized data access or changes; the consequences depend on the SQL login's privileges.

Affected context

The issue affects MSSQL MCP tools in mssql-mcp-core and related server, reader, and writer components when caller-controlled table, column, index, schema, predicate, or state-filter values are interpolated into T-SQL. Affected releases are core and server versions before 0.6.0 and reader and writer versions before 0.5.0. Some row-count and preview queries run before confirmation checks, so those checks may not prevent unsafe SQL from executing.

Exploit preconditions

  • Attack surface: MSSQL MCP tools that accept database identifiers, predicates, or filters.
  • Required access: Ability to invoke an affected tool and provide its arguments; authentication and authorization requirements depend on the deployment.
  • Trigger point: Construction and execution of a T-SQL batch, including preliminary row-count or preview queries.
  • Why exploitation is possible: Caller-controlled SQL structure is interpolated into queries rather than constrained to trusted identifiers or safe predicate forms. Confirmation and row-limit controls may be evaluated after a query has already executed.

Why this happens

The underlying bug is SQL injection (CWE-89). Parameterizing data values does not make dynamically interpolated SQL identifiers or free-form predicates safe. When caller-controlled values are inserted into T-SQL structure without effective validation or safe construction, the database may interpret them as additional SQL logic.

Potential impact

  • Attackers may read data beyond the intended scope.
  • Attackers could modify or delete database records, or perform unauthorized DDL operations.
  • Confirmation prompts or row limits may not protect queries that execute before those controls are applied.
  • If the SQL login is privileged and xp_cmdshell is enabled, database compromise could potentially lead to operating-system command execution.

General mitigation guidance

Defensive patterns focus on ensuring caller input cannot define executable SQL structure:

  • Bind data values through parameterized queries, and validate identifiers against trusted allowlists because identifiers generally cannot be handled as ordinary value parameters.
  • Prefer structured filter inputs and safe query-building APIs over free-form predicates.
  • Apply validation before any query runs, including previews and row-count checks; make confirmation and row-limit controls effective before execution.
  • Restrict tool permissions and database accounts to the minimum operations and objects required.
  • Disable high-risk database features such as xp_cmdshell when they are not needed, and avoid exposing tools to callers who do not require them.

How teams detect issues like this

  • Use static analysis to flag string interpolation or concatenation of caller-controlled values in SQL execution paths.
  • Review database tools for dynamic identifiers, free-form predicates, and checks that occur only after preview or count queries.
  • Enforce code-review and CI policies requiring parameter binding for values and allowlist validation for identifiers.
  • Monitor database audit logs for unexpected DDL, unusual query patterns, or operations inconsistent with a tool's intended function.
  • Automated code review tools may help identify risky query construction patterns.

Sources

SourceLink
github.comgithub.com/ConnorBritain/mssql-mcp-core/commit/227e2efc4e3311c477b7ae509c3ae15437a4f815
github.comgithub.com/ConnorBritain/mssql-mcp-core/commit/a9727f83768598e4fdbddfbc717ccfebb84ae7af
github.comgithub.com/ConnorBritain/mssql-mcp-core/pull/1
github.comgithub.com/ConnorBritain/mssql-mcp-core/security/advisories/GHSA-2m9m-6cr5-9x25

Frequently asked

questions

Exploitation is possible through affected database tools when caller-controlled input reaches unsafe T-SQL construction. The exact scope depends on which tools are exposed and their access controls.

An attacker needs a way to invoke an affected tool. The tool may use its own database connection, so direct credentials to the database are not necessarily required; deployment authentication and authorization determine who can invoke it.

Keep SQL structure trusted: bind values, allowlist and safely handle identifiers, and replace free-form predicates with structured filters. Ensure validation and safeguards apply before every query executes.

Use least-privilege database accounts, review all dynamic query construction, enforce secure patterns in CI, and monitor for unexpected database operations.

Find out what's already
exploitable in your codebase.