Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-102876 Overview
CVE-2026-102876 is a cross-tenant authorization bypass affecting SurrealDB versions before 3.3.0. The flaw resides in HTTP session construction, where the check_auth() routine verifies credentials against the Surreal-Auth-NS and Surreal-Auth-DB headers but then builds the session context from separate Surreal-NS and Surreal-DB headers without re-validating access permissions. An authenticated principal from one tenant can select another tenant's namespace and database, then read, create, and modify records across tenant boundaries. The weakness is classified as CWE-639: Authorization Bypass Through User-Controlled Key.
Critical Impact
A low-privileged database or namespace user can pivot into any other tenant's data on the same SurrealDB instance and perform full read and write operations.
Affected Products
- SurrealDB versions prior to 3.3.0
- SurrealDB v3.2.4 HTTP server (surrealdb/server/src/ntw/auth.rs)
- Multi-tenant SurrealDB deployments exposing the HTTP endpoint
Discovery Timeline
- 2026-09-29 - CVE-2026-102876 published to NVD
- 2026-09-29 - Last updated in NVD database
Technical Details for CVE-2026-102876
Vulnerability Analysis
SurrealDB accepts two independent pairs of HTTP headers to describe request context. The Surreal-Auth-NS and Surreal-Auth-DB headers indicate the namespace and database used to authenticate the caller, while Surreal-NS and Surreal-DB indicate the namespace and database the session should operate against. Before 3.3.0, the server treated these as unrelated inputs. Authentication succeeded against the auth-scoped tenant, but the resulting session was constructed against a different tenant chosen by the caller. No subsequent can_access_ns_db check was performed, so a Database- or Namespace-level principal could query any tenant on the instance.
Root Cause
The HTTP authentication path in ntw/auth.rs decoupled credential verification from the session's effective scope. Once check_auth() returned success, the session's namespace and database were populated directly from the request-selected headers. There was no post-authentication authorization check to confirm that the authenticated principal was actually permitted to operate against the selected ns/db pair.
Attack Vector
The attack is remote and network-based over the HTTP interface. An attacker with valid credentials for any Namespace- or Database-level user on the instance sets Surreal-Auth-NS/Surreal-Auth-DB to their own tenant and Surreal-NS/Surreal-DB to a victim tenant. The server authenticates as tenant A but serves queries against tenant B, enabling cross-tenant reads and writes without issuing a USE statement.
token(kvs, &mut session, au.token()).await?;
};
+ // SECURITY (GHSA-2v9j): the `Surreal-NS`/`Surreal-DB` headers select the
+ // session's namespace/database independently of the authenticated level —
+ // Basic auth verifies credentials against `Surreal-Auth-NS`/`Surreal-Auth-DB`,
+ // and a token carries its own ns/db. A Database- or Namespace-level principal
+ // must not be able to point the selected context at a foreign tenant and
+ // query it without a `USE`, so reject a context the authenticated level is
+ // not permitted to access. Root and anonymous (`Level::No`) principals are
+ // unrestricted by `can_access_ns_db`; the check only applies once both a
+ // namespace and database are selected.
+ if let (Some(ns), Some(db)) = (session.ns.as_deref(), session.db.as_deref())
+ && !session.au.can_access_ns_db(ns, db)
+ {
+ bail!(NetError::InvalidAuth);
+ }
+
Ok(session)
}
Source: SurrealDB security patch commit 5000e233. The patch adds a can_access_ns_db check on the final selected namespace and database, rejecting the session with NetError::InvalidAuth when the authenticated principal is not permitted for that scope.
Detect Identity Attacks the Moment Authentication Fails
Singularity™ Identity surfaces credential misuse, lateral movement, and privilege escalation in real time, so you can contain the breach before it spreads.
Stop Identity AttacksDetection Methods for CVE-2026-102876
Indicators of Compromise
- HTTP requests to SurrealDB where the Surreal-Auth-NS/Surreal-Auth-DB header values differ from the Surreal-NS/Surreal-DB header values.
- Successful queries or mutations executed under namespaces or databases the authenticated user is not otherwise associated with.
- Unusual read/write patterns in tenant databases originating from a single authenticated principal across multiple tenants.
Detection Strategies
- Parse SurrealDB HTTP access logs and alert when the auth-scope headers do not match the selected-context headers on the same request.
- Correlate authenticated user identity with the target ns/db in query telemetry to flag cross-tenant access attempts.
- Track the SurrealDB server version in your inventory and flag any instance running a version earlier than 3.3.0.
Monitoring Recommendations
- Forward SurrealDB HTTP request logs and application audit events to a centralized analytics platform for cross-tenant anomaly detection.
- Baseline per-user tenant access patterns and alert on deviations, particularly first-time access to a previously untouched namespace or database.
- Monitor for spikes in authentication failures against Surreal-Auth-NS/Surreal-Auth-DB combinations following the upgrade, which may indicate probing.
How to Mitigate CVE-2026-102876
Immediate Actions Required
- Upgrade SurrealDB to version 3.3.0 or later on all instances exposing the HTTP endpoint.
- Inventory multi-tenant deployments and prioritize any instance where multiple tenants share a single SurrealDB server.
- Rotate credentials for Namespace- and Database-level users after upgrade if cross-tenant access cannot be ruled out from logs.
Patch Information
The fix ships in SurrealDB release v3.3.0 and is tracked in GitHub Security Advisory GHSA-vx2p-7hhm-wv62. The corresponding code change is commit 5000e233, which enforces can_access_ns_db on the session's selected namespace and database before returning the session. Additional context is available in the VulnCheck advisory.
Workarounds
- Restrict network access to the SurrealDB HTTP endpoint so only trusted application backends can reach it, until the upgrade is deployed.
- At the reverse proxy or API gateway, reject requests where Surreal-Auth-NS/Surreal-Auth-DB values do not match Surreal-NS/Surreal-DB values.
- Isolate high-sensitivity tenants onto dedicated SurrealDB instances so header manipulation cannot cross tenant boundaries.
# Example NGINX snippet: reject requests where auth-scope and selected-scope headers diverge
map "$http_surreal_auth_ns:$http_surreal_auth_db" $surreal_auth_scope { default ""; }
map "$http_surreal_ns:$http_surreal_db" $surreal_sel_scope { default ""; }
server {
listen 443 ssl;
location / {
if ($surreal_auth_scope != $surreal_sel_scope) { return 403; }
proxy_pass http://surrealdb_upstream;
}
}
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

