Skip to content

SurrealDB: Array element-level (field.*) SELECT permissions leak denied elements to record users

Moderate severity GitHub Reviewed Published Jun 10, 2026 in surrealdb/surrealdb

Package

cargo surrealdb (Rust)

Affected versions

<= 3.1.3

Patched versions

3.1.4

Description

A SELECT permission defined on an array element (DEFINE FIELD field.* … PERMISSIONS FOR select …) is not enforced correctly for RECORD users. Instead of hiding the denied elements, the query leaks a subset of them: a deny-all returns the odd-indexed elements, and a per-element predicate keeps and drops the wrong ones.

The filter removed each denied element by index while walking the array forwards. Because removing an element shifts every later index down, each cut invalidated the indices still pending in the loop, leaving denied elements behind. Field-level permissions are enforced correctly; only the element (field.*) level is affected, and only for record users — root and record-owner sessions are not.

Impact

What an attacker can do:

  • As a record (scope) user, read array elements that an element-level (field.*) SELECT permission should hide, on any table they can already SELECT.
  • Recover denied elements through both a deny-all and a WHERE predicate — the wrong elements are selected either way.

What it can't do:

  • Bypass field-level SELECT permissions, which are evaluated correctly.
  • Affect root or record-owner sessions, or cross namespace/database isolation.
  • Modify data, escalate privileges, or affect availability (confidentiality only).

Patches

The three permission-filtering paths (doc/reduce.rs, doc/output.rs, exec/operators/scan/pipeline.rs) now remove denied elements in reverse index order, so removing one element no longer shifts the elements still to be checked. Regression tests reproducing the issue were added.

The fix is included in SurrealDB 3.1.4.

Workarounds

  • Do not rely on element-level (field.*) permissions to hide data from record users; use field-level permissions, which are enforced correctly.
  • Restrict record users from selecting tables whose schema uses element-level permissions.

Resources

References

@rushmorem rushmorem published to surrealdb/surrealdb Jun 10, 2026
Published to the GitHub Advisory Database Aug 14, 2026
Reviewed Aug 14, 2026

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N

EPSS score

Weaknesses

Incorrect Authorization

The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. Learn more on MITRE.

CVE ID

No known CVE

GHSA ID

GHSA-8rw6-p7m8-63jp

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.