All vulnerabilities
GHSA-3vw5-j55x-486h

surrealdb: Record users can read another tenant's records through RETURN … FETCH

surrealdb
CVSS
6.5Medium
ExploitationNo known exploitationNot in CISA KEV, which does not prove it is unexploitedCISA KEV
Exploit odds (EPSS)No scoreNo FIRST EPSS score in this snapshot yet
Fixed in3.3.0Fixed versionGitHub
Published28 Sep 2026Updated 28 Sep 2026GitHub

What fixes it

A fixed version on one release line is not the upgrade target for every line. Check your exact version and any vendor backports.

Description

A record user scoped to one namespace/database could read a record in another namespace/database on the same instance by naming it in a RETURN … FETCH.

A record user could select a foreign namespace/database, but ordinary table scans then refused them, because those scans checked a record user's scope. Resolving a record id through FETCH did not apply that check. So a record user who knew the id of a record in another tenant could read it:

USE NS ns_b DB db_b;
RETURN { one: post:secret } FETCH one;  -- returns post:secret from ns_b/db_b

Table-level and field-level PERMISSIONS on the fetched record were still applied, so a record in a PERMISSIONS FULL table was returned in full.

The same root cause was reported through several paths, each published as its own advisory and all fixed in 3.3.0:

Impact

What an attacker can do:

  • As a record user of one tenant, read a record in another tenant on the same instance, given its record id. This works when the record's table and field PERMISSIONS allow it to be read, such as PERMISSIONS FULL.

What it can't do:

  • Discover record ids. FETCH resolves an id the caller names; it does not scan or list the foreign table.
  • Reach any tenant without valid credentials for some namespace/database on the instance. This is not an unauthenticated bypass.
  • Read or write a table whose relevant PERMISSIONS clause denies the operation, including PERMISSIONS NONE (the DEFINE TABLE default).
  • Pass IAM-gated operations such as INFO FOR DB, or change roles.
  • Affect single-tenant deployments, or callers that already hold instance-wide (root) scope.

Patches

A request can no longer select a namespace/database outside the caller's authenticated level. The check applies to the USE statement, the RPC use method, and HTTP sessions built from the Surreal-NS / Surreal-DB headers. Root can select any namespace/database, and a namespace user any database in their namespace. Database and record users can select only their own namespace/database. Anonymous callers remain governed by table PERMISSIONS.

The query-time scope checks now apply to every scoped principal, not only record users. They also cover record fetches and the document write pipeline, so a read or write in a foreign tenant is refused however the session reached it.

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

Workarounds

Users unable to patch should consider the following workarounds:

  • On shared instances, use separate deployments, not namespace/database boundaries, to isolate tenants. Until you upgrade, issue namespace-, database-, and record-level credentials only to parties trusted with every tenant on the instance.
  • Prefer a PERMISSIONS WHERE clause that checks the caller's identity, such as $auth or a token claim, over PERMISSIONS FULL. This reduces exposure but does not restore the boundary.

References

Acknowledgements

Thank you to rexpository for reporting this issue.

Text from GitHub Advisory Database

Affected versions 1

  • surrealdb, rust>= 3.0.0, < 3.3.0GitHub