/

CVE-2026-134293

Severity:

HIGH RISK

(8.2)

SQL Injection (CWE-89) in SurrealDB MCP Server Tools

CVE-2026-134293

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Arbitrary SurrealQL statement execution

Severity:

HIGH RISK

(8.2)

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

CVE-2026-134293 is a high-severity SQL injection vulnerability in SurrealDB's Model Context Protocol (MCP) server. An attacker who can provide MCP tool arguments may be able to break out of a quoted identifier and execute arbitrary SurrealQL statements, subject to the database permissions available to the server.

Affected context

The issue affects SurrealDB versions 3.1.0 through releases before 4.0.0 when the MCP server processes tool arguments containing identifiers. Its identifier validator handles escaped backticks differently from the SurrealQL parser, creating a risk when attacker-controlled input reaches this validation and parsing path.

Exploit preconditions

  • Attack surface: The MCP server's tool interface for arguments that include identifiers
  • Required access: The ability to submit tool arguments to an accessible MCP server; authentication requirements depend on deployment configuration
  • Trigger point: Validation and parsing of a quoted identifier containing an escaped backtick
  • Why exploitation is possible: The validator may treat an escaped backtick as the end of the identifier even though the SurrealQL parser treats it as escaped, allowing input to alter the resulting query structure

Why this happens

The root cause is inconsistent handling of escaped delimiters between identifier validation and query parsing. The validator functions consume_backtick_ident and validate_identifier treat the first backtick as the closing delimiter, while the SurrealQL parser honors escape characters. This parser-validation mismatch can allow untrusted input to change query structure, mapping to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').

Potential impact

  • An attacker may execute arbitrary SurrealQL statements within the MCP server's database context.
  • Database records or schema may be read or modified, depending on the server's permissions.
  • Data integrity or availability could be affected by unauthorized database operations.
  • Exposure could extend to other resources accessible through the server's configured database privileges.

General mitigation guidance

Defensive patterns should ensure that identifiers and query values cannot alter the structure of generated queries.

  • Use parameterized query interfaces for values, and apply safe, context-aware handling for identifiers.
  • Keep validation and parsing behavior consistent, including how escaped delimiters are interpreted.
  • Prefer structured query-building APIs over assembling query text from untrusted input.
  • Treat MCP tool arguments as untrusted, and restrict their influence over query structure.
  • Apply least-privilege database credentials so that query execution is limited to the operations and data the MCP server needs.

How teams detect issues like this

  • Use static analysis and code review to identify query construction that incorporates MCP arguments or other untrusted input.
  • Review identifier validators for correct handling of escapes and for consistency with the parser's grammar.
  • Add tests covering escaped delimiters and malformed identifiers, verifying that input cannot change query structure.
  • Enforce policies requiring parameterized queries or approved query-building APIs for untrusted data.
  • Monitor database activity for unexpected statement types or operations inconsistent with the MCP server's intended role.

Sources

SourceLink
github.comgithub.com/surrealdb/surrealdb/security/advisories/GHSA-cr79-9p8r-p5wx
vulncheck.comvulncheck.com/advisories/surrealdb-3.1.0-before-4.0.0-sql-injection-via-mcp-tool-identifier-escaped-backticks

Frequently asked

questions

It concerns SurrealDB's MCP server handling of quoted identifiers. Successful exploitation depends on whether an attacker can submit relevant tool arguments and on the server's database permissions.

Yes. An attacker needs a way to submit tool arguments to the server. Whether authentication is required depends on how the MCP endpoint is exposed and protected.

Avoid building query structure from untrusted strings. Use parameterized queries for values and safe, context-aware identifier handling that matches the parser's rules.

Treat tool arguments as untrusted, test escaped delimiters against the actual parser behavior, review query construction, and constrain database privileges.

Find out what's already
exploitable in your codebase.