GHSA-2cvj-g5r5-jrrg: Surrealdb SurrealDB Has Local File Read Vulnerability

LOW
CWE-22
Published
Advisory Summary

GHSA-2cvj-g5r5-jrrg is a LOW surrealdb has local file read vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Surrealdb libraries in the crates.io ecosystem. The issue involves surrealdb has local file read of 2-column tsv files via analyzers. Remediation is available by upgrading affected packages to version 2.2.2, 2.1.5.

GHSA-2cvj-g5r5-jrrg at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-2cvj-g5r5-jrrg
Severity LOW
CVSS v3.1 Base Score N/A
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Surrealdb
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-2cvj-g5r5-jrrg

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.2.2
Upgrade surrealdb to 2.2.2
surrealdb fixed: 2.1.5
Upgrade surrealdb to 2.1.5
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-2cvj-g5r5-jrrg, 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.2.2), 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-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. 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

An authenticated system user at the root, namespace, or database levels can use the `DEFINE ANALYZER` statement to point to arbitrary file locations on the file system, and should the file be tab separated with two columns, the analyzer can be leveraged to exfiltrate the content. This issue was discovered and patched during an code audit and penetration test of SurrealDB by cure53, the severity defined within cure53's preliminary finding is Low, matched by our CVSS v4 assessment. ### Impact Limited to unauthorised access to 2 column TSV files on the file system ### Patches A patch has been created that introduces a new environment variable, `SURREAL_FILE_ALLOWLIST` , which contains a list of allowed file paths. When a mapping file is processed, the mapper checks if the file’s path is within one of the allowed paths. - Versions 2.1.5, 2.2.2 and later are not affected by this issue. ### Workarounds Users unable to update may want to limit those with root, namespace, or database level users to trusted parties only. ### References [SurrealQL Documentation - DEFINE ANALYZER](https://surrealdb.com/docs/surrealql/statements/define/analyzer#define-analyzer-statement) [#5600](https://github.com/surrealdb/surrealdb/pull/5600)

GHSA-2cvj-g5r5-jrrg Affected Surrealdb Versions

2 component(s)
Fixed Versions:
2.2.22.1.5
Product / Package Ecosystem Affected Versions Fixed Version
surrealdb
crates.io
≥ 2.2.0
< 2.2.2
2.2.2
surrealdb
crates.io
< 2.1.5
2.1.5

References

Frequently Asked Questions

What is GHSA-2cvj-g5r5-jrrg?
GHSA-2cvj-g5r5-jrrg is a security vulnerability in Surrealdb involving SurrealDB has local file read of 2-column TSV files via analyzers under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Surrealdb versions are affected?
Affected versions include releases prior to 2.2.2, 2.1.5 across affected packages: surrealdb.
What version fixes GHSA-2cvj-g5r5-jrrg?
Upgrading to 2.2.2, 2.1.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is surrealdb affected?
Yes, surrealdb is affected in releases prior to 2.2.2, 2.1.5. Upgrade your dependency to 2.2.2, 2.1.5 or later.
What CWE is associated with GHSA-2cvj-g5r5-jrrg?
GHSA-2cvj-g5r5-jrrg is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check crates.io dependencies for GHSA-2cvj-g5r5-jrrg?
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-2cvj-g5r5-jrrg",
  "modified" : "2025-04-10T21:08:50Z",
  "published" : "2025-04-10T21:08:50Z",
  "aliases" : [ ],
  "summary" : "SurrealDB has local file read of 2-column TSV files via analyzers ",
  "details" : "An authenticated system user at the root, namespace, or database levels can use the `DEFINE ANALYZER` statement to point to arbitrary file locations on the file system, and should the file be tab separated with two columns, the analyzer can be leveraged to exfiltrate the content.\n\nThis issue was discovered and patched during an code audit and penetration test of SurrealDB by cure53, the severity defined within cure53's preliminary finding is Low, matched by our CVSS v4 assessment.\n\n### Impact\nLimited to unauthorised access to 2 column TSV files on the file system\n\n### Patches\nA patch has been created that introduces a new environment variable, `SURREAL_FILE_ALLOWLIST` , which contains a list of allowed file paths. When a mapping file is processed, the mapper checks if the file’s path is within one of the allowed paths.\n\n- Versions 2.1.5, 2.2.2 and later are not affected by this issue.\n\n### Workarounds\nUsers unable to update may want to limit those with root, namespace, or database level users to trusted parties only.\n\n### References\n[SurrealQL Documentation - DEFINE ANALYZER](https://surrealdb.com/docs/surrealql/statements/define/analyzer#define-analyzer-statement)\n[#5600](https://github.com/surrealdb/surrealdb/pull/5600)",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "surrealdb"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.2.0"
      }, {
        "fixed" : "2.2.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "surrealdb"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.1.5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/surrealdb/surrealdb/security/advisories/GHSA-2cvj-g5r5-jrrg"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/surrealdb/surrealdb/pull/5600"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/surrealdb/surrealdb"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-04-10T21:08:50Z",
    "nvd_published_at" : null
  }
}