CVE-2025-71393
mediumpriority · track · 26EPSS 0.005 · 40 %ileEUUSEPSS · scored 2026-10-28
SurrealDB before 2.2.2 with scripting enabled fails to properly enforce recursion limits when native functions contain embedded JavaScript that issues new queries. Authenticated attackers can bypass the recursion limit by chaining native and JavaScript function calls to trigger infinite recursion and exhaust server memory.
cvss
Technical severity, 0–10. One row per scoring source.
base score 0–10 · higher = more severe · hover a vector to decode⚠ sources disagree · low–medium · 2.3–6.5
ssvc
A stakeholder decision — act, attend, or track — from exploitation and impact.
weaknesses
The CWE weakness classes this flaw belongs to.
affected products (9)
Products and version ranges known to be affected.
advisories (1)
Vendor and ecosystem advisories describing this.
- GHSA-m7rc-8w7m-r9qrSurrealDB vulnerable to memory exhaustion via nested functions and scripts2025-04-10ghsa · osvUS
In order to prevent DoS situations due to infinite recursions, SurrealDB implements a limit of nested calls for both native functions and embedded JavaScript functions. However, in SurrealDB instances with embedded scripting functions enabled, it was found that this limit can be circumvented by utilizing both at the same time. If a native function contains JavaScript which issues a new query that calls that function, the recursion limit is not triggered. Once executed, SurrealDB will follow the path of infinite recursions until the system runs out of memory, prior to the recursion limit being triggered. This vulnerability can only affect SurrealDB servers explicitly enabling the scripting capability with `--allow-scripting` or `--allow-all` and equivalent environment variables `SURREAL_CAPS_ALLOW_SCRIPT=true` and `SURREAL_CAPS_ALLOW_ALL=true`. This issue was discovered and patched during an code audit and penetration test of SurrealDB by cure53, the severity defined within cure53's preliminary finding is Medium, matched by our CVSS v4 assessment. ### Impact For SurrealDB instances with embedded scripting functions enabled, this attack could be used to perform a DoS attack on the server by an authenticated user. ### Patches A patch has been created that further limits scripting function call limit recursion depth and disallows multiple calls to `surreadb.query()` to run in parallel in a scripting function. - Versions 2.0.5, 2.1.5, 2.2.2 and later are not affected by this issue. ### Workarounds Deny execution of embedded scripting functions through the configuration of [capabilities](https://surrealdb.com/docs/surrealdb/security/capabilities#capabilities) by starting SurrealDB with the `--deny-scripting` flag or the equivalent environment variable `SURREAL_CAPS_DENY_SCRIPT=true`. This has a usability implication, although scripting functions are disabled by default. ### References [SurrealDB Documentation - Capabilities](https://surrealdb.com/docs/surrealdb/security/capabilities) [SurrealQL Documentation - Scripting Functions](https://surrealdb.com/docs/surrealql/functions/script)
also known as (3)
Other names and identifiers for this entity.
sources
Which sources assert this record, and when.
references (7)
External citations — patches, advisories, analysis.
- https://github.com/surrealdb/surrealdb/releasesPatchcnnvd
- https://github.com/surrealdb/surrealdb/security/advisories/GHSA-m7rc-8w7m-r9qrcnnvd
- https://www.vulncheck.com/advisories/surrealdb-before-memory-exhaustion-via-nested-functionscnnvd
- https://github.com/surrealdb/surrealdb/security/advisories/GHSA-m7rc-8w7m-r9qrenisa_euvd
- https://www.vulncheck.com/advisories/surrealdb-before-memory-exhaustion-via-nested-functionsenisa_euvd
- https://github.com/surrealdb/surrealdb/security/advisories/GHSA-m7rc-8w7m-r9qrVendor Advisorynvd
- https://www.vulncheck.com/advisories/surrealdb-before-memory-exhaustion-via-nested-functionsThird Party Advisorynvd
Attackers weaponise vulnerabilities like this against internet-exposed services. See what is exposed on your perimeter with a free passive scan.
Free scan