{"id":"CVE-2025-71395","aliases":["GHSA-3633-g6mg-p6qq"],"url":"https://o3.security/vulnerability/CVE-2025-71395","summary":"SurrealDB before 2.2.2 Memory Exhaustion via string::replace","details":"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.\n\nThis issue was discovered and patched during an code audit and penetration test of SurrealDB by cure53. Using CVSSv4 definitions, the severity is High. \n\n### Impact\nAn authenticated user can crash the SurrealDB instance through memory exhaustion\n\n### Patches\nA patch has been created that enforces a limit on string length  `SURREAL_GENERATION_ALLOCATION_LIMIT`\n\n- Versions 2.0.5, 2.1.5, 2.2.2, and later are not affected by this issue\n\n### Workarounds\nAffected 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](https://surrealdb.com/docs/surrealdb/security/capabilities#functions) or the equivalent `SURREAL_CAPS_DENY_FUNC` environment variable.\n\n### References\n\n[SurrealQL Documentation - DB Functions (string::replace)](https://surrealdb.com/docs/surrealql/functions/database/string#stringreplace)\n[SurrealDB Documentation - Capabilities](https://surrealdb.com/docs/surrealdb/security/capabilities#functions)\n[SurrealDB Documentation - Environment Variables](https://surrealdb.com/docs/surrealdb/cli/env)\n[#5619 ](https://github.com/surrealdb/surrealdb/pull/5619)\n[#5638 ](https://github.com/surrealdb/surrealdb/pull/5638)","published":"2026-07-18T13:10:13.744Z","modified":"2026-10-31T02:30:26.151635913Z","cvss":null,"epss":null,"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"crates.io","name":"surrealdb","fixedVersion":"2.2.2"},{"ecosystem":"crates.io","name":"surrealdb","fixedVersion":"2.1.5"},{"ecosystem":"crates.io","name":"surrealdb","fixedVersion":"2.0.5"}],"fix":{"url":"https://github.com/surrealdb/surrealdb/pull/5619","label":"surrealdb/surrealdb#5619"},"references":[{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/71xxx/CVE-2025-71395.json"},{"type":"ADVISORY","url":"https://github.com/surrealdb/surrealdb/security/advisories/GHSA-3633-g6mg-p6qq"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-71395"},{"type":"ADVISORY","url":"https://www.vulncheck.com/advisories/surrealdb-before-memory-exhaustion-via-string-replace"},{"type":"WEB","url":"https://github.com/surrealdb/surrealdb/pull/5619"},{"type":"WEB","url":"https://github.com/surrealdb/surrealdb/pull/5638"},{"type":"PACKAGE","url":"https://github.com/surrealdb/surrealdb"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-10-31T02:30:26.151635913Z"}}