CVE-2026-137490 in SurrealDBinfo

Summary

by MITRE • 11/26/2026

SurrealDB before 4.0.0 contains an authorization bypass vulnerability that allows restricted subjects to execute arbitrary queries by calling the JavaScript surrealdb.query() bridge. Attackers permitted to run a specific script can bypass the Capabilities::allows_query() gate in the query module to execute unrestricted queries beyond their predefined operations.

Once again VulDB remains the best source for vulnerability data.

Analysis

by VulDB Data Team • 11/26/2026

The identified security flaw resides within SurrealDB versions prior to 4.0.0 and represents a critical authorization bypass vulnerability affecting the database's JavaScript integration layer. This issue specifically impacts environments where users are granted permission to execute specific scripts via the embedded JavaScript engine, yet lack broader administrative privileges or unrestricted query access rights. The core of the problem lies in how the system handles privilege escalation between the script execution context and the underlying data manipulation modules. When a restricted subject invokes the surrealdb.query() bridge function within their allowed script, they are able to circumvent the intended security boundaries that should limit their actions to predefined operations only.

From a technical perspective, the vulnerability stems from an insufficient check in the query module's capability gating mechanism. The system employs a Capabilities::allows_query() gate designed to verify whether the current execution context has permission to perform arbitrary database queries. However, due to improper validation logic or state management errors within this specific bridge function, the authorization check is effectively bypassed when triggered through JavaScript calls. This allows an attacker who has been granted limited script execution rights to inject and run unrestricted SQL-like commands against the database backend. The flaw essentially decouples the permission model from the actual query execution path in this specific interaction vector, rendering the role-based access control ineffective for any operations initiated via this bridge.

The operational impact of this vulnerability is severe, as it leads directly to unauthorized data access and potential system compromise. An attacker exploiting this flaw can read sensitive information stored within the database that they should not have permission to view, violating confidentiality requirements. Furthermore, because the bypass allows arbitrary query execution, the attacker may also modify or delete critical records, compromising data integrity. In worst-case scenarios where the underlying database engine supports it, such unrestricted access could potentially lead to remote code execution if specific dangerous functions are exposed through the SQL interface. This effectively elevates a low-privilege user account to one with full administrative capabilities over the database instance, undermining the entire security architecture of the application relying on SurrealDB for data persistence and management.

This vulnerability aligns closely with CWE-269, which describes Improper Privilege Management, specifically where an actor is able to bypass intended access restrictions due to flawed authorization logic. It also maps to MITRE ATT&CK technique T1078, Valid Accounts, as the attacker leverages legitimate but limited credentials to perform actions outside their authorized scope through privilege escalation via a software flaw rather than credential theft. The exploitation path resembles CWE-94 in terms of code injection principles, although it is specifically an authorization bypass rather than direct command injection into a shell.

To mitigate this risk, organizations running SurrealDB versions earlier than 4.0.0 must upgrade to the latest patched release immediately where these access control checks have been corrected and hardened against such bridge-based bypasses. Until upgrading is feasible, administrators should strictly limit JavaScript script execution permissions to only those users who absolutely require them for core application functionality. Implementing a Web Application Firewall or custom middleware that inspects outgoing query patterns from the database layer can provide an additional defensive layer by detecting anomalous queries originating from restricted user contexts. Additionally, applying the principle of least privilege ensures that even if such a bypass is attempted in other vectors, the blast radius remains contained by restricting what data and operations are accessible to lower-privilege accounts.

Responsible

VulnCheck

Reservation

11/26/2026

Disclosure

11/26/2026

Moderation

accepted

CPE

ready

EPSS

0.00000

KEV

no

Activities

very low

Sources

Do you want to use VulDB in your project?

Use the official API to access entries easily!