CVE-2024-58358: Surrealdb SurrealDB Has An Uncaught Exception Vulnerability

MODERATE
Advisory Identifier: GHSA-jc55-246c-r88f
CVSS 4.9
CWE-248
Published
Advisory Summary

CVE-2024-58358 is a MODERATE (CVSS 4.9) 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 handling nonexistent role. Remediation is available by upgrading affected packages to version 2.1.0.

CVE-2024-58358 at a Glance

CVE Identifier CVE-2024-58358
GHSA Identifier GHSA-jc55-246c-r88f
Severity MODERATE
CVSS v3.1 Base Score 4.9
CWE Classification CWE-248: Uncaught Exception
Affected Product Surrealdb
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 4.9

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required High (PR:H)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2024-58358

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.

surrealdb fixed: 2.1.0
Upgrade surrealdb to 2.1.0
surrealdb-core fixed: 2.1.0
Upgrade surrealdb-core to 2.1.0
Verify Direct and Transitive Dependencies

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 CVE-2024-58358, 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

Roles for system users are stored as generic `Ident` values and converted as strings and into the `Role` enum whenever IAM operations are to be performed that require processing the user roles. This conversion expects those identifiers to only contain the values `owner`, `editor` and `viewer` and will return an error otherwise. However, the `unwrap()` method would be called on this result when implementing `std::convert::From<&Ident> for Role`, which would result in a panic where a nonexistent role was used. ### Impact A privileged user with the `owner` role at any level in SurrealDB would be able to define a user with `DEFINE USER` with an nonexistent role, which would panic when being converted to a `Role` enum in order to perform certain IAM operations with that user. These operations included signing in with the user. This would crash the server, leading to denial of service. ### Patches Unexistent roles are no longer accepted during parsing when defining a user. Even when successfully associated with a user, referencing unexistent roles will no longer result in a panic and will instead throw an `InvalidRole` error. - Version 2.1.0 and later are not affected by this issue. ### Workarounds Affected users who are unable to update may want to limit access to users with the `owner` role at any level to trusted parties only. 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. ### Resourcess - [#5079](https://github.com/surrealdb/surrealdb/pull/5079) - [#5092](https://github.com/surrealdb/surrealdb/pull/5092)

CVE-2024-58358 Affected Surrealdb Versions

2 component(s)
Fixed Versions:
2.1.0
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 CVE-2024-58358?
CVE-2024-58358 is a security vulnerability in Surrealdb involving SurrealDB has an Uncaught Exception Handling Nonexistent Role under CWE-248: Uncaught Exception.
Which Surrealdb versions are affected?
Affected versions include releases prior to 2.1.0 across affected packages: surrealdb, surrealdb-core.
What version fixes CVE-2024-58358?
Upgrading to 2.1.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is surrealdb affected?
Yes, surrealdb is affected in releases prior to 2.1.0. Upgrade your dependency to 2.1.0 or later.
Is surrealdb-core affected?
Yes, surrealdb-core is affected in releases prior to 2.1.0. Upgrade your dependency to 2.1.0 or later.
What is the CVSS score of CVE-2024-58358?
CVE-2024-58358 has a CVSS v3.1 base score of 4.9 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2024-58358?
CVE-2024-58358 is classified under CWE-248: Uncaught Exception (An exception is thrown from a function, but it is not caught.).
How can I check crates.io dependencies for CVE-2024-58358?
Run the dependency tree command: 'inspect dependencies for surrealdb'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-jc55-246c-r88f",
  "modified" : "2026-09-04T19:20:14Z",
  "published" : "2024-11-22T20:11:44Z",
  "aliases" : [ "CVE-2024-58358" ],
  "summary" : "SurrealDB has an Uncaught Exception Handling Nonexistent Role",
  "details" : "Roles for system users are stored as generic `Ident` values and converted as strings and into the `Role` enum whenever IAM operations are to be performed that require processing the user roles. This conversion expects those identifiers to only contain the values `owner`, `editor` and `viewer` and will return an error otherwise. However, the `unwrap()` method would be called on this result when implementing `std::convert::From<&Ident> for Role`, which would result in a panic where a nonexistent role was used.\n\n### Impact\n\nA privileged user with the `owner` role at any level in SurrealDB would be able to define a user with `DEFINE USER` with an nonexistent role, which would panic when being converted to a `Role` enum in order to perform certain IAM operations with that user. These operations included signing in with the user. This would crash the server, leading to denial of service.\n\n### Patches\n\nUnexistent roles are no longer accepted during parsing when defining a user. Even when successfully associated with a user, referencing unexistent roles will no longer result in a panic and will instead throw an `InvalidRole` error.\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 access to users with the `owner` role at any level to trusted parties only. 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### Resourcess\n\n- [#5079](https://github.com/surrealdb/surrealdb/pull/5079)\n- [#5092](https://github.com/surrealdb/surrealdb/pull/5092)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/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-jc55-246c-r88f"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-58358"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/surrealdb/surrealdb/pull/5079"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/surrealdb/surrealdb/pull/5092"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/surrealdb/surrealdb"
  }, {
    "type" : "WEB",
    "url" : "https://www.vulncheck.com/advisories/surrealdb-before-denial-of-service-via-nonexistent-role"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-248" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-11-22T20:11:44Z",
    "nvd_published_at" : null
  }
}