CVE-2025-71395
JSON

7.1high

SurrealDB before 2.2.2 Memory Exhaustion via string::replace

Severity
7.1high CVSS:4.0 by VulnCheck
Exploit likelihood
0.34% (higher than 28% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
VulnCheck
Also known as
GHSA-3633-g6mg-p6qq

Description

SurrealDB versions before 2.2.2 contain a memory exhaustion vulnerability in the string::replace function that fails to restrict resulting string length when using regex patterns. An authenticated attacker can craft a malicious query to exhaust server memory through unbounded string allocations, causing denial of service.

Affected

Product or packageVersionsReported by
surrealdb surrealdbfrom 2.2.0 before 2.2.2, from 2.1.0 before 2.1.5, before 2.0.5
Not affected: 2.2.2, 2.1.5, 2.0.5
CVE List, NVD
surrealdb (crates.io)from 2.2.0 before 2.2.2, from 2.1.0 before 2.1.5, before 2.0.5GitHub Advisory Database

All scores

VulnCheck7.1high CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
GitHubhigh CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
NVD6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H

Classification

CWE-789

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

SurrealDB versions before 2.2.2 contain a memory exhaustion vulnerability in the string::replace function that fails to restrict resulting string length when using regex patterns. An authenticated attacker can craft a malicious query to exhaust server memory through unbounded string allocations, causing denial of service.

GitHub Advisory Database

An authenticated user can craft a query using the string::replace function that uses a Regex to perform a string replacement. As there is a failure to restrict the resulting string length, this enables an attacker to send a string::replace function to the SurrealDB server exhausting all the memory of the server due to string allocations. This eventually results in a Denial-of-Service situation for the SurrealDB server.

This issue was discovered and patched during an code audit and penetration test of SurrealDB by cure53. Using CVSSv4 definitions, the severity is High.

Impact

An authenticated user can crash the SurrealDB instance through memory exhaustion

Patches

A patch has been created that enforces a limit on string length SURREAL_GENERATION_ALLOCATION_LIMIT

  • Versions 2.0.5, 2.1.5, 2.2.2, and later are not affected by this issue
Workarounds

Affected users who are unable to update may want to limit the ability of untrusted clients to run the string::replace function in the affected versions of SurrealDB using the --deny-functions flag described within Capabilities or the equivalent SURREAL_CAPS_DENY_FUNC environment variable.

References

SurrealQL Documentation - DB Functions (string::replace) SurrealDB Documentation - Capabilities SurrealDB Documentation - Environment Variables #5619 #5638

NVD (es)

Las versiones de SurrealDB anteriores a la 2.2.2 contienen una vulnerabilidad de agotamiento de memoria en la función string::replace que no restringe la longitud de la cadena resultante al usar patrones de expresiones regulares. Un atacante autenticado puede crear una consulta maliciosa para agotar la memoria del servidor a través de asignaciones de cadenas ilimitadas, causando denegación de servicio.

References

Sources

SourceRecordLicence
CVE ListCVE-2025-71395 changed 2026-10-29CVE Terms of Use
GitHub Advisory DatabaseGHSA-3633-g6mg-p6qq changed 2026-07-19CC-BY-4.0
NVDCVE-2025-71395 changed 2026-10-29Public domain