GHSA-W5V9-JC5F-5RMC
Cross-tenant access for system users through the Surreal-NS / Surreal-DB headers and the RPC use method
Texto original en inglés · Ver en español
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Remediación | Parche 3.3.0 | surrealdb · -4 d desde divulgación | |
| Divulgación | Publicada | GHSA-W5V9-JC5F-5RMC divulgada · CVSS 9.6 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
A system user (created with `DEFINE USER … ON DATABASE` or `ON NAMESPACE`) scoped to one tenant could read, create, modify, and delete rows in another tenant, and read the value of a `DEFINE PARAM` there.
The selected namespace/database came from caller-controlled input and was never compared with the level the caller authenticated at. On HTTP `/sql`, the `Surreal-NS` / `Surreal-DB` headers set it independently of the credentials. Over WebSocket `/rpc`, the `use` method set it unconditionally. A query-time scope check existed, but it applied only to record users, so namespace- and database-level users were never checked. After the switch, the caller's identity stayed bound to their own tenant, but queries ran against the foreign one, where the only remaining gate was the table's `PERMISSIONS` clause. So a table declared `PERMISSIONS FULL`, or with a predicate the caller happened to satisfy, admitted the request. That is a common table shape when the namespace/database itself is treated as the tenant boundary.
The same root cause was reported through several paths, each published as its own advisory and all fixed in 3.3.0:
- GHSA-2v9j-645m-pcrq
https://github.com/surrealdb/surrealdb/security/advisories/GHSA-2v9j-645m-pcrq: the `USE` statement - GHSA-vx2p-7hhm-wv62
https://github.com/surrealdb/surrealdb/security/advisories/GHSA-vx2p-7hhm-wv62: the `Surreal-NS` / `Surreal-DB` headers with Basic authentication - GHSA-3vw5-j55x-486h
https://github.com/surrealdb/surrealdb/security/advisories/GHSA-3vw5-j55x-486h: `RETURN … FETCH`, for record users
Impact
What an attacker can do:
- With a database- or namespace-level user in any one tenant, select another tenant through the `Surreal-NS` / `Surreal-DB` headers or the RPC `use` method. They can then read, create, update, and delete rows in its tables whose `PERMISSIONS` allow the operation, such as `PERMISSIONS FULL`.
- Read the value of a `DEFINE PARAM` in that tenant under the same conditions.
What it can't do:
- 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
- SurrealQL Documentation — USE
https://surrealdb.com/docs/surrealql/statements/use - SurrealQL Documentation — DEFINE TABLE … PERMISSIONS
https://surrealdb.com/docs/surrealql/statements/define/table - SurrealDB Documentation — Security and authentication
https://surrealdb.com/docs/surrealdb/security/authentication - `fix(core): enforce tenant boundary on USE / process_use` (included in SurrealDB 3.3.0)
- `fix(server): confine Surreal-NS/Surreal-DB header context to the auth level` (included in SurrealDB 3.3.0)
- `fix(core): confine record users to their own tenant on the write path` (included in SurrealDB 3.3.0)
- `fix(doc): re-verify record-auth namespace/database scope in the document pipeline` (included in SurrealDB 3.3.0)
Acknowledgements
Thank you to thaidn https://github.com/thaidn for reporting this issue.
Credits
- Reported by Calif.io, in collaboration with Anthropic.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
crates.iosurrealdb |
Corregida | 3.3.0 | -4 d | 4.0.1 no afectada |
3.3.0Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/surrealdb/surrealdb/security/advisories/GHSA-w5v9-jc5f-5rmcLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
