Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessAuthenticate with OWNER/EDITOR role
-
DeliveryConnect to SurrealQL query interface
-
ExploitDEFINE FUNCTION with nested FOR loops
-
ExecutionInvoke function with millions of iterations
-
PersistCPU fully consumed, timeouts bypassed
-
ImpactServer unresponsive until manual restart
Vulnerability Assessment
| Weakness |
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Loop termination conditions
MITRE ATT&CK
1 technique across 1 tactic: Impact The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Requires an authenticated account with OWNER or EDITOR permission at the root, namespace, or database level (PR:L) and that the instance permits custom function definition - i.e. the DEFINE FUNCTION capability is not already restricted via --deny-functions/--allow-functions. The attacker must be able to reach the query interface over the network (AV:N) and craft a function using nested FOR loops whose combined iteration count is large; no user interaction is needed. Exploitation is LIMITED by the privilege requirement (users without OWNER/EDITOR cannot define functions) and by any pre-existing function-capability restrictions, which is why this is realistically an insider/post-credential-compromise DoS rather than an anonymous one. |
| Impact | The provided CVSS 4.0 vector (AV:N/AC:L/AT:N/PR:L/UI:N, VA:H, all other impacts N) scores 7.1 and cleanly matches the description: network-reachable, low complexity, requires low privileges, and produces pure availability impact with no confidentiality or integrity loss. This is a genuine and easily weaponizable DoS, but its real-world risk is gated by the PR:L requirement - the attacker must already hold OWNER or EDITOR permissions at root, namespace, or database level, so this is primarily an insider or post-compromise/credential-abuse concern rather than an anonymous internet attack. No EPSS score was supplied, it is not listed in CISA KEV, and no POC was published, so there is no evidence of active or automated exploitation; however, the advisory fully describes the technique, making reproduction trivial for anyone with the required role. Net priority: patch promptly on any multi-tenant or shared SurrealDB deployment where non-admin principals hold EDITOR/OWNER, lower urgency where only fully trusted operators have those rights. |
| Exploit ScenarioDerived | An analyst or application account holding EDITOR rights on a shared SurrealDB namespace issues a single DEFINE FUNCTION creating a body of several nested FOR loops each iterating one million times, then calls it. The server pins all CPU on that call, ignores configured timeouts, and stops answering queries or accepting new connections until an operator forcibly restarts the process; no exploit tooling is needed beyond a normal SurrealQL client. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Jul 18, 2026
Denial of service in SurrealDB before 2.0.5, 2.1.x before 2.1.5, and 2.2.x before 2.2.2 lets an authenticated user with OWNER or EDITOR rights define a custom function containing nested FOR loops that bypasses per-loop iteration limits and consumes all server CPU, ignoring configured query timeouts. The multiplicative iteration count (e.g. several nested loops of 1,000,000 each) monopolizes the process until it is manually killed, blocking all other queries and new connections. Discovered during a cure53 audit; no public exploit identified at time of analysis and it is not on CISA KEV, though the technique is trivially reproducible from the advisory.
RemediationAI
Vendor-released patch: upgrade to SurrealDB 2.0.5, 2.1.5, or 2.2.2 (or later), which add a per-iteration context-cancellation/timeout check in ForEachStatement (fix in PR https://github.com/surrealdb/surrealdb/pull/5597; advisory GHSA-pxw4-94j3-v9pf). For deployments that cannot upgrade immediately, restrict custom function execution using the capabilities controls: set --deny-functions (or SURREAL_CAPS_DENY_FUNC) to block all custom functions, or use --allow-functions / SURREAL_CAPS_ALLOW_FUNC to permit only a vetted allowlist of trusted functions (see https://surrealdb.com/docs/surrealdb/security/capabilities#functions); the trade-off is that legitimate custom SurrealQL functions will be blocked or limited, which may break application logic. As a complementary control, minimize the number of principals granted OWNER or EDITOR at root/namespace/database scope, since those roles are the exploitation prerequisite.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in cargo
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
SurrealDB is a Rust-based multi-model database that exposes SurrealQL, a query language supporting user-defined logic via the DEFINE FUNCTION statement and FOR loop control flow. The root cause is CWE-835 (Loop with Unreachable Exit Condition / infinite loop): while the parser and interpreter cap the iteration count of a single FOR loop, they do not bound the combined cost of nested loops, so nesting N loops of one million iterations yields up to 10^(6N) executions. Critically, the ForEachStatement iteration path did not check for context cancellation, meaning configured statement/transaction timeouts never fired during the tight loop. The fix (PR #5597) adds a per-iteration check for context cancellation or timeout inside ForEachStatement so long-running loops can be aborted. Affected CPE is cpe:2.3:a:surrealdb:surrealdb across the listed version ranges.
Know when Surrealdb gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
Network-reachable SurrealQL interface (AV:N) with low complexity, but defining functions requires OWNER/EDITOR privileges (PR:L); impact is pure availability DoS (A:H) with no confidentiality or integrity effect and no scope change.
Primary rating from Vendor (VulnCheck).
CVSS VectorVendor: VulnCheck
Lifecycle Timeline
2DescriptionCVE.org
SurrealDB before 2.0.5, 2.1.x before 2.1.5, and 2.2.x before 2.2.2 allows authenticated users with OWNER or EDITOR permissions (at the root, namespace, or database level) to define custom database functions via DEFINE FUNCTION using nested FOR loops. Although a single loop's iteration count is constrained, nesting multiple loops (e.g., each with 1,000,000 iterations) is not, so an attacker can execute a function that consumes all server CPU time. Configured timeouts do not stop the execution, rendering the server unresponsive to other queries and connections until it is manually restarted.
Executive ViewAI
SurrealDB deployments face authenticated denial-of-service risk where privileged users can design custom functions with nested loops to exhaust server CPU and disable database operations for all other users. Organizations should immediately assess which instances are affected and tighten access controls for elevated roles.
Restrict OWNER and EDITOR role assignments to essential trusted personnel only; implement strict query timeout enforcement at the application layer; disable custom function functionality if operationally unnecessary; enable and monitor SurrealDB logs for function creation events and abnormal CPU consumption; implement database-level resource quotas if available.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Denial of Service attacks render applications or systems unavailable by overwhelming resources or triggering failure conditions.
Privilege escalation via second-order SurrealQL injection in SurrealDB before 2.0.5, 2.1.5, and 2.2.2 lets an authentica
SurrealDB versions 1.0.0 through 3.x (before 4.0.0) fail to enforce built-in function capability checks inside the embed
Privilege escalation in SurrealDB before v3.1.0 lets unauthenticated attackers hijack the privileges of concurrently-act
Memory exhaustion in SurrealDB 3.0.4 through 3.x lets unauthenticated remote clients pin up to 64 MiB of in-flight WebSo
SQL injection in the Model Context Protocol (MCP) server component of SurrealDB 3.1.0 through 3.x (fixed in 4.0.0) allow
Authenticated tenants of SurrealDB 3.0.0 through 3.x can escape key-based ACL boundaries in direct filesystem buckets an
Filesystem bucket path traversal in SurrealDB 3.0.0 before 4.0.0 allows an attacker with bucket-operation access to read
SurrealDB releases before 4.0.0 fail to check query capability inside the embedded JavaScript bridge, so a low-privilege
SurrealDB 1.0.0 through 3.x lets an authenticated user with only the database-level VIEWER role read, modify, and delete
Use-after-free in SurrealDB Core before 3.3.0 can crash or corrupt memory in Rust applications that embed the database a
Cross-bucket file disclosure and modification on Windows affects SurrealDB versions 3.0.0 up to but not including 4.0.0
Denial of service in SurrealDB before 3.1.0 lets an unauthenticated remote attacker crash the database with a single Web
EUVD-2025-210488
GHSA-33m9-4q46-9q55
NVD
CVE.org
EPSS
VulDB
Exploit-DB