Summary
SurrealDB: Array element-level (field.*) SELECT permissions leak denied elements to record users
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.
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
- DEFINE FIELD
- USERS
- DEFINE TABLE … PERMISSIONS
fix(sec): stop array element-level SELECT permissions leaking elements(commit8f89b260b)
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
WHEREpredicate, 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).
The application does not correctly enforce access controls, allowing a principal to access resources or operations beyond their granted permissions. Typical impact: unauthorized data access or execution of privileged operations.
GHSA-8RW6-P7M8-63JP has a CVSS score of 6.5 (Medium). The vector is network-reachable, low privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (3.1.4); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
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.
Frequently Asked Questions
- What is GHSA-8RW6-P7M8-63JP? GHSA-8RW6-P7M8-63JP is a medium-severity incorrect authorization vulnerability in surrealdb (rust), affecting versions <= 3.1.3. It is fixed in 3.1.4. The application does not correctly enforce access controls, allowing a principal to access resources or operations beyond their granted permissions.
- How severe is GHSA-8RW6-P7M8-63JP? GHSA-8RW6-P7M8-63JP has a CVSS score of 6.5 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of surrealdb are affected by GHSA-8RW6-P7M8-63JP? surrealdb (rust) versions <= 3.1.3 is affected.
- Is there a fix for GHSA-8RW6-P7M8-63JP? Yes. GHSA-8RW6-P7M8-63JP is fixed in 3.1.4. Upgrade to this version or later.
- Is GHSA-8RW6-P7M8-63JP exploitable, and should I be worried? Whether GHSA-8RW6-P7M8-63JP is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether GHSA-8RW6-P7M8-63JP is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix GHSA-8RW6-P7M8-63JP? Upgrade
surrealdbto 3.1.4 or later.