Skip to content

GHSA-66r2-5gwj-gxm2 CVE-2026-63733

SurrealDB: Writes in a PERMISSIONS clause bypass table permissions

Medium crates.io
Severity
5.3 / 10
Medium · CVSS 4.0
Exploit chance (EPSS)
0.29%
Chance of exploitation in the next 30 days. Higher than 21.33% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-863 Incorrect Authorization
Fix
3.2.0
Upgrade surrealdb-core to this version or later

Description

A PERMISSIONS ... WHERE clause is evaluated with permission enforcement disabled, so it can't recurse into its own checks. But the clause could also contain data-modifying statements, and these ran with enforcement still off — so evaluating a permission check could write to tables the caller cannot write.

For example:

DEFINE TABLE post PERMISSIONS FOR update
    WHERE (CREATE log SET at = time::now()) OR true;

Any user allowed to update a post now also creates a log record, even with no permission on log. The clause is evaluated once per matched record, so one statement can cause several writes.

Impact

Only databases with a PERMISSIONS clause that contains a write are affected; FULL, NONE, and read-only clauses are not.

What an attacker can do:

  • With permission to perform the guarded operation (a low-privileged or record user is enough), write to tables in their own database that their permissions would otherwise forbid, by triggering an operation the clause guards.
  • Cause several writes from a single statement — the clause is evaluated once per matched record.
  • Trigger unintended events, cascades, or data corruption on those tables.

What it can't do:

  • Escape the caller's own namespace and database — a permission clause cannot switch namespace or database.
  • Perform root- or namespace-level actions such as creating users; the caller's role still applies.
  • Read hidden data — this is an integrity issue, not disclosure.

Patches

Permission clauses must now be read-only: defining or importing one that contains a write is rejected, and any write attempted while a clause is evaluated is blocked at runtime, including writes reached through a called function. Read-only clauses are unaffected.

  • Versions 3.2.0 and later are not affected by this issue.

Workarounds

Users unable to patch should consider the following workarounds:

  • Review your PERMISSIONS clauses and remove any containing CREATE, UPDATE, DELETE, RELATE, INSERT, or UPSERT.
  • Limit who can define schema and vet imported data — such a clause must be defined before it can be triggered.

Resources

Acknowledgements

Thank you to sondt99 for reporting this issue.

Affected versions

crates.io

PackageVulnerableFixed in
surrealdb-core
< 3.2.0
3.2.0

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

surrealdb-core crates.io → 3.2.0

cargo
cargo update -p surrealdb-core --precise 3.2.0

Severity breakdown

CVSS 4.0 5.3

CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:L/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

Attack vector
Network
Attack complexity
Low
Attack requirements
None
Privileges required
Low
User interaction
None
Confidentiality (vulnerable system)
None
Integrity (vulnerable system)
Low
Availability (vulnerable system)
None
Confidentiality (subsequent systems)
None
Integrity (subsequent systems)
None
Availability (subsequent systems)
None
Exploit maturity
Not defined
Scope
X

CVSS 3.1 4.3

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

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

Weakness

CWE-863: 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.

How to prevent it
  • Architecture and Design: Divide the product into anonymous, normal, privileged, and administrative areas. Reduce the attack surface by carefully mapping roles with data and functionality. Use role-based access control (RBAC) [REF-229] to enforce the roles at the appropriate boundaries. Note that this approach may not protect against horizontal authorization, i.e., it will not protect a user from attacking others with the same role.
  • Architecture and Design: Ensure that access control checks are performed related to the business logic. These checks may be different than the access control checks that are applied to more generic resources such as files, connections, processes, memory, and database records. For example, a database may restrict access for medical records to a specific database user, but each record might only be intended to be accessible to the patient and the patient's doctor [REF-7].
  • Architecture and Design: Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid. For example, consider using authorization frameworks such as the JAAS Authorization Framework [REF-233] and the OWASP ESAPI Access Control feature [REF-45].
  • Architecture and Design: For web applications, make sure that the access control mechanism is enforced correctly at the server side on every page. Users should not be able to access any unauthorized functionality or information by simply requesting direct access to that page. One way to do this is to ensure that all pages containing sensitive information are not cached, and that all such pages restrict access to requests that are accompanied by an active and authenticated session token associated with a user who has the required permissions to access that page.
  • System Configuration, Installation: Use the access control capabilities of your operating system and server environment and define your access control lists accordingly. Use a "default deny" policy when defining these ACLs.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-27vq-hv74-7cqp
SurrealDB has Silent Failure to Overwrite Table Definition of Relation Type
Medium Also affects surrealdb-core
GHSA-m52v-24p8-654f
SurrealDB has an Uncaught Exception Sorting Tables by Random Order
High Also affects surrealdb-core
GHSA-jc55-246c-r88f
SurrealDB has an Uncaught Exception Handling Nonexistent Role
Medium Also affects surrealdb-core
GHSA-h4f5-h82v-5w4r
SurrealDB has an Uncaught Exception in Function Generating Random Time
High Also affects surrealdb-core
GHSA-9722-9j67-vjcr
SurrealDB: Improper Authorization in Select Permissions
Medium Also affects surrealdb-core
GHSA-qjrv-v6qp-x99x
SurrealDB has an Uncaught Exception Handling Parsing Errors on Empty Strings
Medium Also affects surrealdb-core
GHSA-64f8-pjgr-9wmr
Untrusted Query Object Evaluation in RPC API
High Also affects surrealdb-core
GHSA-gh9f-6xm2-c4j2
SurrealDB vulnerable to Improper Authentication when Changing Databases as Scope User
Medium Also affects surrealdb-core
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor