GHSA-JM88-9WVX-6H4Q
Field-level SELECT permissions bypassed in LIVE query WHERE clauses via `$before` / `$after`
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-JM88-9WVX-6H4Q 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 determine the value of a field that field-level `SELECT` permissions should have hidden from them, by testing it in the query's `WHERE` clause through the `$after` or `$before` event parameter and observing whether a notification was delivered.
A `LIVE SELECT` `WHERE` clause is evaluated against a per-subscriber document that has field-level `PERMISSIONS FOR select` applied. The `$value`, `$before`, and `$after` parameters, however, were bound to the unreduced record, so a predicate rooted at one of them tested the field's real value:
LIVE SELECT * FROM test WHERE $after.hidden = 123;The notification payload could still omit the restricted field, but whether a notification arrived at all depended on the restricted value, turning delivery into a boolean oracle. Repeating with different comparisons let a subscriber confirm a guessed value or narrow a range. `$after` covered `CREATE` and `UPDATE`; `$before` covered the pre-delete value on `DELETE`. The table's own `SELECT` permission was still enforced, so the oracle only spoke about records the subscriber was already entitled to receive.
A related path, copying the restricted field into the notification through the projection, is covered by GHSA-pm6c-q8rh-92m8 https://github.com/surrealdb/surrealdb/security/advisories/GHSA-pm6c-q8rh-92m8. 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, use a `WHERE` predicate over `$before` / `$after` to test that field and infer its value from whether a notification is delivered, across `CREATE`, `UPDATE`, and `DELETE`.
- Confirm exact values or narrow ranges through repeated crafted predicates.
What it can't do:
- Read the field's value directly from the payload; the disclosure is by inference from delivery, one predicate at a time.
- 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. System users (root, namespace or database users) are unaffected.
Patches
`LIVE SELECT` now binds `$value`, `$before`, and `$after` to the same per-subscriber reduced views used elsewhere in delivery, so a `WHERE` predicate rooted at those parameters can no longer test a field the subscriber may not select: the field reads as `NONE`, exactly as it does in the payload. Both the pre- and post-mutation images are reduced, so `CREATE`, `UPDATE`, and `DELETE` are all covered.
- 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-jm88-9wvx-6h4qLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
