GHSA-PM6C-Q8RH-92M8
Field-level SELECT permissions bypassed in LIVE query projections via `$before` / `$after`
Texto original en inglés · Ver en español
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/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-PM6C-Q8RH-92M8 divulgada · CVSS 4.3 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
A subscriber to a `LIVE SELECT` query could read a field that field-level `SELECT` permissions should have hidden from them, by projecting it out of the `$after` or `$before` event parameter instead of selecting the field by name.
A `LIVE SELECT` delivers a per-subscriber document that has field-level `PERMISSIONS FOR select` applied, so a field the subscriber may not read is cut from the notification payload. The `$value`, `$before`, and `$after` parameters, however, were bound to the unreduced record. A subscriber authorised for the table but not for a field could root a projection at one of those parameters and copy the restricted value straight into the notification:
LIVE SELECT $after.hidden AS leaked FROM test;`$after` carried the new record on `CREATE` and the post-update record on `UPDATE`; `$before` carried the pre-delete record on `DELETE`. The alias placed the value under a name the payload's field filter did not treat as the restricted field, so it survived into the result. The table's own `SELECT` permission was still enforced, so the subscriber only received records they were already entitled to see — the disclosure was confined to fields within those records.
A related path, testing the restricted field in the `WHERE` clause and observing whether a notification arrives, is covered by GHSA-jm88-9wvx-6h4q https://github.com/surrealdb/surrealdb/security/advisories/GHSA-jm88-9wvx-6h4q. The same change in 3.3.0 fixes both.
Impact
Only databases that use field-level `SELECT` permissions — `DEFINE FIELD ... PERMISSIONS FOR select NONE`, or a restricting `WHERE` — to hide a field from users who can otherwise read the table are affected. This is a confidentiality issue at the field-permission boundary.
What an attacker can do:
- With permission to run a `LIVE SELECT` on a table (a record user is enough) but no permission to read a particular field, receive that field's value in notifications by projecting it out of `$before` / `$after`, for every record the subscription already delivers, across `CREATE`, `UPDATE`, and `DELETE`.
- Recover the exact stored value, not merely its presence.
What it can't do:
- Reach records the subscription is not already entitled to. This issue does not bypass table-level permissions, and exposes nothing across tables, namespaces, or databases.
- Modify data — this is read-only disclosure.
- Escape field-level scope: only fields on the subscribed table's own records are exposed. System users (root, namespace or database users) are unaffected, as they may already read every field.
Patches
`LIVE SELECT` now binds `$value`, `$before`, and `$after` to the same per-subscriber reduced views used for the notification payload, so a projection rooted at those parameters can no longer read a field the subscriber may not select. Both the pre- and post-mutation images are reduced, so `CREATE`, `UPDATE`, and `DELETE` are all covered, in full-document and `DIFF` mode alike.
- Versions 3.3.0 and later are not affected by this issue.
Workarounds
Users unable to patch should consider the following workarounds:
- Do not rely on field-level `SELECT` permissions to hide values on a table that untrusted users can subscribe to; keep sensitive fields in a separate table or database those users cannot read at all, or restrict at the table level.
- Deny live and arbitrary queries to untrusted principal classes with `--deny-arbitrary-query` (env `SURREAL_CAPS_DENY_ARBITRARY_QUERY`), for example for `guest` and `record`, which also blocks the `LIVE` RPC for those classes.
References
- SurrealQL Documentation — LIVE SELECT
https://surrealdb.com/docs/surrealql/statements/live - SurrealQL Documentation — DEFINE FIELD
https://surrealdb.com/docs/surrealql/statements/define/field - SurrealQL Documentation — DEFINE TABLE … PERMISSIONS
https://surrealdb.com/docs/surrealql/statements/define/table - `fix(doc): bind LIVE $value/$after/$before to reduced views` (included in SurrealDB 3.3.0)
Acknowledgements
Thank you to arbor-s https://github.com/arbor-s for reporting this issue.
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-pm6c-q8rh-92m8Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
