GHSA-64f8-pjgr-9wmr: Surrealdb Untrusted Query Object Evaluation Vulnerability
HIGHGHSA-64f8-pjgr-9wmr is a HIGH (CVSS 8.8) untrusted query object evaluation vulnerability (CWE-75: Failure to Sanitize Special Elements into a Different Plane (Special Element Injection)) affecting Surrealdb libraries in the crates.io ecosystem. The issue involves untrusted query object evaluation in rpc api. Remediation is available by upgrading affected packages to version 1.5.5, 1.5.2, 2.0.0-beta.3.
GHSA-64f8-pjgr-9wmr at a Glance
Security Impact
CVSS: 8.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).
How to Fix GHSA-64f8-pjgr-9wmr
To remediate this vulnerability, upgrade all affected Surrealdb dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade surrealdb to 1.5.5
Upgrade surrealdb-core to 1.5.2
Upgrade surrealdb to 2.0.0-beta.3
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for surrealdb
How to Check if You Are Affected
To determine whether your application is affected by GHSA-64f8-pjgr-9wmr, inspect your project dependencies for Surrealdb:
inspect dependencies for surrealdb
Analyze the terminal output to locate any version of Surrealdb in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.5.5), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-75: Failure to Sanitize Special Elements into a Different Plane (Special Element Injection), where the product does not adequately filter user-controlled input for special elements with control implications. In Surrealdb, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-64f8-pjgr-9wmr Affected Surrealdb Versions
3 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
surrealdb
|
crates.io |
< 1.5.5
|
1.5.5
|
|
surrealdb-core
|
crates.io |
< 1.5.2
|
1.5.2
|
|
surrealdb
|
crates.io |
≥ 2.0.0-beta.1
< 2.0.0-beta.3
|
2.0.0-beta.3
|
References
Frequently Asked Questions
What is GHSA-64f8-pjgr-9wmr?
Which Surrealdb versions are affected?
What version fixes GHSA-64f8-pjgr-9wmr?
Is surrealdb affected?
Is surrealdb-core affected?
What is the CVSS score of GHSA-64f8-pjgr-9wmr?
What CWE is associated with GHSA-64f8-pjgr-9wmr?
How can I check crates.io dependencies for GHSA-64f8-pjgr-9wmr?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-64f8-pjgr-9wmr",
"modified" : "2024-09-11T19:20:08Z",
"published" : "2024-09-11T19:20:07Z",
"aliases" : [ ],
"summary" : "Untrusted Query Object Evaluation in RPC API",
"details" : "During the sign in and sign up operations through the SurrealDB RPC API, an arbitrary object would be accepted in order to support a wide array of types and structures that could contain user credentials. This arbitrary object could potentially contain any SurrealDB value, including an object representing a subquery. For this to materialize, this object would need to be encoded using the bincode serialization format instead of the default JSON serialization format or the additionally supported CBOR serialization format.\n\nIf a binary object containing a subquery were to be provided in this way, that subquery would be computed while executing the `SIGNIN` and `SIGNUP` queries defined by the database owner while defining a record access method. Since those queries are executed under a system user session with the editor role, an unauthenticated attacker may be able to leverage this behavior to select, create, update and delete non-IAM resources with permissions of a system user with the editor role.\n\n### Impact\n\nIf a record access method was defined with a `SIGNIN` or a `SIGNUP` query and the SurrealDB RPC API was exposed to untrusted users, an attacker could be able to craft a binary object containing a subquery to provide in place of valid credentials when calling the `signin` and `signup` operations via the RPC API with the bincode serialization format. The attacker could use that subquery to select, create, update and delete resources in SurrealDB, but they would not be able to _directly_ view the results of the query. This method cannot be used to create, update or delete IAM resources, as access to those kind of resources requires the owner role.\n\n### Patches\n\nObjects provided as variables to the sign in and sign up methods are now recursively validated to ensure that they do not contain any non-computed values, which include subqueries and other data types that could potentially result in query execution.\n\n- Version 1.5.5 and later are not affected by this issue.\n- Version 2.0.0-beta.3 and later are not affected by this issue.\n\n### Workarounds\n\nUsers unable to update may want to disallow access to the SurrealDB RPC API using the affected binary serialization formats by conservatively allowing only requests to the `/rpc` endpoint of the SurrealDB HTTP server with the `application/json` content type. If the RPC API is not used at all or only used by trusted clients, disallowing or restricting access to the `/rpc` endpoint of the SurrealDB HTTP server will also prevent exploitation. Alternatively, if filtering HTTP requests is not possible, record access methods that define `SIGNIN` and `SIGNUP` clauses may be temporarily removed to completely prevent potential attacks leveraging this issue.\n\n### References\n\n- [SurrealDB Documentation - Authentication (Record Users)](https://surrealdb.com/docs/surrealdb/security/authentication#record-users)\n- [SurrealDB Documentation - RPC Protocol (Signup)](https://surrealdb.com/docs/surrealdb/integration/rpc#signup)\n- [SurrealDB Documentation - RPC Protocol (Signin)](https://surrealdb.com/docs/surrealdb/integration/rpc#signin)",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "crates.io",
"name" : "surrealdb"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.5.5"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "surrealdb-core"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.5.2"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "surrealdb"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.0.0-beta.1"
}, {
"fixed" : "2.0.0-beta.3"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/surrealdb/surrealdb/security/advisories/GHSA-64f8-pjgr-9wmr"
}, {
"type" : "WEB",
"url" : "https://github.com/surrealdb/surrealdb/commit/b7583a653a2c495a60630dffd663f506426db330"
}, {
"type" : "WEB",
"url" : "https://github.com/surrealdb/surrealdb/commit/eab7ef5354168d4039f7f7b77042c99a52f770a6"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/surrealdb/surrealdb"
}, {
"type" : "WEB",
"url" : "https://surrealdb.com/docs/surrealdb/integration/rpc#signin"
}, {
"type" : "WEB",
"url" : "https://surrealdb.com/docs/surrealdb/integration/rpc#signup"
}, {
"type" : "WEB",
"url" : "https://surrealdb.com/docs/surrealdb/security/authentication#record-users"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-75" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-09-11T19:20:07Z",
"nvd_published_at" : null
}
}