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.
Security readout for executives and security teams
Plain-English summary
An authenticated SurrealDB user with OWNER or EDITOR permissions can create a database function that monopolizes server CPU. The database may stop serving queries and connections, and configured timeouts do not halt the workload. Recovery may require a manual restart, creating a material availability risk.
Executive priority
Prioritize remediation for production, shared, or externally reachable databases where privileged credentials could be misused. The vulnerability does not indicate data theft, but a single authorized or compromised account could cause sustained service disruption. Upgrade promptly and reduce privileged access while scheduling remediation.
Technical view
CVE-2025-71397 is a CWE-835 CPU-exhaustion flaw in SurrealDB custom functions. Nested FOR loops bypass the practical protection provided by individual loop limits. A privileged authenticated user can trigger sustained CPU consumption remotely, causing denial of service without compromising data confidentiality or integrity.
Likely exposure
Exposure exists where affected SurrealDB versions permit potentially untrusted or compromised accounts with OWNER or EDITOR rights at root, namespace, or database scope. Internet exposure increases reachability, but internal and multi-tenant deployments remain relevant because authentication and elevated database permissions are required.
Exploitation context
The supplied sources do not report active exploitation, and the CVE is not identified as being in CISA KEV. Exploitation requires authentication and OWNER or EDITOR permissions, but has low stated complexity and needs no user interaction. Successful abuse can make the server unavailable until restarted.
Researcher notes
Affected releases are SurrealDB before 2.0.5, 2.1.x before 2.1.5, and 2.2.x before 2.2.2. CVSS 4.0 is 7.1 with high vulnerable-system availability impact. Testing should remain non-disruptive because configured timeouts reportedly cannot terminate the CPU-consuming execution.
Mitigation direction
Upgrade affected branches to 2.0.5, 2.1.5, or 2.2.2 respectively, or a later vendor-supported release.
Restrict OWNER and EDITOR permissions to trusted accounts with a documented operational need.
Review custom database functions and remove unnecessary definitions created by privileged users.
Monitor CPU saturation and database responsiveness until upgrades are complete.
Follow the SurrealDB vendor advisory for any additional remediation guidance.
Validation and detection
Inventory every SurrealDB deployment and record its exact version and branch.
Identify accounts holding OWNER or EDITOR permissions at root, namespace, and database levels.
Audit custom function definitions for unexpected nested loops or unexplained recent changes.
Confirm upgraded instances report a fixed or later vendor-supported version.
Verify monitoring detects CPU saturation and operations personnel can safely restart affected services.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · low confidence lookup
CWE-835: Exact CWE lookup
Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
The CVE wording references database injection or access, so collection and exfiltration review may help. This is a Glexia inferred lookup path, not an official MITRE, ATT&CK, or CVE Program mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-835 · source CWE mapping
Loop with Unreachable Exit Condition ('Infinite Loop')
Loop with Unreachable Exit Condition ('Infinite Loop') represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.