7.1high
SurrealDB before 2.1.0 Denial of Service via rand::time()
- Severity
- 7.1high CVSS:4.0 by VulnCheck
- Exploit likelihood
- 0.31% (higher than 26% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- VulnCheck
- Also known as
- GHSA-h4f5-h82v-5w4r
Description
SurrealDB versions before 2.1.0 contain an uncaught exception vulnerability in the rand::time() function that panics when unwrap is called on a None result from timestamp_opt. Authorized clients can repeatedly invoke rand::time() to reliably trigger server panics and cause denial of service.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| surrealdb surrealdb | before 2.1.0 Not affected: 2.1.0 | CVE List, NVD |
| surrealdb (crates.io) | before 2.1.0 | GitHub Advisory Database |
| surrealdb-core (crates.io) | before 2.1.0 | GitHub Advisory Database |
All scores
| VulnCheck | 7.1high CVSS:4.0 | 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 |
| VulnCheck | 6.5medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H |
| GitHub | 6.5medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.
What each source says
CVE List
SurrealDB versions before 2.1.0 contain an uncaught exception vulnerability in the rand::time() function that panics when unwrap is called on a None result from timestamp_opt. Authorized clients can repeatedly invoke rand::time() to reliably trigger server panics and cause denial of service.
GitHub Advisory Database
The rand::time() function in SurrealQL generates a random time from an optional range of two Unix timestamps. Due to the underlying use of timestamp_opt from the chrono crate, this function could potentially return None in some instances, leading to a panic when unwrap was called on its result in order to return a SurrealQL datetime type to the caller of the function.
Impact
A client that is authorized to run queries in a SurrealDB server would be able to make repeated (in the order of millions) calls to rand::time() in order to reliably trigger a panic. This would crash the server, leading to denial of service.
Patches
The function has been updated in to guarantee that some datetime is returned or that an error is otherwise gracefully handled.
- Version 2.1.0 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 rand::time() function in the affected versions of SurrealDB using security capabilities. To limit the impact of the denial of service, SurrealDB administrators may also want to ensure that the SurrealDB process is running so that it can be automatically re-started after a crash.
References
NVD (es)
Las versiones de SurrealDB anteriores a la 2.1.0 contienen una vulnerabilidad de excepción no capturada en la función rand::time() que entra en pánico cuando se llama a unwrap sobre un resultado None de timestamp_opt. Los clientes autorizados pueden invocar repetidamente rand::time() para provocar de forma fiable pánicos en el servidor y causar denegación de servicio.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2024-58357 changed 2026-07-28 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-h4f5-h82v-5w4r changed 2026-07-19 | CC-BY-4.0 |
| NVD | CVE-2024-58357 changed 2026-10-27 | Public domain |