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.

