← Back to CVE Explorer

CVE-2025-71397

Full vulnerability record from the local CVENow database.

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.

Severity
HIGH
CVSS score
7.1 (v4.0)
Vulnerability status
Analyzed
Source identifier
Published
2026-07-18 14:17:11.220000
Last modified
2026-10-29 21:17:06.450000
View original CVE JSON
{
  "id": "CVE-2025-71397",
  "sourceIdentifier": "[email protected]",
  "published": "2026-07-18T14:17:11.220",
  "lastModified": "2026-10-29T21:17:06.450",
  "vulnStatus": "Analyzed",
  "cveTags": [],
  "descriptions": [
    {
      "lang": "en",
      "value": "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."
    },
    {
      "lang": "es",
      "value": "SurrealDB antes de 2.0.5, 2.1.x antes de 2.1.5, y 2.2.x antes de 2.2.2 permite a usuarios autenticados con permisos de PROPIETARIO o EDITOR (a nivel de raíz, espacio de nombres o base de datos) definir funciones personalizadas de base de datos a través de DEFINE FUNCTION usando bucles FOR anidados. Aunque el recuento de iteraciones de un solo bucle está restringido, el anidamiento de múltiples bucles (por ejemplo, cada uno con 1.000.000 de iteraciones) no lo está, por lo que un atacante puede ejecutar una función que consume todo el tiempo de CPU del servidor. Los tiempos de espera configurados no detienen la ejecución, dejando al servidor sin respuesta a otras consultas y conexiones hasta que se reinicia manualmente."
    }
  ],
  "affected": [
    {
      "source": "[email protected]",
      "affectedData": [
        {
          "vendor": "surrealdb",
          "product": "surrealdb",
          "defaultStatus": "unaffected",
          "packageURL": "pkg:cargo/surrealdb",
          "versions": [
            {
              "version": "2.2.0",
              "lessThan": "2.2.2",
              "versionType": "semver",
              "status": "affected"
            },
            {
              "version": "2.2.2",
              "versionType": "semver",
              "status": "unaffected"
            }
          ]
        },
        {
          "vendor": "surrealdb",
          "product": "surrealdb",
          "defaultStatus": "unaffected",
          "packageURL": "pkg:cargo/surrealdb",
          "versions": [
            {
              "version": "2.1.0",
              "lessThan": "2.1.5",
              "versionType": "semver",
              "status": "affected"
            },
            {
              "version": "2.1.5",
              "versionType": "semver",
              "status": "unaffected"
            }
          ]
        },
        {
          "vendor": "surrealdb",
          "product": "surrealdb",
          "defaultStatus": "unaffected",
          "packageURL": "pkg:cargo/surrealdb",
          "versions": [
            {
              "version": "0",
              "lessThan": "2.0.5",
              "versionType": "semver",
              "status": "affected"
            },
            {
              "version": "2.0.5",
              "versionType": "semver",
              "status": "unaffected"
            }
          ]
        }
      ]
    }
  ],
  "metrics": {
    "cvssMetricV40": [
      {
        "source": "[email protected]",
        "type": "Secondary",
        "cvssData": {
          "version": "4.0",
          "vectorString": "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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
          "baseScore": 7.1,
          "baseSeverity": "HIGH",
          "attackVector": "NETWORK",
          "attackComplexity": "LOW",
          "attackRequirements": "NONE",
          "privilegesRequired": "LOW",
          "userInteraction": "NONE",
          "vulnConfidentialityImpact": "NONE",
          "vulnIntegrityImpact": "NONE",
          "vulnAvailabilityImpact": "HIGH",
          "subConfidentialityImpact": "NONE",
          "subIntegrityImpact": "NONE",
          "subAvailabilityImpact": "NONE",
          "exploitMaturity": "NOT_DEFINED",
          "confidentialityRequirement": "NOT_DEFINED",
          "integrityRequirement": "NOT_DEFINED",
          "availabilityRequirement": "NOT_DEFINED",
          "modifiedAttackVector": "NOT_DEFINED",
          "modifiedAttackComplexity": "NOT_DEFINED",
          "modifiedAttackRequirements": "NOT_DEFINED",
          "modifiedPrivilegesRequired": "NOT_DEFINED",
          "modifiedUserInteraction": "NOT_DEFINED",
          "modifiedVulnConfidentialityImpact": "NOT_DEFINED",
          "modifiedVulnIntegrityImpact": "NOT_DEFINED",
          "modifiedVulnAvailabilityImpact": "NOT_DEFINED",
          "modifiedSubConfidentialityImpact": "NOT_DEFINED",
          "modifiedSubIntegrityImpact": "NOT_DEFINED",
          "modifiedSubAvailabilityImpact": "NOT_DEFINED",
          "Safety": "NOT_DEFINED",
          "Automatable": "NOT_DEFINED",
          "Recovery": "NOT_DEFINED",
          "valueDensity": "NOT_DEFINED",
          "vulnerabilityResponseEffort": "NOT_DEFINED",
          "providerUrgency": "NOT_DEFINED"
        }
      }
    ],
    "cvssMetricV31": [
      {
        "source": "[email protected]",
        "type": "Primary",
        "cvssData": {
          "version": "3.1",
          "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H",
          "baseScore": 6.5,
          "baseSeverity": "MEDIUM",
          "attackVector": "NETWORK",
          "attackComplexity": "LOW",
          "privilegesRequired": "LOW",
          "userInteraction": "NONE",
          "scope": "UNCHANGED",
          "confidentialityImpact": "NONE",
          "integrityImpact": "NONE",
          "availabilityImpact": "HIGH"
        },
        "exploitabilityScore": 2.8,
        "impactScore": 3.6
      }
    ],
    "ssvcV203": [
      {
        "source": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
        "ssvcData": {
          "timestamp": "2026-07-20T15:12:40.333706Z",
          "id": "CVE-2025-71397",
          "options": [
            {
              "exploitation": "none"
            },
            {
              "automatable": "no"
            },
            {
              "technicalImpact": "partial"
            }
          ],
          "role": "CISA Coordinator",
          "version": "2.0.3"
        }
      }
    ]
  },
  "weaknesses": [
    {
      "source": "[email protected]",
      "type": "Secondary",
      "description": [
        {
          "lang": "en",
          "value": "CWE-835"
        }
      ]
    }
  ],
  "configurations": [
    {
      "nodes": [
        {
          "operator": "OR",
          "negate": false,
          "cpeMatch": [
            {
              "vulnerable": true,
              "criteria": "cpe:2.3:a:surrealdb:surrealdb:*:*:*:*:*:*:*:*",
              "versionEndExcluding": "2.0.5",
              "matchCriteriaId": "D8978D31-3395-4155-8DFF-99FED3F8D7DA"
            },
            {
              "vulnerable": true,
              "criteria": "cpe:2.3:a:surrealdb:surrealdb:*:*:*:*:*:*:*:*",
              "versionStartIncluding": "2.1.0",
              "versionEndExcluding": "2.1.5",
              "matchCriteriaId": "0D7A2AEC-83EE-46CC-BC91-D5EA1B841E96"
            },
            {
              "vulnerable": true,
              "criteria": "cpe:2.3:a:surrealdb:surrealdb:*:*:*:*:*:*:*:*",
              "versionStartIncluding": "2.2.0",
              "versionEndExcluding": "2.2.2",
              "matchCriteriaId": "B4D2EDCC-A5D1-477A-ADA9-A32389A7D0BE"
            }
          ]
        }
      ]
    }
  ],
  "references": [
    {
      "url": "https://github.com/surrealdb/surrealdb/security/advisories/GHSA-pxw4-94j3-v9pf",
      "source": "[email protected]",
      "tags": [
        "Vendor Advisory"
      ]
    },
    {
      "url": "https://www.vulncheck.com/advisories/surrealdb-before-cpu-exhaustion-via-nested-for-loops",
      "source": "[email protected]",
      "tags": [
        "Third Party Advisory"
      ]
    }
  ]
}