Advisory Database
  • Advisories
  • Dependency Scanning
  1. cargo
  2. ›
  3. surrealdb-core
  4. ›
  5. GHSA-9722-9j67-vjcr

GHSA-9722-9j67-vjcr: Improper Authorization in Select Permissions

October 8, 2024

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 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.

  • 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.

  • 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.

  • 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.

  • 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.

  • 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.

References

  • github.com/advisories/GHSA-9722-9j67-vjcr
  • github.com/surrealdb/surrealdb
  • github.com/surrealdb/surrealdb/commit/439ab99e15314ec5cf87047bf58246db646e3f8c
  • github.com/surrealdb/surrealdb/commit/c382fa158dc84b329328606f663efe574f102a7d
  • github.com/surrealdb/surrealdb/commit/e75e7736b3a028c4b6a4a4bdf00791d76f77e339
  • github.com/surrealdb/surrealdb/issues/2161
  • github.com/surrealdb/surrealdb/issues/3924
  • github.com/surrealdb/surrealdb/pull/4785
  • github.com/surrealdb/surrealdb/pull/4800
  • github.com/surrealdb/surrealdb/pull/4873
  • github.com/surrealdb/surrealdb/security/advisories/GHSA-9722-9j67-vjcr
  • surrealdb.com/docs/surrealdb/security/summary
  • surrealdb.com/docs/surrealql/statements/define/field
  • surrealdb.com/docs/surrealql/statements/define/table

Code Behaviors & Features

Detect and mitigate GHSA-9722-9j67-vjcr with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 2.0.4

Fixed versions

  • 2.0.4

Solution

Upgrade to version 2.0.4 or above.

Impact 6.5 MEDIUM

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N

Learn more about CVSS

Weakness

  • CWE-285: Improper Authorization

Source file

cargo/surrealdb-core/GHSA-9722-9j67-vjcr.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 14 May 2025 12:16:06 +0000.