CVE-2025-71392
JSON

9.4critical

SurrealDB before 2.2.2 SurrealQL Injection via export

Severity
9.4critical CVSS:4.0 by VulnCheck
Exploit likelihood
0.30% (higher than 24% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
VulnCheck
Also known as
GHSA-ccj3-5p93-8p42

Description

SurrealDB before 2.0.5, 2.1.x before 2.1.5, and 2.2.x before 2.2.2 fails to properly escape table and field names in the command-line export command. An authenticated System User with OWNER or EDITOR roles can create tables or fields with malicious names containing SurrealQL. When a higher-privileged user subsequently imports the exported backup, the injected SurrealQL executes, enabling privilege escalation and root-level takeover of the SurrealDB instance. Applications that let users define custom tables or fields are also exposed to a universal second-order SurrealQL injection even when query parameters are sanitized.

Affected

Product or packageVersionsReported by
surrealdb surrealdbfrom 2.2.0 before 2.2.2, from 2.1.0 before 2.1.5, before 2.0.5
Not affected: 2.2.2, 2.1.5, 2.0.5
CVE List, NVD
surrealdb (crates.io)from 2.2.0 before 2.2.2, from 2.1.0 before 2.1.5, before 2.0.5GitHub Advisory Database

All scores

VulnCheck9.4critical CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H
GitHubcritical CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H
NVD8.0high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H

Classification

CWE-77

SSVC (CISA-ADP): exploitation none, automatable no, technical impact total.

What each source says

CVE List

SurrealDB before 2.0.5, 2.1.x before 2.1.5, and 2.2.x before 2.2.2 fails to properly escape table and field names in the command-line export command. An authenticated System User with OWNER or EDITOR roles can create tables or fields with malicious names containing SurrealQL. When a higher-privileged user subsequently imports the exported backup, the injected SurrealQL executes, enabling privilege escalation and root-level takeover of the SurrealDB instance. Applications that let users define custom tables or fields are also exposed to a universal second-order SurrealQL injection even when query parameters are sanitized.

GitHub Advisory Database

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 SurrealDB Documentation - Import SurrealDB Documentation - Authentication

NVD (es)

SurrealDB antes de 2.0.5, 2.1.x antes de 2.1.5, y 2.2.x antes de 2.2.2 no logra escapar correctamente los nombres de tablas y campos en el comando de exportación de línea de comandos. Un Usuario del Sistema autenticado con roles de PROPIETARIO o EDITOR puede crear tablas o campos con nombres maliciosos que contienen SurrealQL. Cuando un usuario con mayores privilegios importa posteriormente la copia de seguridad exportada, el SurrealQL inyectado se ejecuta, lo que permite la escalada de privilegios y la toma de control a nivel de root de la instancia de SurrealDB. Las aplicaciones que permiten a los usuarios definir tablas o campos personalizados también están expuestas a una inyección universal de SurrealQL de segundo orden incluso cuando los parámetros de consulta están saneados.

References

Sources

SourceRecordLicence
CVE ListCVE-2025-71392 changed 2026-10-29CVE Terms of Use
GitHub Advisory DatabaseGHSA-ccj3-5p93-8p42 changed 2026-09-04CC-BY-4.0
NVDCVE-2025-71392 changed 2026-10-29Public domain