CVE-2025-71392: Surrealdb SurrealDB Server-takeover Vulnerability

CRITICAL
Advisory Identifier: GHSA-ccj3-5p93-8p42
CWE-77
Published
Advisory Summary

CVE-2025-71392 is a CRITICAL surrealdb server-takeover vulnerability (CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection')) affecting Surrealdb libraries in the crates.io ecosystem. The issue involves surrealdb server-takeover via surrealql injection on backup import. Remediation is available by upgrading affected packages to version 2.2.2, 2.1.5, 2.0.5.

CVE-2025-71392 at a Glance

CVE Identifier CVE-2025-71392
GHSA Identifier GHSA-ccj3-5p93-8p42
Severity CRITICAL
CVSS v3.1 Base Score N/A
CWE Classification CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection')
Affected Product Surrealdb
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix CVE-2025-71392

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
surrealdb fixed: 2.0.5
Upgrade surrealdb to 2.0.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 CVE-2025-71392, 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-77: Improper Neutralization of Special Elements used in a Command ('Command Injection'), where the product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component. 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 SurrealDB command-line tool allows exporting databases through the `export` command. It was discovered that table or field names are not properly sanitized in exports, leading to a SurrealQL injection when the backup is reimported. For the injection to occur, an authenticated System User with `OWNER` or `EDITOR` roles needs to create tables or fields with malicious names containing SurrealQL, subsequently exported using the `export` operation The attacker could achieve a privilege escalation and root level access to the SurrealDB instance if a higher privileged user subsequently performs the `import` operation. Furthermore, applications using SurrealDB that allow its users to define custom fields or tables are at risk of a universal second order SurrealQL injection, even if query parameters are properly sanitized. 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 Critical, matched by our CVSS v4 assessment. ### Impact This attack can be used to perform privilege escalation and complete takeover (root access) of the SurrealDB instance, as well as being able to perform SurrealQL injection attacks against co-tenanted applications where SurrealDB is used as a shared backend for multiple applications. ### Patches A patch has been created that addresses the issue by fixing the bugs in the exporter which failed to escape some characters properly. - Versions 2.0.5, 2.1.5, 2.2.2 and later are not affected by this issue. ### Workarounds For SurrealDB users that are unable to upgrade, users that are looking to perform `import` operations must manually inspect the exported data for injected statements, prior to importing. ### Resources [SurrealDB Documentation - Export](https://surrealdb.com/docs/surrealdb/cli/export) [SurrealDB Documentation - Import](https://surrealdb.com/docs/surrealdb/cli/import) [SurrealDB Documentation - Authentication](https://surrealdb.com/docs/surrealdb/security/authentication)

CVE-2025-71392 Affected Surrealdb Versions

3 component(s)
Fixed Versions:
2.2.22.1.52.0.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.0
< 2.1.5
2.1.5
surrealdb
crates.io
< 2.0.5
2.0.5

References

Frequently Asked Questions

What is CVE-2025-71392?
CVE-2025-71392 is a security vulnerability in Surrealdb involving SurrealDB server-takeover via SurrealQL injection on backup import under CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection').
Which Surrealdb versions are affected?
Affected versions include releases prior to 2.2.2, 2.1.5, 2.0.5 across affected packages: surrealdb.
What version fixes CVE-2025-71392?
Upgrading to 2.2.2, 2.1.5, 2.0.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, 2.0.5. Upgrade your dependency to 2.2.2, 2.1.5, 2.0.5 or later.
What CWE is associated with CVE-2025-71392?
CVE-2025-71392 is classified under CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection') (The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.).
How can I check crates.io dependencies for CVE-2025-71392?
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-ccj3-5p93-8p42",
  "modified" : "2026-09-04T19:36:33Z",
  "published" : "2025-04-11T14:07:34Z",
  "aliases" : [ "CVE-2025-71392" ],
  "summary" : "SurrealDB server-takeover via SurrealQL injection on backup import",
  "details" : "The SurrealDB command-line tool allows exporting databases through the `export` command. It was discovered that table or field names are not properly sanitized in exports, leading to a SurrealQL injection when the backup is reimported.\n\nFor the injection to occur, an authenticated System User with `OWNER` or `EDITOR` roles needs to create tables or fields with malicious names containing SurrealQL, subsequently exported using the `export` operation\n\nThe attacker could achieve a privilege escalation and root level access to the SurrealDB instance if a higher privileged user subsequently performs the `import` operation. \n\nFurthermore, applications using SurrealDB that allow its users to define custom fields or tables are at risk of a universal second order SurrealQL injection, even if query parameters are properly sanitized. \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 Critical, matched by our CVSS v4 assessment.\n\n### Impact\nThis attack can be used to perform privilege escalation and complete takeover (root access) of the SurrealDB instance, as well as being able to perform SurrealQL injection attacks against co-tenanted applications where SurrealDB is used as a shared backend for multiple applications.\n\n### Patches\nA patch has been created that addresses the issue by fixing the bugs in the exporter which failed to escape some characters properly.\n\n- Versions 2.0.5, 2.1.5, 2.2.2 and later are not affected by this issue.\n\n\n### Workarounds\nFor SurrealDB users that are unable to upgrade, users that are looking to perform `import` operations must manually inspect the exported data for injected statements, prior to importing. \n\n\n### Resources\n[SurrealDB Documentation - Export](https://surrealdb.com/docs/surrealdb/cli/export)\n[SurrealDB Documentation - Import](https://surrealdb.com/docs/surrealdb/cli/import)\n[SurrealDB Documentation - Authentication](https://surrealdb.com/docs/surrealdb/security/authentication)",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H"
  } ],
  "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" : "2.1.0"
      }, {
        "fixed" : "2.1.5"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "surrealdb"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.0.5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/surrealdb/surrealdb/security/advisories/GHSA-ccj3-5p93-8p42"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-71392"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/surrealdb/surrealdb"
  }, {
    "type" : "WEB",
    "url" : "https://www.vulncheck.com/advisories/surrealdb-before-surrealql-injection-via-export"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-77" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-04-11T14:07:34Z",
    "nvd_published_at" : null
  }
}