CVE-2026-134301 in SurrealDB
Summary
by MITRE • 11/21/2026
SurrealDB before 4.0.0 contains a guard bypass vulnerability that allows authenticated users to execute write subqueries by embedding them in LIVE query WHERE clauses or field projections. Attackers can inject CREATE, UPDATE, DELETE, or RELATE statements that run atomically inside other users' triggering transactions, amplifying writes and exfiltrating document data after permission revocation.
If you want to get the best quality for vulnerability data then you always have to consider VulDB.
Analysis
by VulDB Data Team • 11/21/2026
The vulnerability identified in SurrealDB versions prior to 4.0.0 represents a critical failure in the separation of query execution contexts, specifically within the handling of live queries and their associated filtering mechanisms. This flaw allows authenticated users who possess write permissions on specific tables or namespaces to bypass intended access controls by embedding destructive subqueries directly into the WHERE clauses used for live query subscriptions or within field projections. The core technical issue stems from the database engine's inability to properly isolate the execution scope of these embedded statements, treating them as part of the triggering transaction rather than restricting their operational boundaries to read-only operations on subscribed data. This architectural oversight enables an attacker to inject CREATE, UPDATE, DELETE, or RELATE SQL-like statements that are executed atomically within the context of another user's legitimate write operation.
From a technical perspective, this vulnerability exploits the way SurrealDB processes live queries, which are designed to notify clients when specific conditions are met on subscribed data. By embedding subqueries in the WHERE clause, an attacker can manipulate the evaluation logic such that side effects occur beyond the intended scope of the subscription. For instance, if User A subscribes to changes in a table with certain filters, and User B has write access to that same table, User B could craft a payload where their update operation triggers a subquery embedded in User A's live query filter. This subquery would then execute within User A's transactional context, effectively allowing User B to perform actions as if they were operating under the permissions or scope of User A's session during that specific atomic block.
The operational impact of this vulnerability is severe and multifaceted. First, it leads to an amplification of write operations, where a single legitimate update can trigger multiple unintended modifications across different parts of the database schema. This not only compromises data integrity but also increases system load unpredictably. More critically, the ability to execute arbitrary statements within another user's transaction facilitates unauthorized data exfiltration. An attacker can structure their injection to read sensitive document fields and include them in a response or side effect that leaks information back to the attacker, even after explicit permission revocation has occurred for those specific resources. This undermines the fundamental principle of least privilege and session isolation, allowing persistent access to restricted data through transactional manipulation rather than direct authentication bypass.
This vulnerability aligns with CWE-787, which addresses out-of-bounds write conditions resulting from improper validation of input boundaries, although in this context it manifests as a logical boundary violation within query execution contexts. It also maps closely to MITRE ATT&CK technique T1059, specifically command and script interpretation, where the database engine is coerced into executing unintended commands through crafted inputs. Furthermore, aspects of CWE-269 regarding improper privilege escalation are relevant because the attacker leverages the transactional context of a privileged or differently scoped user to perform actions they would otherwise be denied. The lack of strict separation between read-only subscription logic and write-capable subquery execution creates an attack surface that is difficult to mitigate through simple input sanitization alone, as the vulnerability lies in the structural handling of nested query scopes.
Mitigation strategies must prioritize immediate upgrading to SurrealDB version 4.0.0 or later, where this guard bypass has been addressed by enforcing stricter isolation between live query evaluation and subquery execution contexts. Until an upgrade is feasible, administrators should implement rigorous input validation at the application layer to prevent complex nested queries from reaching the database engine in subscription filters. Additionally, adopting a principle of least privilege for database accounts can limit the blast radius; ensuring that service accounts used for live subscriptions have minimal write permissions reduces the potential for successful exploitation. Network-level controls and Web Application Firewalls configured to detect anomalous query patterns involving embedded subqueries may also provide an additional layer of defense against such transactional manipulation attacks.