GHSA-ccj3-5p93-8p42:
SurrealDB server-takeover via SurrealQL injection on backup import
N/A
CVSS Score
Basic Information
CVE ID
-
GHSA ID
EPSS Score
-
CWE
Published
4/11/2025
Updated
4/11/2025
KEV Status
No
Technology
Rust
Technical Details
CVSS Vector
-
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
surrealdb | rust | >= 2.2.0, < 2.2.2 | 2.2.2 |
surrealdb | rust | >= 2.1.0, < 2.1.5 | 2.1.5 |
surrealdb | rust | < 2.0.5 | 2.0.5 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability occurs because table and field names, and potentially other string-like identifiers, were not properly sanitized during the export
operation. This allowed SurrealQL to be injected into the export file, which would then be executed upon import
. The analysis of the patch commit b86f6ac5cdb4831c0ee1ed9004293c860c4a7337
reveals two main areas of concern:
- The primary
Transaction::export
function incrates/core/src/kvs/export.rs
was modified to specifically handle escaping of names within comments (usingInlineCommentDisplay
), indicating this was a previous weakness. - Numerous
Display::fmt
implementations for SQL types (likeIdent
,Table
,Id
,Strand
,Object
keys) incrates/core/src/sql/
were changed to use new, more robust escaping mechanisms (e.g.,EscapeIdent
,QuoteStr
,EscapeKey
) instead of older, flawed functions (e.g.,escape_ident
,quote_str
,escape_key
). Thesefmt
functions are responsible for converting the raw names/values into their string representations for the export. If these representations were not correctly escaped, they formed the basis of the injection. The identified functions are those that either directly constructed the vulnerable export output or were responsible for the faulty string serialization of elements used in that output.