CVE-2024-58367: SurrealDB Improper Authorization Vulnerability
HIGHCVE-2024-58367 is a HIGH (CVSS 6.5) improper authorization vulnerability (CWE-285: Improper Authorization) affecting SurrealDB libraries in the crates.io ecosystem. The issue involves improper authorization in select permissions. Remediation is available by upgrading affected packages to version 2.0.4.
CVE-2024-58367 at a Glance
Security Impact
CVSS: 6.5
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:N/A:N).
How to Fix CVE-2024-58367
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 2.0.4
Upgrade surrealdb-core to 2.0.4
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 CVE-2024-58367, 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 2.0.4), 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-285: Improper Authorization, where the product does not perform or incorrectly performs an authorization check when an actor attempts to access a resource or perform an action. 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
CVE-2024-58367 Affected SurrealDB Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
surrealdb
|
crates.io |
< 2.0.4
|
2.0.4
|
|
surrealdb-core
|
crates.io |
< 2.0.4
|
2.0.4
|
References
Frequently Asked Questions
What is CVE-2024-58367?
Which SurrealDB versions are affected?
What version fixes CVE-2024-58367?
Is surrealdb affected?
Is surrealdb-core affected?
What is the CVSS score of CVE-2024-58367?
What CWE is associated with CVE-2024-58367?
How can I check crates.io dependencies for CVE-2024-58367?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-9722-9j67-vjcr",
"modified" : "2026-09-04T19:38:36Z",
"published" : "2024-10-08T22:21:09Z",
"aliases" : [ "CVE-2024-58367" ],
"summary" : "SurrealDB: Improper Authorization in Select Permissions",
"details" : "Due to the order in which permissions were processed, some statements, filters and computations could lead to leaking field values or record contents to users without the required permissions. This behavior could be triggered in different scenarios:\n\n- When performing a `SELECT` operation on a table, the values that would be returned were iterated over, field permissions would be validated and any unauthorized value would be removed from the result returned. However, performing a `SELECT VALUE` operation (e.g. `SELECT VALUE private FROM data`) would result in a non-iterable value, which would not be removed from the returned result.\n\n- When aliasing a field (e.g. `SELECT private AS public FROM data`) for which the user did not have `SELECT` permissions within a `SELECT` query, permissions would be checked against the field of the resulting document containing the aliased field instead of the original document containing the original field. As a consequence, the original field value would be returned as the returned field would not match the original field where permissions had been defined.\n\n- When calling a function in the context of a `SELECT` query and passing a field with permissions as an argument to the function (e.g. `SELECT string::lowercase(private) FROM data`), the function would receive the field value before it had been removed from the document due to `SELECT` permissions. As a result, the function would have access to the value of the field regardless of field permissions. This case includes functions called from within events and other clauses that support function calling.\n\n- When executing a query containing a `WHERE` clause filtering records by a field that the querying user does not have access to `SELECT` (e.g. `SELECT public FROM data WHERE private ~ \"secret\"`), the response of that query would still take the value of the field into account. Even though the value of the protected field would not be returned, this behavior could be used as a side channel by the querying user to infer information about the value of the field.\n\n- When performing `UPDATE` or `DELETE` operations over a table with a user that had those permissions but no `SELECT` permission, the `RETURN BEFORE` clause could be used (e.g. `DELETE data RETURN BEFORE`) to read the contents of the records prior to the authorized update or the deletion despite the querying user not being authorized to perform `SELECT` operations.\n\n- When performing `UPDATE` operations on a table for which the user had `SELECT` and `UPDATE` permissions, the `SET` clause could reference fields that the user had `UPDATE` but no `SELECT` permission for (e.g. `UPDATE data SET public = private`) in order to update the value of a field that the user had permission to `SELECT` to the value of another field for which the user did not.\n\n### Impact\n\nClients that were authorized by table permissions to execute `SELECT` statements for a table but were not authorized by field permissions to run `SELECT` queries for a specific field could still have been able to gain knowledge of the value of that field. Additionally, clients that were authorized to execute `UPDATE` or `DELETE` statements for a table but not authorized to execute `SELECT` statements for the same table may have been able to gain knowledge of the contents of records in that table. This could only be exploited by users who were already authorized to execute queries on the database with the affected table or field.\n\nDue to its relationship with table and field permissions, which apply mainly to record users rather than system users, this issue mostly affects users relying on SurrealDB as a backend-as-a-service rather than SurrealDB as a traditional database backend.\n\n### Patches\n\nThe behavior when evaluating table or field permissions and filtering records or fields as a result of those evaluations has been improved to consider permissions before any changes to the document have been made and, when relevant, permissions after changes to the document have taken place. When a user is unauthorized to view record contents and field values by permissions, the returned documents will behave as if the record or field did not exist in order to prevent leaking any information.\n\n- Version 2.0.4 and later are not affected by this issue.\n\n### Workarounds\n\nUsers affected by this issue and unable to update should not rely on the authorization provided by field permissions when it comes to the `SELECT` permission. Instead, read access to fields in affected versions should be restricted at the table level. When allowing the `UPDATE` or `DELETE` operations for records via table permissions, users should not rely of the authorization provided by the `SELECT` permission. Instead, users should not allow clients to `UPDATE` or `DELETE` records that they should not be able to view.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "crates.io",
"name" : "surrealdb"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.0.4"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "surrealdb-core"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.0.4"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/surrealdb/surrealdb/security/advisories/GHSA-9722-9j67-vjcr"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-58367"
}, {
"type" : "WEB",
"url" : "https://github.com/surrealdb/surrealdb/issues/2161"
}, {
"type" : "WEB",
"url" : "https://github.com/surrealdb/surrealdb/issues/3924"
}, {
"type" : "WEB",
"url" : "https://github.com/surrealdb/surrealdb/pull/4785"
}, {
"type" : "WEB",
"url" : "https://github.com/surrealdb/surrealdb/pull/4800"
}, {
"type" : "WEB",
"url" : "https://github.com/surrealdb/surrealdb/pull/4873"
}, {
"type" : "WEB",
"url" : "https://github.com/surrealdb/surrealdb/commit/439ab99e15314ec5cf87047bf58246db646e3f8c"
}, {
"type" : "WEB",
"url" : "https://github.com/surrealdb/surrealdb/commit/c382fa158dc84b329328606f663efe574f102a7d"
}, {
"type" : "WEB",
"url" : "https://github.com/surrealdb/surrealdb/commit/e75e7736b3a028c4b6a4a4bdf00791d76f77e339"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/surrealdb/surrealdb"
}, {
"type" : "WEB",
"url" : "https://surrealdb.com/docs/surrealdb/security/summary#permissions"
}, {
"type" : "WEB",
"url" : "https://surrealdb.com/docs/surrealql/statements/define/field#setting-permissions-on-fields"
}, {
"type" : "WEB",
"url" : "https://surrealdb.com/docs/surrealql/statements/define/table#defining-permissions"
}, {
"type" : "WEB",
"url" : "https://www.vulncheck.com/advisories/surrealdb-before-improper-authorization-via-select-permissions"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-285" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-10-08T22:21:09Z",
"nvd_published_at" : null
}
}