{"id":"CVE-2025-71392","aliases":["CVE-2025-71392","GHSA-ccj3-5p93-8p42"],"related":[],"kind":"vulnerability","state":"published","title":"SurrealDB before 2.2.2 SurrealQL Injection via export","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"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)","format":"markdown","source":"ghsa"},{"lang":"es","text":"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.","source":"nvd"}],"published":"2025-04-11T14:07:34.000Z","modified":"2026-10-29T21:17:05.793Z","severity":{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"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","score":9.4,"rating":"CRITICAL"},"severities":[{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"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","score":9.4,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"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","rating":"CRITICAL"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H","score":8,"rating":"HIGH"}],"cwes":["CWE-77"],"affected":[{"ranges":[{"type":"semver","introduced":"2.2.0","fixed":"2.2.2","status":"affected"},{"type":"semver","version":"2.2.2","status":"unaffected"}],"vendor":"surrealdb","product":"surrealdb","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"2.1.0","fixed":"2.1.5","status":"affected"},{"type":"semver","version":"2.1.5","status":"unaffected"}],"vendor":"surrealdb","product":"surrealdb","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","fixed":"2.0.5","status":"affected"},{"type":"semver","version":"2.0.5","status":"unaffected"}],"vendor":"surrealdb","product":"surrealdb","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"2.2.0","status":"affected","fixed":"2.2.2"}],"ecosystem":"crates.io","package":"surrealdb","purl":"pkg:cargo/surrealdb","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"2.1.0","status":"affected","fixed":"2.1.5"}],"ecosystem":"crates.io","package":"surrealdb","purl":"pkg:cargo/surrealdb","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"2.0.5"}],"ecosystem":"crates.io","package":"surrealdb","purl":"pkg:cargo/surrealdb","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"2.0.5"},{"status":"affected","introduced":"2.1.0","fixed":"2.1.5"},{"status":"affected","introduced":"2.2.0","fixed":"2.2.2"}],"vendor":"surrealdb","product":"surrealdb","cpe":"cpe:2.3:a:surrealdb:surrealdb:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/surrealdb/surrealdb/security/advisories/GHSA-ccj3-5p93-8p42","tags":["vendor-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://www.vulncheck.com/advisories/surrealdb-before-surrealql-injection-via-export","tags":["third-party-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-71392","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/surrealdb/surrealdb","tags":["package"],"sources":["ghsa"]}],"credits":["cure53"],"assigner":"VulnCheck","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"total","date":"2026-07-21T02:39:28.967Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-71392","url":"https://www.cve.org/CVERecord?id=CVE-2025-71392","licence":"CVE Terms of Use","modified":"2026-10-29T21:15:20.082Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-ccj3-5p93-8p42","url":"https://github.com/advisories/GHSA-ccj3-5p93-8p42","licence":"CC-BY-4.0","modified":"2026-09-04T19:45:06.333Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-71392","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-71392","licence":"Public domain","modified":"2026-10-29T21:17:05.793Z"}],"updatedAt":"2026-11-25T22:59:12.403Z","epss":{"score":0.00299,"percentile":0.2437,"date":"2026-12-01T12:00:22.000Z"}}