# GHSA-6wqw-vhfr-9999: SurrealDB: Authenticated subscribers can read records hidden by SELECT permissions via LIVE subscriptions

> Authenticated users can bypass SELECT permissions to read hidden records by shadowing permission variables in LIVE subscriptions.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 1 Jul 2026

## What is GHSA-6wqw-vhfr-9999?

GHSA-6wqw-vhfr-9999 is a missing authorization vulnerability in surrealdb, published on 1 Jul 2026. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

A record user could read records the table's SELECT permission expression should have hidden, when that expression referenced `$value`, `$before`, `$after`, or `$event`. Binding a chosen value to that name before registering a `LIVE SELECT` caused notifications to evaluate the permission against the attacker's input instead of the real document.

### Impact

A record user binds a value to `$value`, `$before`, `$after`, or `$event` (e.g. `LET $value = [$auth.id]`) and registers `LIVE SELECT * FROM person`. The captured value shadows the real document at notification time, so a SELECT permission like `WHERE $auth.id.id() IN $value` passes for every record on the table — the subscriber receives notifications for records they should not see.

Read-only impact, bounded to one table. Permission expressions that reference only field names, `$auth`, or `$session` are unaffected.

### Patches

A patch has been introduced that re-orders the LIVE notification parameter binding so captured user variables are added first and the trusted document-context and session parameters are added last.

- Versions 3.1.0 and later are not affected by this issue.

### Workarounds

Affected users who are unable to update should avoid table-`PERMISSIONS` and LIVE `WHERE` expressions that read user-named variables (`$value`, `$before`, `$after`, `$event`) without also gating on a system-derived field such as the record id.

## Which versions are affected by GHSA-6wqw-vhfr-9999?

2 open source packages ship an affected version, including surrealdb.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `surrealdb` | crates.io | All versions | 3.1.0 |
| `surrealdb` | crates.io | All versions | 3.1.0 |

## How do I fix GHSA-6wqw-vhfr-9999?

Upgrade surrealdb to 3.1.0 or later.

## Is GHSA-6wqw-vhfr-9999 being exploited?

There is no known exploitation of GHSA-6wqw-vhfr-9999 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-6wqw-vhfr-9999 and fix it if it is affected.

What it is: GHSA-6wqw-vhfr-9999 is a missing authorization vulnerability in surrealdb, published on 1 Jul 2026. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-6wqw-vhfr-9999 in the wild and no public exploit code.

Affected packages and fixed versions:
- surrealdb (crates.io): affected all versions; fixed in 3.1.0
- surrealdb (crates.io): affected all versions; fixed in 3.1.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-6wqw-vhfr-9999/ (Markdown: https://insights.sbomify.com/GHSA-6wqw-vhfr-9999/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-6wqw-vhfr-9999

---
From sbomify Insights: https://insights.sbomify.com/GHSA-6wqw-vhfr-9999/
Summaries are generated and may contain mistakes; the official description above is the record.
