Description
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.
Published: 2026-07-18
Score: 7.1 High
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

SurrealDB versions prior to 2.0.5, 2.1.x before 2.1.5, and 2.2.x before 2.2.2 allow authenticated users with OWNER or EDITOR rights to define custom functions using DEFINE FUNCTION. Although single loops are bounded, nesting multiple loops—each capable of up to one million iterations—enables an attacker to execute code that consumes all CPU time and renders the database server unresponsive until a manual restart, affecting only the availability of the service.

Affected Systems

All SurrealDB deployments running the affected releases where users with OWNER or EDITOR permissions can create custom functions are impacted. The vulnerable versions are any release before 2.0.5, any 2.1.x release prior to 2.1.5, and any 2.2.x release prior to 2.2.2.

Risk and Exploitability

The CVSS base score of 7.1 indicates high severity, while an EPSS score of less than 1 % suggests a low probability of exploitation in the wild. The vulnerability is not listed in the CISA KEV catalog. An attacker who can authenticate with OWNER or EDITOR rights can trigger the denial of service remotely, as the execution bypasses configured timeouts and leaves the server idle until a restart.

Generated by OpenCVE AI on July 30, 2026 at 23:02 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Apply the latest SurrealDB release (2.2.2 or later) to eliminate the vulnerable loop handling.
  • Restrict DEFINE FUNCTION privileges so that only superusers or a limited set of trusted accounts can create functions, reducing the attack surface.
  • Implement CPU resource limits or run the database in a container with constrained CPU quotas to mitigate the impact of accidental or malicious loops.

Generated by OpenCVE AI on July 30, 2026 at 23:02 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Tue, 28 Jul 2026 03:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}


Tue, 28 Jul 2026 02:30:00 +0000

Type Values Removed Values Added
CPEs cpe:2.3:a:surrealdb:surrealdb:*:*:*:*:*:*:*:*

Thu, 23 Jul 2026 21:45:00 +0000

Type Values Removed Values Added
First Time appeared Surrealdb
Surrealdb surrealdb
Vendors & Products Surrealdb
Surrealdb surrealdb

Sat, 18 Jul 2026 13:45:00 +0000

Type Values Removed Values Added
Description 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.
Title SurrealDB before 2.2.2 CPU Exhaustion via nested FOR loops
Weaknesses CWE-835
References
Metrics cvssV4_0

{'score': 7.1, 'vector': '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'}


Subscriptions

Surrealdb Surrealdb
cve-icon MITRE

Status: PUBLISHED

Assigner: VulnCheck

Published:

Updated: 2026-07-28T01:48:19.674Z

Reserved: 2026-07-16T12:14:41.770Z

Link: CVE-2025-71397

cve-icon Vulnrichment

Updated: 2026-07-20T15:12:45.994Z

cve-icon NVD

No data.

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-07-30T23:15:06Z

Weaknesses
  • CWE-835

    Loop with Unreachable Exit Condition ('Infinite Loop')