CVE-2024-58367
SurrealDB before 2.0.4 Improper Authorization via SELECT Permissions
SurrealDB versions before 2.0.4 fail to properly enforce field permissions during SELECT, UPDATE, and DELETE operations, allowing authorized users to access unauthorized field values through various query techniques. Attackers can exploit SELECT VALUE operations, field aliasing, function arguments, WHERE clause filtering, RETURN BEFORE clauses, and SET clause references to leak protected field contents despite lacking SELECT permissions.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- Low
- User interaction
- None
What an attacker can affect
- Confidentiality
- High
- Integrity
- None
- Availability
- None
Exploit likelihood
What each source reports
CVE List Score used
7.1
SurrealDB before 2.0.4 Improper Authorization via SELECT Permissions
SurrealDB versions before 2.0.4 fail to properly enforce field permissions during SELECT, UPDATE, and DELETE operations, allowing authorized users to access unauthorized field values through various query techniques. Attackers can exploit SELECT VALUE operations, field aliasing, function arguments, WHERE clause filtering, RETURN BEFORE clauses, and SET clause references to leak protected field contents despite lacking SELECT permissions.
- Record
CVE-2024-58367- CVSS 4.0
- 7.1 High
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 - Weakness
- CWE-285
- Updated
- 2026-11-02
EUVDEUVD-2024-55683
7.1
SurrealDB versions before 2.0.4 fail to properly enforce field permissions during SELECT, UPDATE, and DELETE operations, allowing authorized users to access unauthorized field values through various query techniques. Attackers can exploit SELECT VALUE operations, field aliasing, function arguments, WHERE clause filtering, RETURN BEFORE clauses, and SET clause references to leak protected field contents despite lacking SELECT permissions.
- Record
EUVD-2024-55683- CVSS 4.0
- 7.1 High
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 - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-9722-9j67-vjcr
7.1
SurrealDB: Improper Authorization in Select Permissions
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,…
- Record
GHSA-9722-9j67-vjcr- CVSS 4.0
- 7.1 High
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 - CVSS 3.1
- 6.5 Medium
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N - Weakness
- CWE-285
- Updated
- 2026-11-02
GitHub AdvisoriesGHSA-j9rh-f527-3x87
7.1
Duplicate Advisory: Improper Authorization in Select Permissions
Duplicate Advisory
This advisory has been withdrawn because it is a duplicate of GHSA-9722-9j67-vjcr. This link is maintained to preserve external references.
Original Description
SurrealDB versions before 2.0.4 fail to properly enforce field permissions during SELECT, UPDATE, and DELETE operations, allowing authorized users to access unauthorized field values through various query techniques. Attackers can exploit SELECT VALUE operations, field aliasing, function arguments, WHERE clause filtering, RETURN BEFORE clauses, and SET clause references to leak protected field contents despite lacking SELECT permissions.
- Record
GHSA-j9rh-f527-3x87- CVSS 4.0
- 7.1 High
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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X - CVSS 3.1
- 6.5 Medium
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N - Weakness
- CWE-285
- Updated
- 2026-11-02
NVD
7.1
SurrealDB versions before 2.0.4 fail to properly enforce field permissions during SELECT, UPDATE, and DELETE operations, allowing authorized users to access unauthorized field values through various query techniques. Attackers can exploit SELECT VALUE operations, field aliasing, function arguments, WHERE clause filtering, RETURN BEFORE clauses, and SET clause references to leak protected field contents despite lacking SELECT permissions.
- Record
CVE-2024-58367- CVSS 4.0
- 7.1 High
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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X - CVSS 3.1
- 6.5 Medium
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N - Weakness
- CWE-285
- Updated
- 2026-11-02
OSV
7.1
SurrealDB before 2.0.4 Improper Authorization via SELECT Permissions
SurrealDB versions before 2.0.4 fail to properly enforce field permissions during SELECT, UPDATE, and DELETE operations, allowing authorized users to access unauthorized field values through various query techniques. Attackers can exploit SELECT VALUE operations, field aliasing, function arguments, WHERE clause filtering, RETURN BEFORE clauses, and SET clause references to leak protected field contents despite lacking SELECT permissions.
- Record
CVE-2024-58367- CVSS 4.0
- 7.1 High
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 - Weakness
- CWE-285
- Updated
- 2026-11-02
OSVGHSA-9722-9j67-vjcr
7.1
SurrealDB: Improper Authorization in Select Permissions
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,…
- Record
GHSA-9722-9j67-vjcr- CVSS 4.0
- 7.1 High
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 - CVSS 3.1
- 6.5 Medium
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N - Weakness
- CWE-285
- Updated
- 2026-11-02
OSVGHSA-j9rh-f527-3x87
7.1
Duplicate Advisory: Improper Authorization in Select Permissions
Duplicate Advisory
This advisory has been withdrawn because it is a duplicate of GHSA-9722-9j67-vjcr. This link is maintained to preserve external references.
Original Description
SurrealDB versions before 2.0.4 fail to properly enforce field permissions during SELECT, UPDATE, and DELETE operations, allowing authorized users to access unauthorized field values through various query techniques. Attackers can exploit SELECT VALUE operations, field aliasing, function arguments, WHERE clause filtering, RETURN BEFORE clauses, and SET clause references to leak protected field contents despite lacking SELECT permissions.
- Record
GHSA-j9rh-f527-3x87- CVSS 4.0
- 7.1 High
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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X - CVSS 3.1
- 6.5 Medium
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N - Weakness
- CWE-285
- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
surrealdbcrates.io |
before 2.0.4 | 2.0.4 |
surrealdb-corecrates.io |
before 2.0.4 | 2.0.4 |
History
| Recorded | Changed | Sources |
|---|---|---|
| affected | ||
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2024-58367 is a high vulnerability (CVSS 7.1) in Surrealdb, published October 8, 2024. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.36%, the 29th percentile. Fixed in surrealdb 2.0.4.
References
github.com/surrealdb/surrealdb/security/advisories/GHSA-9722-9j67-vjcr
vulncheck.com/advisories/surrealdb-before-improper-authorization-via-select-permissions
github.com/surrealdb/surrealdb/issues/2161
github.com/surrealdb/surrealdb/issues/3924
github.com/surrealdb/surrealdb/pull/4785
github.com/surrealdb/surrealdb/pull/4800
Show 12 moreShow less
github.com/surrealdb/surrealdb/pull/4873
github.com/surrealdb/surrealdb/commit/439ab99e15314ec5cf87047bf58246db646e3f8c
github.com/surrealdb/surrealdb/commit/c382fa158dc84b329328606f663efe574f102a7d
github.com/surrealdb/surrealdb/commit/e75e7736b3a028c4b6a4a4bdf00791d76f77e339
surrealdb.com/docs/surrealdb/security/summary
surrealdb.com/docs/surrealql/statements/define/field
surrealdb.com/docs/surrealql/statements/define/table
nvd.nist.gov/vuln/detail/CVE-2024-58367
github.com/advisories/GHSA-9722-9j67-vjcr
github.com/advisories/GHSA-j9rh-f527-3x87
github.com/CVEProject/cvelistV5/tree/main/cves/2024/58xxx/CVE-2024-58367.json
github.com/surrealdb/surrealdb
Left out here: the rest of 2 source descriptions. The JSON record has them.