# SurrealDB permissions bypass via PERMISSIONS clause

Source: https://junglewise.ai/threats/surrealdb-permissions-bypass-via-permissions-clause-3674ec45  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-07-20. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

Severity: medium · CVSS 4.3 · Published 2026-07-20

SurrealDB is a multi-model database platform used for data storage and management. A permissions bypass flaw in versions before 3.2.0 allows authenticated users with limited access to write to tables they shouldn't have permission to access by embedding data-modifying statements in PERMISSIONS clauses. An attacker could corrupt data across multiple records in a single operation, bypassing table-level access controls.

Technologies: [surrealdb (crates.io)](https://junglewise.ai/threats/technologies/surrealdb). Vendors: [crates.io](https://junglewise.ai/threats/vendors/crates-io).

## Quick answers

**Is This vulnerability exploited in the wild?** No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.

**How severe is This vulnerability?** Medium severity, with a CVSS score of 4.3, published 20 July 2026.

**Which products and versions are affected?** surrealdb (crates.io) < 3.2.0.

**Is there a fix for This vulnerability?** A patch was published on 2026-07-20: Version 3.2.0 released Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is This vulnerability attacked?** It is attacked over the network.

**Am I affected?** Check whether you run surrealdb (crates.io) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

The vulnerability exists in SurrealDB's permission evaluation mechanism (CWE-863: Incorrect Authorization). PERMISSIONS clauses are evaluated with enforcement disabled to prevent recursion into permission checks, but this also allows data-modifying SQL statements (CREATE, UPDATE, DELETE, RELATE, INSERT, UPSERT) embedded in the clause to execute without permission validation. An authenticated attacker with permission to trigger a guarded operation can exploit this by crafting a malicious permission clause that performs unauthorized writes to restricted tables. Since the clause evaluates once per matched record, a single statement can trigger multiple unauthorized writes. The fix (released in version 3.2.0) enforces read-only permission clauses by rejecting any writes in their definitions and blocking all write attempts during clause evaluation, including through called functions.

## Affected products

- SurrealDB SurrealDB < 3.2.0

## Timeline

- 2026-07-02: disclosed
- 2026-07-20: patched: Version 3.2.0 released

## References

- [https://github.com/surrealdb/surrealdb/security/advisories/GHSA-66r2-5gwj-gxm2](https://github.com/surrealdb/surrealdb/security/advisories/GHSA-66r2-5gwj-gxm2)
- [https://www.vulncheck.com/advisories/surrealdb-before-permissions-bypass-via-permissions-clause](https://www.vulncheck.com/advisories/surrealdb-before-permissions-bypass-via-permissions-clause)

## Related threats

- [SurrealDB use-after-free in KV backends via affinitypool spawn_local](https://junglewise.ai/threats/cve-2026-121417-surrealdb-before-3-3-0-contains-a-use-after-free-vulnerability)
- [SurrealDB JSON parser denial of service via uncontrolled recursion](https://junglewise.ai/threats/surrealdb-json-parser-denial-of-service-via-uncontrolled-recursion-3037f8a0)
- [SurrealDB ES512 algorithm silently downgraded to ES384](https://junglewise.ai/threats/surrealdb-es512-algorithm-silently-downgraded-to-es384-f0af29b8)
- [SurrealDB permission bypass via WHERE clause evaluation](https://junglewise.ai/threats/surrealdb-permission-bypass-via-where-clause-evaluation-afa6f001)
- [SurrealDB authorization bypass in KILL statement](https://junglewise.ai/threats/surrealdb-authorization-bypass-in-kill-statement-fc230d0f)
