CVE-2025-71397

SurrealDB before 2.2.2 CPU Exhaustion via nested FOR loops

Published Jul 18, 2026 CVSS 4.0 · 7.1 High EPSS < 1% KEV · Not listed
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.

Analysis

AI-generated

Technical 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.

Remediation

No solution or workaround provided in the CVE record.

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 available
History
Type Values Removed Values Added
Metrics cvssV3_1

{'score': 6.5, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H'}

Type Values Removed Values Added
Metrics ssvc

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

Type Values Removed Values Added
CPEs cpe:2.3:a:surrealdb:surrealdb:*:*:*:*:*:*:*:*
Type Values Removed Values Added
First Time appeared Surrealdb
Surrealdb surrealdb
Vendors & Products Surrealdb
Surrealdb surrealdb
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'}

Weaknesses
  • CWE-835

    Loop with Unreachable Exit Condition ('Infinite Loop')

Sources

Status
PUBLISHED
Assigner
VulnCheck
Published
Updated
Oct 29, 2026, 9:15 PM
Reserved
Jul 16, 2026, 12:14 PM
Status
Analyzed
Published
Jul 18, 2026, 2:17 PM
Modified
Oct 29, 2026, 9:17 PM