CVE-2025-71395 — Vulnerability in surrealdb — CVE Details
SurrealDB memory exhaustion via string::replace using regex
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.45%). Schedule for your next planned update.
Does your project use an affected surrealdb version?
Paste your Cargo.lock to check it for CVE-2025-71395 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
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
Advisory Timeline
- First published April 11, 2025 (595 days ago).
- Last revised July 19, 2026 — 464 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
cargo update -p surrealdb --precise 2.1.5
cargo update -p surrealdb --precise 2.2.2
cargo update -p surrealdb --precise 2.0.5
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (3)
Affects 1 ecosystem: crates.io (1).
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-789
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 6.5 score means for each attack dimension.
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
References
Frequently Asked Questions
- What is CVE-2025-71395?
- SurrealDB memory exhaustion via string::replace using regex. This vulnerability has been assigned a severity rating of HIGH (CVSS score: 6.5/10).
- How do I check if my project is affected by CVE-2025-71395?
- CVE-2025-71395 affects surrealdb. It has a 0.4% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2025-71395 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Exploitation requires specific conditions, or the impact is limited.
This is a below-median EPSS score — only 31.1% of tracked vulnerabilities score at or below it, so most tracked vulnerabilities are considered more likely to be exploited than this one.
Also Known As
Related CVEs
- CVE-2025-71392CRITICAL
SurrealDB server-takeover via SurrealQL injection on backup import
- CVE-2024-58367HIGH
SurrealDB: Improper Authorization in Select Permissions
- CVE-2026-63739HIGH
SurrealDB: Arbitrary file read via DEFINE ANALYZER mapper() filter
- CVE-2026-63740MEDIUM
SurrealDB: Array element-level (field.*) SELECT permissions leak denied elements to record users
- CVE-2024-58364MEDIUM
Uncaught Exception Handling Parsing Errors on Line Terminators
- CVE-2026-63743MEDIUM
SurrealDB: Port-specific --deny-net rules silently bypassed on HTTP redirect
- CVE-2026-63755MEDIUM
SurrealDB: Scraping a TABLE with no available PERMISSIONS to current auth level
- CVE-2024-58363MEDIUM
SurrealDB vulnerable to Improper Authentication when Changing Databases as Scope User