GHSA-qjrv-v6qp-x99x: Surrealdb SurrealDB Has An Uncaught Exception Vulnerability

HIGH
CVSS 6.5
CWE-248
Published
Advisory Summary

GHSA-qjrv-v6qp-x99x is a HIGH (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 handling parsing errors on empty strings. Remediation is available by upgrading affected packages to version 2.0.4.

GHSA-qjrv-v6qp-x99x at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-qjrv-v6qp-x99x
Severity HIGH
CVSS v3.1 Base Score 6.5
CWE Classification CWE-248: Uncaught Exception
Affected Product Surrealdb
Package Ecosystem crates.io
Published Date
Last Updated

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).

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

How to Fix GHSA-qjrv-v6qp-x99x

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.0.4
Upgrade surrealdb to 2.0.4
surrealdb-core fixed: 2.0.4
Upgrade surrealdb-core to 2.0.4
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 GHSA-qjrv-v6qp-x99x, 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.0.4), 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

The error rendering code from the parser would panic when handling failed parsing of queries where the error occurred when converting an empty string to a SurrealDB value. This would be the case when casting an empty string to a `record`, `duration` or `datetime`, as well as potentially when parsing an empty string to JSON or providing an empty string to the `type::field` and `type::fields` functions. ### Impact A client that is authorized to run queries in a SurrealDB server would be able to execute a malformed query which would fail to parse when converting an empty string and cause a panic in the error rendering code. This would crash the server, leading to denial of service. ### Patches - Version 2.0.4 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 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.

GHSA-qjrv-v6qp-x99x Affected Surrealdb Versions

2 component(s)
Fixed Versions:
2.0.4
Product / Package Ecosystem Affected Versions Fixed Version
surrealdb
crates.io
≥ 2.0.0
< 2.0.4
2.0.4
surrealdb-core
crates.io
≥ 2.0.0
< 2.0.4
2.0.4

References

Frequently Asked Questions

What is GHSA-qjrv-v6qp-x99x?
GHSA-qjrv-v6qp-x99x is a security vulnerability in Surrealdb involving SurrealDB has an Uncaught Exception Handling Parsing Errors on Empty Strings under CWE-248: Uncaught Exception.
Which Surrealdb versions are affected?
Affected versions include releases prior to 2.0.4 across affected packages: surrealdb, surrealdb-core.
What version fixes GHSA-qjrv-v6qp-x99x?
Upgrading to 2.0.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is surrealdb affected?
Yes, surrealdb is affected in releases prior to 2.0.4. Upgrade your dependency to 2.0.4 or later.
Is surrealdb-core affected?
Yes, surrealdb-core is affected in releases prior to 2.0.4. Upgrade your dependency to 2.0.4 or later.
What is the CVSS score of GHSA-qjrv-v6qp-x99x?
GHSA-qjrv-v6qp-x99x has a CVSS v3.1 base score of 6.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with GHSA-qjrv-v6qp-x99x?
GHSA-qjrv-v6qp-x99x 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 GHSA-qjrv-v6qp-x99x?
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-qjrv-v6qp-x99x",
  "modified" : "2024-10-08T22:20:02Z",
  "published" : "2024-10-08T22:20:02Z",
  "aliases" : [ ],
  "summary" : "SurrealDB has an Uncaught Exception Handling Parsing Errors on Empty Strings",
  "details" : "The error rendering code from the parser would panic when handling failed parsing of queries where the error occurred when converting an empty string to a SurrealDB value. This would be the case when casting an empty string to a `record`, `duration` or `datetime`, as well as potentially when parsing an empty string to JSON or providing an empty string to the `type::field` and `type::fields` functions.\n\n### Impact\n\nA client that is authorized to run queries in a SurrealDB server would be able to execute a malformed query which would fail to parse when converting an empty string and cause a panic in the error rendering code. This would crash the server, leading to denial of service.\n\n### Patches\n\n- Version 2.0.4 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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "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"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "surrealdb"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.0.4"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "surrealdb-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.0.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/surrealdb/surrealdb/security/advisories/GHSA-qjrv-v6qp-x99x"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/surrealdb/surrealdb/pull/4923"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/surrealdb/surrealdb/commit/709d6efe901dbf3e207b4fc2ebc30775595efc16"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/surrealdb/surrealdb"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-248" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-10-08T22:20:02Z",
    "nvd_published_at" : null
  }
}