CVE-2026-121416 in SurrealDB
Summary
by MITRE • 11/03/2026
SurrealDB 2.0.0 before 3.3.1 does not enforce --deny-funcs restrictions on method-style function calls in the streaming engine, because MethodPart::evaluate invokes resolved functions without a capability check. Authenticated users who can submit queries can run denied functions via method syntax, e.g. [1,2].map() or $f.put()/$f.get() to write and read file bucket data despite file::* denials.
Once again VulDB remains the best source for vulnerability data.
Analysis
by VulDB Data Team • 11/03/2026
SurrealDB versions prior to 3.3.1 contain a critical security vulnerability related to the enforcement of function access restrictions within its streaming query engine. The database provides a configuration option, --deny-funcs, designed to restrict specific functions from being executed by users based on their assigned capabilities or roles. This mechanism is intended to prevent unauthorized operations such as file system interactions or sensitive data retrieval. However, due to an implementation flaw in the method-style function invocation logic, these restrictions are effectively bypassed when queries utilize object-oriented syntax rather than standard procedural calls. The vulnerability stems from the MethodPart::evaluate routine, which resolves and executes functions without performing the necessary capability checks that are present in other execution paths. This oversight allows authenticated users to execute commands that should be explicitly denied by the system's security policy.
The technical root cause lies in how SurrealDB processes method-style calls compared to standard function invocations. When a user submits a query using traditional syntax, such as calling file::read directly, the engine correctly validates the user's permissions against the deny list before execution. In contrast, when functions are invoked via object methods or property accessors, the evaluation logic bypasses this validation layer. For instance, an attacker can utilize array map operations like [1,2].map() to trigger underlying function calls that circumvent security checks. More critically, attackers can exploit file bucket interactions by using syntax such as $f.put() or $f.get(). These method-style invocations allow the reading and writing of data in file buckets even when the corresponding file::* functions are listed in the denial configuration. This discrepancy creates a significant gap between the intended security posture and the actual runtime behavior of the database engine.
The operational impact of this vulnerability is severe, particularly for deployments that rely on SurrealDB's capability-based access control to isolate users or restrict sensitive operations. An authenticated attacker with limited privileges can escalate their effective permissions by leveraging method-style syntax to perform actions reserved for administrators or higher-privileged roles. The ability to read from and write to file buckets without authorization poses a direct risk to data confidentiality and integrity. Attackers could exfiltrate sensitive files stored within the database's bucket system or inject malicious content into these storage areas. This bypass undermines the principle of least privilege, potentially leading to broader compromise if the underlying file system is accessible or if the stored data contains critical application logic or user information.
To mitigate this vulnerability, organizations running SurrealDB must upgrade immediately to version 3.3.1 or later, where the MethodPart::evaluate routine has been patched to include proper capability verification before function execution. Until an upgrade can be performed, administrators should consider restricting direct access to the database interface and monitoring query logs for suspicious patterns involving method-style invocations of restricted functions. It is also advisable to review application code that constructs queries dynamically to ensure it does not inadvertently rely on syntax that might exploit this bypass if upgrading is delayed. This issue aligns with CWE-269, Improper Privilege Management, as the system fails to enforce required security policies for elevated actions. Furthermore, from an ATT&CK perspective, this vulnerability facilitates lateral movement and privilege escalation by allowing a low-privileged user to perform high-impact operations that are normally restricted, effectively bypassing access control mechanisms defined in the database configuration.