CVE-2025-71397 Details
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.
A denial-of-service vulnerability has been identified in SurrealDB versions prior to 2.0.5, 2.1.x prior to 2.1.5, and 2.2.x prior to 2.2.2. This vulnerability allows authenticated users with OWNER or EDITOR permissions at the root, namespace, or database level to create custom database functions using the DEFINE FUNCTION statement. The issue arises from the ability to nest FOR loops, each capable of iterating up to 1,000,000 times. While a single loop's iterations are limited, nesting multiple loops can lead to functions that consume excessive CPU resources. This unchecked execution monopolizes server processing, causing the database to become unresponsive to other queries and connections until it is manually restarted.
Users can upgrade to SurrealDB versions 2.0.5, 2.1.5, or 2.2.2. For those unable to upgrade, consider using the --allow-functions and/or --deny-functions options, or the corresponding SURREAL_CAPS_ALLOW_FUNC and SURREAL_CAPS_DENY_FUNC environment variables, to manage the execution of custom functions.
Metrics
CVSS 4.0 Severity and Vector Strings:
CVSS 3.x Severity and Vector Strings:
No data available for CVSS Version 2.0 on this CVE.
CISA-ADP
Assessed Jul 20, 2026References to Advisories, Solutions, and Tools
By selecting these links, you will be leaving this site. These are references gathered from the official CVE record and are not endorsed by Volerion.
| URL | Source(s) | Tag(s) |
|---|---|---|
| https://github.com/surrealdb/surrealdb/security/advisories/GHSA-pxw4-94j3-v9pf | [email protected] | Vendor Advisory |
| https://www.vulncheck.com/advisories/surrealdb-before-cpu-exhaustion-via-nested-for-loops | [email protected] | Third Party Advisory |
Weakness Enumeration
| CWE-ID | CWE Name | Source |
|---|---|---|
| CWE-835 | Loop with Unreachable Exit Condition ('Infinite Loop') | [email protected] |
Affected Products
| Product | Versions |
|---|---|
| surrealdb surrealdb | < 2.0.5 >= 2.1.0, < 2.1.5 >= 2.2.0, < 2.2.2 |
CPE
Remediation
| |
Change History
5 change records found show changes
| Date | Action | Recorded By |
|---|---|---|
| Oct 29, 2026 | CVE Modified | [email protected] |
| Sep 29, 2026 | CVE Translated | [email protected] |
| Aug 13, 2026 | Initial Analysis | [email protected] |
| Jul 20, 2026 | CVE Modified | CISA-ADP |
| Jul 18, 2026 | New CVE Received | [email protected] |