GHSA-m52v-24p8-654f: Surrealdb SurrealDB Has An Uncaught Exception Vulnerability
MODERATEGHSA-m52v-24p8-654f is a MODERATE (CVSS 6.5) surrealdb has an uncaught exception vulnerability (CWE-248: Uncaught Exception) affecting Surrealdb libraries in the crates.io ecosystem. The issue involves surrealdb has an uncaught exception sorting tables by random order. Remediation is available by upgrading affected packages to version 2.1.0.
GHSA-m52v-24p8-654f at a Glance
Security Impact
CVSS: 6.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H).
How to Fix GHSA-m52v-24p8-654f
To remediate this vulnerability, upgrade all affected Surrealdb dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade surrealdb to 2.1.0
Upgrade surrealdb-core to 2.1.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for surrealdb
How to Check if You Are Affected
To determine whether your application is affected by GHSA-m52v-24p8-654f, inspect your project dependencies for Surrealdb:
inspect dependencies for surrealdb
Analyze the terminal output to locate any version of Surrealdb in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.1.0), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-248: Uncaught Exception, where an exception is thrown from a function, but it is not caught. In Surrealdb, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-m52v-24p8-654f Affected Surrealdb Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
surrealdb
|
crates.io |
< 2.1.0
|
2.1.0
|
|
surrealdb-core
|
crates.io |
< 2.1.0
|
2.1.0
|
References
Frequently Asked Questions
What is GHSA-m52v-24p8-654f?
Which Surrealdb versions are affected?
What version fixes GHSA-m52v-24p8-654f?
Is surrealdb affected?
Is surrealdb-core affected?
What is the CVSS score of GHSA-m52v-24p8-654f?
What CWE is associated with GHSA-m52v-24p8-654f?
How can I check crates.io dependencies for GHSA-m52v-24p8-654f?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-m52v-24p8-654f",
"modified" : "2024-11-22T20:11:48Z",
"published" : "2024-11-22T20:11:48Z",
"aliases" : [ ],
"summary" : "SurrealDB has an Uncaught Exception Sorting Tables by Random Order",
"details" : "Sorting table records using an `ORDER BY` clause with the `rand()` function as sorting mechanism could cause a panic due to relying on a comparison function that did not implement total order. This event resulted in a panic due to a recent [change in Rust 1.81](https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html#new-sort-implementations).\n\n### Impact\n\nA client that is authorized to run queries in a SurrealDB server would be able to query a table with `ORDER BY rand()` in order to potentially cause a panic in the sorting function. This would crash the server, leading to denial of service.\n\n### Patches\n\nThe sorting algorithm has been updated to guarantee total order when shuffling records.\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 arbitrary SurrealQL queries in the affected versions of SurrealDB. 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- https://github.com/surrealdb/surrealdb/issues/4969\n- https://github.com/surrealdb/surrealdb/pull/4989\n- https://github.com/surrealdb/surrealdb/pull/4805\n- https://github.com/surrealdb/surrealdb/pull/4906",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "crates.io",
"name" : "surrealdb"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.1.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "surrealdb-core"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.1.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/surrealdb/surrealdb/security/advisories/GHSA-m52v-24p8-654f"
}, {
"type" : "WEB",
"url" : "https://github.com/surrealdb/surrealdb/issues/4969"
}, {
"type" : "WEB",
"url" : "https://github.com/surrealdb/surrealdb/pull/4805"
}, {
"type" : "WEB",
"url" : "https://github.com/surrealdb/surrealdb/pull/4906"
}, {
"type" : "WEB",
"url" : "https://github.com/surrealdb/surrealdb/pull/4989"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/surrealdb/surrealdb"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-248" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2024-11-22T20:11:48Z",
"nvd_published_at" : null
}
}