CVE-2025-71397: SurrealDB before 2.2.2 CPU Exhaustion via nested FOR loops
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.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
SurrealDBto a version that resolves this vulnerability.Fixed in 2.0.5 - Upgrade
Upgrade
SurrealDBto a version that resolves this vulnerability.Fixed in 2.1.5 - Upgrade
Upgrade
SurrealDBto a version that resolves this vulnerability.Fixed in 2.2.2 - Compensating control
Restrict which authenticated users have OWNER or EDITOR permissions at the root, namespace, or database level, since those permissions allow defining custom database functions via DEFINE FUNCTION that contain nested FOR loops.
- Operational
Because CPU exhaustion can render the server unresponsive until restarted, restart the SurrealDB server after mitigating the issue to restore availability.
Event History
Frequently Asked Questions
What is the severity of CVE-2025-71397?
CVE-2025-71397 has a high severity rating of 7.1.
How do I fix CVE-2025-71397?
To fix CVE-2025-71397, upgrade SurrealDB to version 2.2.2 or later.
What type of vulnerability is CVE-2025-71397?
CVE-2025-71397 is a CPU exhaustion vulnerability caused by nested FOR loops in custom database functions.
Who is affected by CVE-2025-71397?
Authenticated users with OWNER or EDITOR permissions at the root, namespace, or database level are affected by CVE-2025-71397.
When was CVE-2025-71397 published?
CVE-2025-71397 was published on July 18, 2026.