Read the docs
TI-2025-43642 Aliases GHSA-3633-g6mg-p6qq

SurrealDB memory exhaustion via string::replace using regex

Priority LOW 38CWE-789Published · Updated

Key facts

Attack vector
—
Privileges required
—
User interaction
—
Attack complexity
—
Impact type
Denial of service
Confidentiality · integrity · availability
—
Fix status
Fixed

No CVSS vector from any source. Fix status from GitHub. Impact type from CWE-789.

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](https://surrealdb.com/docs/surrealdb/security/capabilities#functions) or the equivalent `SURREAL_CAPS_DENY_FUNC` environment variable. ### References [SurrealQL Documentation - DB Functions (string::replace)](https://surrealdb.com/docs/surrealql/functions/database/string#stringreplace) [SurrealDB Documentation - Capabilities](https://surrealdb.com/docs/surrealdb/security/capabilities#functions) [SurrealDB Documentation - Environment Variables](https://surrealdb.com/docs/surrealdb/cli/env) [#5619 ](https://github.com/surrealdb/surrealdb/pull/5619) [#5638 ](https://github.com/surrealdb/surrealdb/pull/5638)

Why it matters now

Fix Fixed surrealdb (crates.io): 2.2.2, 2.1.5, 2.0.5

SSVC decision points

Not available: CISA has not published SSVC decision points for this record.

Affected products

VendorProductAffected versionsFixed inStatusSource
—surrealdb (crates.io)2.2.0 to before 2.2.22.2.2Patch availableGHSA-3633-g6mg-p6qq
—surrealdb (crates.io)2.1.0 to before 2.1.52.1.5Patch availableGHSA-3633-g6mg-p6qq
—surrealdb (crates.io)before 2.0.52.0.5Patch availableGHSA-3633-g6mg-p6qq
  • surrealdb (crates.io) Vendor— Affected 2.2.0 to before 2.2.2 Fixed in 2.2.2 Patch available GHSA-3633-g6mg-p6qq
  • surrealdb (crates.io) Vendor— Affected 2.1.0 to before 2.1.5 Fixed in 2.1.5 Patch available GHSA-3633-g6mg-p6qq
  • surrealdb (crates.io) Vendor— Affected before 2.0.5 Fixed in 2.0.5 Patch available GHSA-3633-g6mg-p6qq

Remediation

  • Fix · GHSA-3633-g6mg-p6qq surrealdb (crates.io) Fixed in 2.2.2 Advisory →
  • Fix · GHSA-3633-g6mg-p6qq surrealdb (crates.io) Fixed in 2.1.5 Advisory →
  • Fix · GHSA-3633-g6mg-p6qq surrealdb (crates.io) Fixed in 2.0.5 Advisory →

Timeline

  1. 2026-10-03 Threatist record created from GHSA-3633-g6mg-p6qq

References

Sources

This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences