Advisory Database
  • Advisories
  • Dependency Scanning
  1. cargo
  2. ›
  3. surrealdb
  4. ›
  5. GHSA-ccj3-5p93-8p42

GHSA-ccj3-5p93-8p42: SurrealDB server-takeover via SurrealQL injection on backup import

April 11, 2025

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.

References

  • github.com/advisories/GHSA-ccj3-5p93-8p42
  • github.com/surrealdb/surrealdb
  • github.com/surrealdb/surrealdb/security/advisories/GHSA-ccj3-5p93-8p42

Code Behaviors & Features

Detect and mitigate GHSA-ccj3-5p93-8p42 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 2.0.5, all versions starting from 2.1.0 before 2.1.5, all versions starting from 2.2.0 before 2.2.2

Fixed versions

  • 2.2.2
  • 2.1.5
  • 2.0.5

Solution

Upgrade to versions 2.0.5, 2.1.5, 2.2.2 or above.

Weakness

  • CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection')

Source file

cargo/surrealdb/GHSA-ccj3-5p93-8p42.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 14 May 2025 12:15:08 +0000.