CVE-2024-58367 — SurrealDB: Improper Authorization in surrealdb
SurrealDB: Improper Authorization in Select Permissions
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.36%). Schedule for your next planned update.
Does your project use an affected surrealdb version?
Paste your Cargo.lock to check it for CVE-2024-58367 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
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:
-
When performing a
SELECToperation 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 aSELECT VALUEoperation (e.g.SELECT VALUE private FROM data) would result in a non-iterable value, which would not be removed from the returned result. -
When aliasing a field (e.g.
SELECT private AS public FROM data) for which the user did not haveSELECTpermissions within aSELECTquery, 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. -
When calling a function in the context of a
SELECTquery 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 toSELECTpermissions. 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. -
When executing a query containing a
WHEREclause filtering records by a field that the querying user does not have access toSELECT(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. -
When performing
UPDATEorDELETEoperations over a table with a user that had those permissions but noSELECTpermission, theRETURN BEFOREclause 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 performSELECToperations. -
When performing
UPDATEoperations on a table for which the user hadSELECTandUPDATEpermissions, theSETclause could reference fields that the user hadUPDATEbut noSELECTpermission for (e.g.UPDATE data SET public = private) in order to update the value of a field that the user had permission toSELECTto the value of another field for which the user did not.
Impact
Clients 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.
Due 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.
Patches
The 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.
- Version 2.0.4 and later are not affected by this issue.
Workarounds
Users 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.
Advisory Timeline
- First published October 8, 2024 (780 days ago).
- Last revised September 4, 2026 — 696 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
cargo update -p surrealdb --precise 2.0.4
cargo update -p surrealdb-core --precise 2.0.4
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (2)
Affects 1 ecosystem: crates.io (2).
| Package | Fixed In |
|---|---|
| surrealdb crates.io · Affected: All versions | 2.0.4 |
| surrealdb-core crates.io · Affected: All versions | 2.0.4 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-285Improper AuthorizationMITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 6.5 score means for each attack dimension.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
References
- https://github.com/surrealdb/surrealdb/security/advisories/GHSA-9722-9j67-vjcrWEB
- https://nvd.nist.gov/vuln/detail/CVE-2024-58367ADVISORY
- https://github.com/surrealdb/surrealdb/issues/2161WEB
- https://github.com/surrealdb/surrealdb/issues/3924WEB
- https://github.com/surrealdb/surrealdb/pull/4785WEB
- https://github.com/surrealdb/surrealdb/pull/4800WEB
- https://github.com/surrealdb/surrealdb/pull/4873WEB
- https://github.com/surrealdb/surrealdb/commit/439ab99e15314ec5cf87047bf58246db646e3f8cWEB
- https://github.com/surrealdb/surrealdb/commit/c382fa158dc84b329328606f663efe574f102a7dWEB
- https://github.com/surrealdb/surrealdb/commit/e75e7736b3a028c4b6a4a4bdf00791d76f77e339WEB
- https://github.com/surrealdb/surrealdbPACKAGE
- https://surrealdb.com/docs/surrealdb/security/summary#permissionsWEB
- https://surrealdb.com/docs/surrealql/statements/define/field#setting-permissions-on-fieldsWEB
- https://surrealdb.com/docs/surrealql/statements/define/table#defining-permissionsWEB
- https://www.vulncheck.com/advisories/surrealdb-before-improper-authorization-via-select-permissionsWEB
Frequently Asked Questions
- What is CVE-2024-58367?
- SurrealDB: Improper Authorization in Select Permissions. This vulnerability has been assigned a severity rating of HIGH (CVSS score: 6.5/10).
- How do I check if my project is affected by CVE-2024-58367?
- CVE-2024-58367 affects surrealdb and surrealdb-core. It has a 0.4% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2024-58367 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Exploitation requires specific conditions, or the impact is limited.
This is a below-median EPSS score — only 21.8% of tracked vulnerabilities score at or below it, so most tracked vulnerabilities are considered more likely to be exploited than this one.
Also Known As
Related CVEs
- CVE-2026-121417HIGH
Use-after-free in KV backends via leaked `affinitypool::spawn_local` future
- CVE-2026-63763HIGH
SurrealDB Affected by Confused Deputy Privilege Escalation through Future Fields and Functions
- CVE-2024-58362HIGH
Untrusted Query Object Evaluation in RPC API
- CVE-2024-58361HIGH
SurrealDB has an Uncaught Exception Handling Parsing Errors on Empty Strings
- CVE-2024-58363MEDIUM
SurrealDB vulnerable to Improper Authentication when Changing Databases as Scope User
- CVE-2024-58357MEDIUM
SurrealDB has an Uncaught Exception in Function Generating Random Time
- CVE-2024-58359MEDIUM
SurrealDB has an Uncaught Exception Sorting Tables by Random Order
- CVE-2026-63762MEDIUM
SurrealDB vulnerable to Denial of Service through scripting function memory edge case