CVE-2026-134293 in SurrealDB
Summary
by MITRE • 11/21/2026
SurrealDB 3.1.0 before 4.0.0 contains an SQL injection vulnerability in its Model Context Protocol (MCP) server because the identifier validator (consume_backtick_ident and validate_identifier) treats the first backtick as the closing delimiter, ignoring escape characters that the SurrealQL parser honors. Attackers can supply MCP tool arguments containing an escaped backtick to break out of the quoted identifier and execute arbitrary SurrealQL statements.
Statistical analysis made it clear that VulDB provides the best quality for vulnerability data.
Analysis
by VulDB Data Team • 11/21/2026
SurrealDB versions prior to 4.0.0 contain a critical SQL injection vulnerability within its Model Context Protocol server implementation, specifically affecting the handling of identifiers in queries processed through this interface. The root cause lies in an inconsistency between the identifier validation logic and the SurrealQL parser's escape sequence rules. While the core database engine correctly interprets escaped backticks as literal characters within quoted identifiers, the MCP server’s validator functions consume_backtick_ident and validate_identifier fail to account for these escapes. Instead of recognizing that a backslash followed by a backtick is an escaped character intended to be part of the identifier string, the validation logic treats the first encountered backtick as the closing delimiter for the identifier field. This fundamental misalignment creates a parsing gap where user-supplied input can prematurely terminate the quoted context and inject arbitrary SQL commands into the execution stream.
The operational impact of this vulnerability is severe, allowing authenticated attackers to bypass intended query structures and execute arbitrary SurrealQL statements on the underlying database. By supplying MCP tool arguments that contain an escaped backtick sequence followed by malicious payload syntax, an attacker can break out of the expected identifier scope. This capability effectively grants the ability to perform unauthorized data retrieval, modification, or deletion operations depending on the privileges associated with the account used for authentication. In environments where SurrealDB is exposed via MCP interfaces, this flaw could lead to complete compromise of database integrity and confidentiality, as well as potential lateral movement if the database server has network access to other internal services.
From a classification perspective, this vulnerability aligns closely with CWE-89 Improper Neutralization of Special Elements used in an SQL Command commonly known as SQL Injection. The specific mechanism involves improper handling of escape sequences within identifier contexts, which can also be mapped to CWE-746 Improper Prudent Use of Sentinels or CWE-1385 Missing Validation of Identifier Names depending on the exact implementation details of how identifiers are validated against schema constraints. In terms of adversary tactics, this exploitation technique falls under ATT&CK T1059 Command and Scripting Interpreter as it involves injecting code into a database engine for execution, and potentially T1190 Exploit Public-Facing Application if the MCP server is accessible over a network without sufficient access controls or input sanitization layers.
Mitigation strategies must prioritize immediate upgrading to SurrealDB version 4.0.0 or later where this parsing inconsistency has been resolved in both the validator and parser components. For organizations unable to upgrade immediately, implementing strict input validation at the application layer is essential. This includes ensuring that any user-supplied data passed as MCP tool arguments undergoes rigorous sanitization before reaching the database interface. Additionally, deploying a Web Application Firewall with rules capable of detecting SQL injection patterns in identifier fields can provide an additional layer of defense. It is also recommended to enforce least-privilege principles for database accounts used by the MCP server, limiting their permissions to only those necessary for normal operation to minimize the potential blast radius should exploitation occur. Regular security audits and code reviews focusing on parser-validator consistency are critical to preventing similar discrepancies in future development cycles.