{"id":"CVE-2024-58357","aliases":["CVE-2024-58357","GHSA-h4f5-h82v-5w4r"],"related":[],"kind":"vulnerability","state":"published","title":"SurrealDB before 2.1.0 Denial of Service via rand::time()","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"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.\n\n### Impact\n\nA 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.\n\n### Patches\n\nThe function has been updated in to guarantee that some `datetime` is returned or that an error is otherwise gracefully handled.\n\n- Version 2.1.0 and later are not affected by this issue.\n\n### Workarounds\n\nAffected 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.\n\n### References\n\n- #5126\n- [SurrealQL Documentation - Database Functions (`rand::time`)](https://surrealdb.com/docs/surrealql/functions/database/rand#randtime)\n- [SurrealDB Documentation - Security Capabilities (Functions)](https://surrealdb.com/docs/surrealdb/security/capabilities#functions)","format":"markdown","source":"ghsa"},{"lang":"es","text":"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.","source":"nvd"}],"published":"2024-11-22T20:11:38.000Z","modified":"2026-10-27T18:10:00.130Z","severity":{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"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","score":7.1,"rating":"HIGH"},"severities":[{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"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","score":7.1,"rating":"HIGH"},{"scorer":"VulnCheck","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":6.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":6.5,"rating":"MEDIUM"}],"cwes":["CWE-248"],"affected":[{"ranges":[{"type":"semver","introduced":"0","fixed":"2.1.0","status":"affected"},{"type":"semver","version":"2.1.0","status":"unaffected"}],"vendor":"surrealdb","product":"surrealdb","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","fixed":"2.1.0","status":"affected"},{"type":"semver","version":"2.1.0","status":"unaffected"}],"vendor":"surrealdb","product":"surrealdb","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"2.1.0"}],"ecosystem":"crates.io","package":"surrealdb","purl":"pkg:cargo/surrealdb","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"2.1.0"}],"ecosystem":"crates.io","package":"surrealdb-core","purl":"pkg:cargo/surrealdb-core","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"2.1.0"}],"vendor":"surrealdb","product":"surrealdb","cpe":"cpe:2.3:a:surrealdb:surrealdb:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/surrealdb/surrealdb/security/advisories/GHSA-h4f5-h82v-5w4r","tags":["vendor-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://www.vulncheck.com/advisories/surrealdb-before-denial-of-service-via-rand-time","tags":["third-party-advisory"],"sources":["cvelist","nvd"]},{"url":"https://github.com/surrealdb/surrealdb/pull/5126","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/surrealdb/surrealdb","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"VulnCheck","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-07-22T18:57:32.918Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2024-58357","url":"https://www.cve.org/CVERecord?id=CVE-2024-58357","licence":"CVE Terms of Use","modified":"2026-07-28T01:47:47.190Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-h4f5-h82v-5w4r","url":"https://github.com/advisories/GHSA-h4f5-h82v-5w4r","licence":"CC-BY-4.0","modified":"2026-07-19T03:56:48.449Z"},{"source":"nvd","name":"NVD","id":"CVE-2024-58357","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-58357","licence":"Public domain","modified":"2026-10-27T18:10:00.130Z"}],"updatedAt":"2026-11-25T22:58:53.047Z","epss":{"score":0.00314,"percentile":0.26186,"date":"2026-12-01T12:00:22.000Z"}}