Skip to content
surrealdbGHSA-ccj3-5p93-8p42

SurrealDB server-takeover via SurrealQL injection on backup import

CriticalCVE-2025-71392 · Published Apr 11, 2025 · updated Sep 4, 2026

GitHub advisory

Affected versions

PackageAffectedFixed in
surrealdb
crates.io
>= 2.2.0, < 2.2.22.2.2
>= 2.1.0, < 2.1.52.1.5
< 2.0.52.0.5
Details and references

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)

CVSS 4.0
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
Severity from
GitHub (reviewed advisory)
Weakness
CWE-77
Also known as
CVE-2025-71392

More surrealdb advisories

All
DateAdvisory
Apr 102025SurrealDB has local file read of 2-column TSV files via analyzers
CVE-2025-71394Lowfixed in 2.1.5, 2.2.2
Apr 102025SurrealDB vulnerable to memory exhaustion via nested functions and scripts
CVE-2025-71393Mediumfixed in 2.0.5, 2.1.5, 2.2.2
Apr 102025SurrealDB has uncaught exception in Net module that leads to database crash
CVE-2025-71391Highfixed in 2.0.5, 2.1.5, 2.2.2
Apr 112025SurrealDB memory exhaustion via string::replace using regex
CVE-2025-71395Highfixed in 2.0.5, 2.1.5, 2.2.2
Apr 112025SurrealDB no JavaScript script function default timeout could facilitate DoS
CVE-2025-71396Lowfixed in 2.0.5, 2.1.5, 2.2.2
Apr 112025SurrealDB CPU exhaustion via custom functions result in total DoS
CVE-2025-71397Highfixed in 2.0.5, 2.1.5, 2.2.2

Critical advisories by email

Wednesdays: the week’s critical and high advisories in the AI and data stack, with the fixed versions. Only in weeks that have some.

Double opt-in. Unsubscribe any time.