GHSA-3633-g6mg-p6qq — surrealdb
Fix: surrealdb/surrealdb#5619GHSA-3633-g6mg-p6qq is a CWE-789 vulnerability in surrealdb. A fix is available for surrealdb — see the affected versions and patch details below.
SurrealDB memory exhaustion via string::replace using regex
Exploitation Status
No confirmed exploitation observed yet
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for GHSA-3633-g6mg-p6qq.
EPSS Exploitation Probability
EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.
Real-World Exposure
surrealdb🦀surrealdb🦀surrealdbReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects crates.io packages — download data is not available via public APIs for these ecosystems.
Description
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
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🦀crates.io | surrealdb | ≥ 2.2.0&&< 2.2.2 | 2.2.2cargo update -p surrealdb --precise 2.2.2 |
| 🦀crates.io | surrealdb | ≥ 2.1.0&&< 2.1.5 | 2.1.5cargo update -p surrealdb --precise 2.1.5 |
| 🦀crates.io | surrealdb | all versions | 2.0.5cargo update -p surrealdb --precise 2.0.5 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for surrealdb, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update surrealdb to 2.2.2 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-3633-g6mg-p6qq is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like GHSA-3633-g6mg-p6qq can be triaged on real exposure rather than presence alone.
Tailored to GHSA-3633-g6mg-p6qq. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is GHSA-3633-g6mg-p6qq in your dependencies?
O3 Security finds GHSA-3633-g6mg-p6qq across crates.io dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.