Skip to content
Heist/ feed
Back to feed
High

SurrealDB before 2.2.2 CPU Exhaustion via nested FOR loops

Type: advisorySources: OSV

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.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2025-71397
Confirmed fixed CVEs
Not specified
Updated in this feed
4 Nov 2026, 01:10 UTC · Revision 1

Source evidence

SurrealDB before 2.2.2 CPU Exhaustion via nested FOR loops

core-osv · Original source

Published 18 Jul 2026, 13:10 UTC

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.

osv:CVE-2025-71397
Complete source record
{
  "id": "9aae8e174cc88058620fc59fb51bfd68509c30d5679bb49f00e596d88f267dbe",
  "url": "https://osv.dev/vulnerability/CVE-2025-71397",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "SurrealDB before 2.2.2 CPU Exhaustion via nested FOR loops",
    "summary": "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.",
    "evidence": "osv:CVE-2025-71397",
    "products": [],
    "severity": "high",
    "structured": {
      "id": "CVE-2025-71397",
      "aliases": [
        "CVE-2025-71397",
        "GHSA-pxw4-94j3-v9pf"
      ],
      "metrics": [
        {
          "type": "CVSS_V4",
          "score": "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"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/surrealdb/surrealdb",
              "type": "GIT",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "a83e960ee5513a3e39c88f312fabba83f8e15322"
                },
                {
                  "introduced": "3fe28f57517a5d3255cdbb479c815d8021abf92a"
                },
                {
                  "fixed": "b0a15fa3a19ebe2785115c9948dfbde00399adc8"
                },
                {
                  "introduced": "0ee8dc2c3ec8e883038d0ee00bbce6a6126fe655"
                },
                {
                  "fixed": "e25952a66567ef303ad94908d04146e44a068d01"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "cpe": "cpe:2.3:a:surrealdb:surrealdb:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "2.0.5"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "cpe": "cpe:2.3:a:surrealdb:surrealdb:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "2.1.0"
                      },
                      {
                        "fixed": "2.1.5"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "cpe": "cpe:2.3:a:surrealdb:surrealdb:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "2.2.0"
                      },
                      {
                        "fixed": "2.2.2"
                      }
                    ],
                    "source": "CPE_RANGE"
                  }
                ]
              }
            }
          ],
          "versions": [
            "v2.2.1",
            "v2.1.4",
            "v2.0.4",
            "v2.2.0",
            "v2.1.3",
            "v2.1.2",
            "v2.1.1",
            "v2.1.0",
            "v2.0.3",
            "v2.0.2",
            "v2.0.1",
            "v2.0.0",
            "v2.0.0-beta.3",
            "v2.0.0-beta.2",
            "v2.0.0-beta.1",
            "v2.0.0-alpha.9",
            "v2.0.0-alpha.8",
            "v2.0.0-alpha.7",
            "v2.0.0-alpha.6",
            "v2.0.0-alpha.5",
            "v2.0.0-alpha.4",
            "v2.0.0-alpha.3",
            "v2.0.0-alpha.2",
            "v2.0.0-alpha.1",
            "v1.0.0",
            "v1.0.0-beta.12",
            "v1.0.0-beta.11",
            "v1.0.0-beta.10",
            "v1.0.0-beta.9+20230402",
            "v1.0.0-beta.9",
            "v1.0.0-beta.8",
            "v1.0.0-beta.7",
            "v1.0.0-beta.6",
            "v1.0.0-beta.5",
            "v1.0.0-beta.4",
            "v1.0.0-beta.3",
            "v1.0.0-beta.2",
            "v1.0.0-beta.1",
            "v0.3.0",
            "v0.1.30",
            "v0.1.29",
            "v0.1.28",
            "v0.1.27",
            "v0.1.26",
            "v0.1.25",
            "v0.1.24",
            "v0.1.23",
            "v0.1.22",
            "v0.1.21",
            "v0.1.20",
            "v0.1.19",
            "v0.1.18",
            "v0.1.17",
            "v0.1.16",
            "v0.1.15",
            "v0.1.14",
            "v0.1.13",
            "v0.1.12",
            "v0.1.11",
            "v0.1.10",
            "v0.1.9",
            "v0.1.8",
            "v0.1.7",
            "v0.1.6",
            "v0.1.5",
            "v0.1.4",
            "v0.1.3",
            "v0.1.2",
            "v0.1.1",
            "v0.1.0"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-71397.json"
          }
        }
      ],
      "modified": "2026-10-31T02:30:56.624241325Z",
      "provider": "osv",
      "references": [
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/71xxx/CVE-2025-71397.json",
        "https://github.com/surrealdb/surrealdb/security/advisories/GHSA-pxw4-94j3-v9pf",
        "https://nvd.nist.gov/vuln/detail/CVE-2025-71397",
        "https://www.vulncheck.com/advisories/surrealdb-before-cpu-exhaustion-via-nested-for-loops"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-835"
        ],
        "cna_assigner": "VulnCheck",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/71xxx/CVE-2025-71397.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2025-71397",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 499404,
  "published_at": "2026-07-18T13:10:15.129+00:00"
}