/

CVE-2026-109343

Severity:

HIGH RISK

(8.1)

Cross-Tenant Access (CWE-639) in SurrealDB USE Statement

CVE-2026-109343

Deferred

Vulnerability type

Category:

Authorization Bypass

CWE:

CWE-639

Impact:

Cross-Tenant Data Access and Modification

Severity:

HIGH RISK

(8.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

SurrealDB allows an authenticated namespace, database, or record user to switch a session to another namespace or database without verifying that the user's authorization scope covers the target. If the target tables permit the requested operation, this may allow cross-tenant reading, creation, updating, or deletion of records.

SurrealDB allows an authenticated namespace, database, or record user to switch a session to another namespace or database without verifying that the user's authorization scope covers the target. If the target tables permit the requested operation, this may allow cross-tenant reading, creation, updating, or deletion of records.

Affected context

The issue occurs in SurrealDB deployments where tenant isolation relies on authenticated-level restrictions while the SurrealQL USE statement changes the active namespace or database. Risk is higher when tables expose broad permissions, such as PERMISSIONS FULL, and when users can submit or execute USE statements within an authenticated session.

The issue occurs in SurrealDB deployments where tenant isolation relies on authenticated-level restrictions while the SurrealQL USE statement changes the active namespace or database. Risk is higher when tables expose broad permissions, such as PERMISSIONS FULL, and when users can submit or execute USE statements within an authenticated session.

Exploit preconditions

  • Attack surface: SurrealQL session or query interface that accepts USE statements
  • Required access: An authenticated namespace, database, or record user account
  • Trigger point: Switching the session to a namespace or database outside the caller's authorized scope
  • Why exploitation is possible: The session transition does not adequately verify that the authenticated level covers the requested target, while target-table permissions may authorize subsequent operations
  • Attack surface: SurrealQL session or query interface that accepts USE statements
  • Required access: An authenticated namespace, database, or record user account
  • Trigger point: Switching the session to a namespace or database outside the caller's authorized scope
  • Why exploitation is possible: The session transition does not adequately verify that the authenticated level covers the requested target, while target-table permissions may authorize subsequent operations

Why this happens

The underlying flaw is an authorization boundary failure in session context switching. The USE statement changes the active namespace or database without enforcing an authorization check that binds the requested context to the caller's authenticated scope. This maps to CWE-639, Authorization Bypass Through User-Controlled Key, because attacker-controlled tenant or database selection can influence which protected records and operations become available.

The underlying flaw is an authorization boundary failure in session context switching. The USE statement changes the active namespace or database without enforcing an authorization check that binds the requested context to the caller's authenticated scope. This maps to CWE-639, Authorization Bypass Through User-Controlled Key, because attacker-controlled tenant or database selection can influence which protected records and operations become available.

Potential impact

  • An attacker may read data belonging to another tenant.
  • An attacker could create or modify records in another namespace or database.
  • An attacker may delete or corrupt records where table permissions allow it.
  • Cross-tenant access could undermine confidentiality, integrity, and tenant isolation.
  • An attacker may read data belonging to another tenant.
  • An attacker could create or modify records in another namespace or database.
  • An attacker may delete or corrupt records where table permissions allow it.
  • Cross-tenant access could undermine confidentiality, integrity, and tenant isolation.

General mitigation guidance

Mitigation generally focuses on enforcing authorization at every namespace,

database, and record context transition rather than trusting the requested

USE target.

Common defensive patterns include:

  • Binding session context changes to the authenticated user's authorized scope.
  • Applying deny-by-default permissions and narrowly defining allowed operations.
  • Enforcing tenant authorization again at table and record access boundaries.
  • Reducing reliance on user-controlled namespace or database identifiers.
  • Using separate credentials, roles, or database boundaries where stronger tenant isolation is required.
  • Auditing cross-tenant access attempts and applying least privilege to service accounts.

Mitigation generally focuses on enforcing authorization at every namespace,

database, and record context transition rather than trusting the requested

USE target.

Common defensive patterns include:

  • Binding session context changes to the authenticated user's authorized scope.
  • Applying deny-by-default permissions and narrowly defining allowed operations.
  • Enforcing tenant authorization again at table and record access boundaries.
  • Reducing reliance on user-controlled namespace or database identifiers.
  • Using separate credentials, roles, or database boundaries where stronger tenant isolation is required.
  • Auditing cross-tenant access attempts and applying least privilege to service accounts.

How teams detect issues like this

Organizations can look for this class of issue through:

  • Static and semantic analysis of session-context switching code for missing authorization checks.
  • Code review signals involving user-controlled namespace, database, tenant, or record identifiers.
  • Tests that attempt authorized and unauthorized USE transitions across tenant boundaries.
  • Policy enforcement requiring deny-by-default table and record permissions.
  • Audit monitoring for unusual cross-tenant context changes or access patterns.

Automated security review tools may help identify missing authorization checks, but

deployment-specific permission tests remain important.

Organizations can look for this class of issue through:

  • Static and semantic analysis of session-context switching code for missing authorization checks.
  • Code review signals involving user-controlled namespace, database, tenant, or record identifiers.
  • Tests that attempt authorized and unauthorized USE transitions across tenant boundaries.
  • Policy enforcement requiring deny-by-default table and record permissions.
  • Audit monitoring for unusual cross-tenant context changes or access patterns.

Automated security review tools may help identify missing authorization checks, but

deployment-specific permission tests remain important.

Sources

SourceLink
github.comgithub.com/surrealdb/surrealdb/security/advisories/GHSA-2v9j-645m-pcrq
vulncheck.comvulncheck.com/advisories/surrealdb-before-3.3.0-cross-tenant-access-via-use-statement

Frequently asked

questions

It may be exploitable through any exposed SurrealQL endpoint or application

path that allows an authenticated user to submit queries or otherwise

influence session context.

The attacker generally needs a valid namespace, database, or record-level

account. Anonymous access is not required if the affected authorization path

accepts authenticated users.

Enforce authorization checks whenever a session changes namespace or database

context, and apply independent least-privilege checks to tables and records.

Treat tenant identifiers and context-selection statements as untrusted input,

test every cross-tenant boundary, use deny-by-default permissions, and monitor

for unauthorized context-switching attempts.

It may be exploitable through any exposed SurrealQL endpoint or application

path that allows an authenticated user to submit queries or otherwise

influence session context.

The attacker generally needs a valid namespace, database, or record-level

account. Anonymous access is not required if the affected authorization path

accepts authenticated users.

Enforce authorization checks whenever a session changes namespace or database

context, and apply independent least-privilege checks to tables and records.

Treat tenant identifiers and context-selection statements as untrusted input,

test every cross-tenant boundary, use deny-by-default permissions, and monitor

for unauthorized context-switching attempts.

Find out what's already
exploitable in your codebase.