79% vs 51%: independent neobanks lag on app security. Read the report

Deep Dive

Deep Dive

SurrealDB JavaScript Bridge Capability Bypass (CVE-2026-134292)

SurrealDB's embedded JavaScript bridge skipped function capability checks, so a restricted script could run denied built-in functions; fixed in 4.0.0.

TL;DR

  • SurrealDB's surrealdb.functions bridge called the internal function dispatchers directly, so a script could run a built-in function its session was denied.
  • SurrealDB 1.0.0 through 3.3.5 is affected when embedded JavaScript is enabled. A subject allowed to run a script but denied a built-in function is enough.
  • VulnCheck published CVE-2026-134292 on 2026-11-21, rated CVSS v4.0 9.3 Critical and v3.1 9.8 Critical. SurrealDB's own advisory rates it High. No exploitation is known and the CVE is not in CISA KEV as of 2026-11-22.
  • Upgrade to SurrealDB 4.0.0 or later; 4.0.1 is current. If the upgrade has to wait, turn off embedded scripting and review the function families you deny.

Am I affected?

All of these conditions must hold for an instance to be exposed:

  • It runs SurrealDB 1.0.0 through 3.3.5. Version 4.0.0 fixes the flaw, and 4.0.1 is the current release.
  • Embedded JavaScript is enabled. It is off by default and is turned on with --allow-scripting, with --allow-all when --deny-scripting is absent, or through the equivalent embedded configuration.
  • A subject that can run a script is denied at least one built-in function or the arbitrary-query capability. The denial usually comes from a --deny-funcs list, an --allow-funcs list that omits the function, or an embedded capability configuration.

The vendor advisory describes the attacker as an unprivileged user. The CVE record's CVSS v4.0 vector marks privileges required as none (PR:N), while its v3.1 vector also marks PR:N. The gap matters: a guest session that is allowed to run scripts is the closest case to unauthenticated, and a logged-in low-privilege user is the case the advisory describes. Treat any session that can evaluate a function() { ... } block as a potential starting point.

Release line Affected versions Fixed version
3.x 3.0.0 through 3.3.5 4.0.0
2.x 2.x releases before 4.0.0 4.0.0
1.x 1.0.0 and later 1.x releases 4.0.0

The CVE record rates the flaw CVSS v4.0 9.3 Critical (CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N) and CVSS v3.1 9.8 Critical (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H); the vendor advisory rates it High.

The same VulnCheck batch published 17 SurrealDB CVEs on 2026-11-21. One is Critical, 12 are High and four are Medium by the CVSS v4.0 base score in their NVD records.

One Critical among 17 CVEs
Figure 1: The 17 SurrealDB CVEs published on 2026-11-21 by CVSS v4.0 base severity. Source: NVD CVE records, checked November 22, 2026

Check the running server and its capability flags:

surreal version
ps -eo pid,args | grep '[s]urreal start'
surreal start --help | grep -iE 'scripting|funcs'

For a container, inspect the running process and its command:

docker exec <container> surreal version
docker inspect <container> --format '{{json .Config.Cmd}} {{json .Config.Entrypoint}}'

For a Rust application that embeds SurrealDB as a library, check the dependency and the capability builder:

cargo tree -i surrealdb
grep -rn "with_scripting\|Capabilities::" --include="*.rs" .

A server with scripting disabled is not exposed to this flaw. That includes the default configuration and any instance that passes --deny-scripting.

How do I fix it?

Upgrade to SurrealDB 4.0.0 or later and restart the server. The same release also fixes the companion JavaScript query-bridge flaw described in "What is the root cause?".

  1. Install the current release with the official installer, then confirm the version:
curl -sSf https://install.surrealdb.com | sh
surreal version
  1. For the official container image, pull the fixed tag and recreate the container. Restarting the existing container is not enough when the image reference is unchanged:
docker pull surrealdb/surrealdb:v4.0.0
docker stop surreal
docker rm surreal
docker run -d --name surreal surrealdb/surrealdb:v4.0.0 start --user root --pass <password> rocksdb:/data/surreal.db
  1. If you build SurrealDB from source, build the 4.0.0 tag or later and redeploy the resulting server binary.

  2. Test the upgrade before production. Version 4.0.0 is a major release, and the release notes should be reviewed for changes that affect your schema and clients.

If the upgrade cannot happen now, turn off embedded scripting for the instance. Remove --allow-scripting, or add --deny-scripting when the instance runs with --allow-all.

Then review the function families you deny. The deny list still gates SurrealQL call sites, so leave it in place; drop only an entry you added solely to constrain scripts, and only if you also want SurrealQL call sites to reach that family again. Disabling scripting costs you legitimate scripted functions, and it does not change the capability model for SurrealQL itself. It closes this bypass because the bridge cannot run without the scripting runtime.

What is the root cause?

The JavaScript bridge dispatched built-in functions and queries through internal functions that do not enforce capabilities. SurrealQL call sites check the capability first, and the bridge skipped that check.

SurrealDB gates built-in functions with a function capability. The SurrealQL path computes the function through Function::compute() and BuiltinFunctionExec::evaluate(), which consult the capability set before the function runs. The embedded JavaScript path exposes the same functions under surrealdb.functions, and its dispatcher called the internal implementation directly.

The vulnerable dispatcher is in surrealdb/core/src/fnc/script/modules/surrealdb/functions/mod.rs at v3.3.5. Both the synchronous and asynchronous bridges pass the function name straight to fnc:

fn run(js_ctx: js::Ctx<'_>, name: &str, args: Vec<Value>) -> Result<Value> {
    let res = {
        let this = js_ctx.userdata::<QueryContext<'_>>().expect("query context should be set");
        // Process the called function
        fnc::synchronous(this.context, this.doc, name, args)
    };
    // ...
}

async fn fut(js_ctx: js::Ctx<'_>, name: &str, args: Vec<Value>) -> Result<Value> {
    let res = {
        let this = js_ctx.userdata::<QueryContext<'_>>().expect("query context should be set");
        // Process the called function
        Stk::enter_scope(|stk| {
            stk.run(|stk| fnc::asynchronous(stk, this.context, this.opt, this.doc, name, args))
        })
        .await
    };
    // ...
}

A script reaches that dispatcher with a call such as surrealdb.functions.http.get("http://169.254.169.254/latest/meta-data/"). The dispatcher receives name = "http::get" and executes it. Nothing between the script and the dispatcher asks whether the session's capabilities allow http::get.

The same file family had a second bridge, surrealdb.query, in surrealdb/core/src/fnc/script/modules/surrealdb/query/mod.rs. Its query() function parsed and executed the script's SurrealQL without calling Capabilities::allows_query(), so a script could run arbitrary queries even when the subject was not allowed to. SurrealDB published that as the companion advisory GHSA-fq69-wr4w-v3gm and fixed both bridges in one commit. The vendor advisory credits ARSB.

How is it exploited?

A subject that is allowed to run a script but denied a function calls that function through the JavaScript bridge, and the server runs it.

  1. The instance enables scripting and denies one or more function families, for example with --deny-funcs http or a restricted --allow-funcs list.
  2. The attacker obtains a session that can evaluate a script. The advisory describes an unprivileged user; a guest session with scripting enabled is the least-privileged case.
  3. The attacker submits a query that evaluates an embedded JavaScript block:
RETURN function() {
  return await surrealdb.functions.http.get("http://169.254.169.254/latest/meta-data/");
};

In SurrealQL the function block is evaluated in place, so its body runs when the statement runs.

  1. The bridge dispatches http::get through fnc::asynchronous without checking the function capability, so the request leaves the server even though http is denied in SurrealQL.
  2. With the companion query bridge, the attacker can instead call surrealdb.query("SELECT * FROM <table>") to run a query the session's allows_query setting denies.

The advisory does not publish a full request sequence. The fix commit includes tests that exercise the denial path rather than exploit code. The mechanism is visible in the source and in the advisory's description. No in-the-wild exploitation is known as of 2026-11-22.

How does the attack flow?

A script reaches the same built-in dispatcher that SurrealQL uses, but through a bridge that never asks the capability set, so a denied function runs with the server's authority.

flowchart LR A["Restricted session runs
a function() block"] --> B["surrealdb.functions bridge
receives function name"] B --> C["Bridge calls fnc::asynchronous
directly"] C --> D["No allows_function_name check
capability is bypassed"] D --> E["Denied built-in runs
http, file, eval or session"] E --> F["Impact follows the function:
SSRF, file access, query execution"]

What can an attacker do?

The attacker can run any built-in function the server's capability set denies, and the impact is whatever that function does. It does not grant operating-system access by itself.

  • Reach network targets. Calling http::get or another http function from a denied family makes the database server issue the request. That reaches internal services and cloud metadata endpoints the server can route to, which is a server-side request forgery primitive.
  • Read or write files the process can reach. The file family is subject to the same bridge. Where the operator denied it but the process account can open a path, the script can call it.
  • Run SurrealQL the session is not allowed to run. The companion surrealdb.query bridge bypasses allows_query, so a script can read or change records the subject's query capability forbids.
  • Reach other denied families. eval, session, sequence and sleep are dispatched through the same bridge. Which ones matter depends on the deny list and on what the deployment has enabled.

The conditions are listed in full here. Embedded scripting must be enabled; the attacker must hold a session that can evaluate a script; and the target function must be denied but reachable by the server process. The CVE record's vector marks no privileges required and no user interaction, while the vendor advisory describes an unprivileged authenticated user. The post does not claim that an unauthenticated internet client can reach the bridge on every deployment.

Why does the fix work?

The fix adds the missing capability check to both JavaScript bridges before they dispatch a function or a query.

 fn run(js_ctx: js::Ctx<'_>, name: &str, args: Vec<Value>) -> Result<Value> {
    let res = {
        let this = js_ctx.userdata::<QueryContext<'_>>().expect("query context should be set");
-       // Process the called function
-       fnc::synchronous(this.context, this.doc, name, args)
+       // The bridge dispatches a built-in function, so it is bound by the
+       // function capability (deny-funcs) like every other call site.
+       if !this.context.get_capabilities().allows_function_name(name) {
+           Err(crate::dbs::capabilities::Error::FunctionNotAllowed(name.to_string()).into())
+       } else if reads_the_clock(this.context, name) {
+           run_clock_read(this.context, this.doc, name, args)
+       } else {
+           fnc::synchronous(this.context, this.doc, name, args)
+       }
    };

The asynchronous bridge gets the same check before it calls fnc::asynchronous. The bridge now fails with the same FunctionNotAllowed error a denied SurrealQL call returns, so the script cannot tell the two paths apart.

The query bridge applies its own gate before parsing the script's query:

        let res = async {
+           if !query_ctx.context.get_capabilities().allows_query(
+               &crate::dbs::capabilities::ArbitraryQueryTarget::from(query_ctx.opt.auth.as_ref()),
+           ) {
+               return Err(Exception::throw_message(
+                   &ctx,
+                   &crate::dbs::capabilities::Error::FunctionNotAllowed(
+                       "surrealdb.query".to_string(),
+                   )
+                   .to_string(),
+               ));
+           }
            let query = if query.is_object() {

The fix covers both dispatchers in the script module and the query bridge. It does not change the capability model, so an operator's existing deny list starts applying to scripts as it already applied to SurrealQL.

How do I check if I was compromised?

There are no published indicators of compromise for this CVE. The bypass is defined by a missing log entry: a denied function runs without the capability-denied warning SurrealDB writes for a blocked SurrealQL call.

Check whether scripting was enabled and which functions were denied during the exposure window:

ps -eo args | grep '[s]urreal start'
grep -iE 'scripting|deny|allow' /var/log/surreal*.log

Then review the server's own query and audit logging, if it is enabled, for function() { blocks or calls to surrealdb.functions from low-privilege users:

grep -iE 'surrealdb\.functions|function\(\)' /var/log/surreal*.log

Because a successful call bypasses the capability check, the absence of a "Capabilities denied" line for a function is not evidence that the function was not called. Review network egress from the SurrealDB host for requests to internal addresses or cloud metadata endpoints that did not come from an expected workload. A failed attempt may leave no trace beyond the script query itself.

Timeline

  • 2026-10-21: Fix commit 0b8be14543 merged, covering the function and query bridges.
  • 2026-11-03: SurrealDB 4.0.0 released and the vendor advisory GHSA-5w6j-qm42-4rc2 published.
  • 2026-11-09: SurrealDB 4.0.1 released.
  • 2026-11-21: VulnCheck published CVE-2026-134292 at 16:35 UTC.

The fix was merged 31 days before the CVE
Figure 2: From the fix commit on 2026-10-21 to CVE-2026-134292 on 2026-11-21, with 4.0.0 and 4.0.1 released in between. Source: SurrealDB commit, releases and CVE record, checked November 22, 2026

FAQ

Am I affected if I never enabled scripting? No. Embedded JavaScript is off by default. The bridge cannot run unless the instance enables it with --allow-scripting, with --allow-all and no --deny-scripting, or through the embedded equivalent.

Does --allow-all alone expose me? Only if some function or the arbitrary-query capability is still denied. The flaw bypasses a denial, so an instance that allows everything has nothing for the bridge to bypass. The common exposure is --allow-all combined with a deny list for sensitive families such as http or file.

Is this exploitable without authentication? The vendor advisory describes an unprivileged user, and the CVE vector marks no privileges required. A guest session that can run scripts is the closest unauthenticated case. Whether guest access is enabled depends on the deployment, and this post does not claim that every instance is reachable anonymously.

Does the fix break scripted functions? No. The fix applies the capabilities the operator already configured. A script that calls a function the session is allowed to call keeps working; a script that calls a denied function now fails, as the SurrealQL path already did.

Does upgrading to 4.0.0 change anything else? 4.0.0 is a major release and also fixes the companion query-bridge issue. Review the release notes and test your schema and clients before upgrading production.

Is CVE-2026-134292 exploited in the wild? No exploitation is known as of 2026-11-22, and it is not in CISA KEV. The advisory and the fix's regression tests are the public evidence.

Find exposed SurrealDB instances with Ostorlab

Ostorlab's attack surface discovery inventories the hosts and services your organisation exposes, so you can find internet-facing SurrealDB endpoints and decide which to restrict or patch first. Detection of this specific SurrealDB flaw is not confirmed; the inventory supports the manual version and capability check in "Am I affected?".

References

  • SurrealDB security advisory GHSA-5w6j-qm42-4rc2, published 2026-11-03 (checked November 22, 2026): https://github.com/surrealdb/surrealdb/security/advisories/GHSA-5w6j-qm42-4rc2
  • SurrealDB companion advisory GHSA-fq69-wr4w-v3gm, published 2026-11-03 (checked November 22, 2026): https://github.com/surrealdb/surrealdb/security/advisories/GHSA-fq69-wr4w-v3gm
  • CVE-2026-134292 record, published 2026-11-21 (checked November 22, 2026): https://www.cve.org/CVERecord?id=CVE-2026-134292
  • Fix commit 0b8be14543, "fix(script): JS bridge bypasses the query and function capabilities", merged 2026-10-21 (checked November 22, 2026): https://github.com/surrealdb/surrealdb/commit/0b8be14543
  • SurrealDB v4.0.0 release, published 2026-11-03 (checked November 22, 2026): https://github.com/surrealdb/surrealdb/releases/tag/v4.0.0
  • SurrealDB v4.0.1 release, published 2026-11-09 (checked November 22, 2026): https://github.com/surrealdb/surrealdb/releases/tag/v4.0.1
  • SurrealDB capabilities documentation (checked November 22, 2026): https://surrealdb.com/docs/surrealdb/security/capabilities
  • SurrealDB repository, 33,341 stars (checked November 22, 2026): https://github.com/surrealdb/surrealdb
  • Official SurrealDB container image, 4,088,388 pulls (checked November 22, 2026): https://hub.docker.com/r/surrealdb/surrealdb
  • surrealdb crate, 1,932,954 downloads and 609,641 in the last 90 days (checked November 22, 2026): https://crates.io/crates/surrealdb