llamaCVEVulnerability Intelligence
/
Advisory · GitHub · crates.io · surrealdb

GHSA-FF2Q-H4X7-CPJ4

ON DELETE REJECT Errors Disclose SELECT-Hidden Referencing Record Ids in SurrealDB

Texto original en inglés · Ver en español

Parche disponible
Descargar PNG JSON
CVSS
—
medium
Fuente: —
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versiónPrimer parche el mismo día de la divulgación
Exposición18 dDesde la divulgación, 3 nov 2026, 10:50 a. m.
Detección17 dDesde la divulgación hasta su ingreso al índice
Decisión estimadaSeguir
Remediar en la ventana regular de mantenimiento
Estimación de Llama con el árbol SSVC de CISA a partir de la severidad declarada por GHSA (media) y la evidencia de explotación (sin evaluación oficial): sin explotación conocida, no automatizable e impacto técnico parcial. Hay versiones corregidas disponibles.
Ponle etiqueta y a la cola. Ordenadito.Esta la tienes controlada, confío en ti.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada +1
Explotación
Remediación
Parche 4.0.0
Monitoreo
Detectada +1
3 nov 26
20 nov 26
21 nov 26
3 nov 26
8 nov 26
12 nov 26
17 nov 26
21 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-FF2Q-H4X7-CPJ4 divulgada
Remediación Parche 4.0.0 surrealdb · 0 d desde divulgación
Divulgación Modificada Última actualización del registro
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés
Summary

When SurrealDB rejects a delete because an `ON DELETE REJECT` reference exists, the error reads `Cannot delete `<record>` as it is referenced by `<foreign>` with an ON DELETE REJECT clause` — and `<foreign>` is taken straight from the reference index with no permission gate. A principal who may delete a record but cannot SELECT the rows referencing it learns that a hidden referencing row exists and obtains its exact record id, one candidate record per query. This crosses the row-level SELECT permission boundary of the referencing table (`PERMISSIONS FOR select WHERE public = true` demonstrated, `NONE` equally affected). Verified on the official v3.3.0 Docker image (2026-09-24, current release) and by source review on main `18971ffb` (2026-09-04).

Details

The reference-integrity check in the delete pipeline, `surrealdb/core/src/doc/purge.rs::check_referenced` (v3.3.0 line 532), scans the reference-index range for the record being deleted and, on the `Reject` strategy, constructs the referencing record id directly from the index key (`key.foreign_table`, `key.foreign_key`) and bails with `DeleteRejectedByReference(rid.to_sql(), record.to_sql())` (error at `doc/error.rs:131` on v3.3.0; `purge.rs:359` and `err/mod.rs:1182` on HEAD). Nothing on this path consults the acting principal's SELECT permissions on the foreign record, although the same principal's SELECT on the referencing table is demonstrably filtered by the row-level predicate (the row is invisible via SELECT), and the error is surfaced as `kind: Internal` — not as a permission error — so callers cannot even distinguish an integrity signal from a denial.

The rejection itself is intended behavior (referential integrity works); the flaw is the content of the failure observable. SurrealDB's own advisory line treats hidden-data-in-error-text as a patchable vulnerability class (GHSA-6g9v-7gq3-p2c6, arithmetic operand echo). The reference/edge advisory family covers only integrity issues (GHSA-4w65-7h3j-p29h CASCADE permission bypass, GHSA-whwg-vh4f-pmmf / CVE-2026-49997 edge delete bypass); no advisory covers this disclosure.

Proof of concept

Environment: official `surrealdb/surrealdb:latest` image (v3.3.0) on 127.0.0.1:16451, root bootstraps the schema, a record user `alice` is created by the PoC. All data synthetic. The attached archive automates every step and removes its container on exit.

Schema: `asset` with `PERMISSIONS FULL`; `report` with `PERMISSIONS FOR select WHERE public = true, FOR create FULL, FOR update FULL, FOR delete NONE` and `DEFINE FIELD about TYPE record<asset> REFERENCE ON DELETE REJECT`; one hidden referencing row (`report:case_hidden`, `public = false`) pointing at `asset:doc_secret`, one public row, one unreferenced asset.

Controls: the boundary is real and active — the unauthenticated caller is denied, root sees both rows, alice's SELECT returns only the public row, and alice can delete an unreferenced asset:

[PASS] C0 unauthenticated SELECT denied
[PASS] C1 privileged caller sees hidden row (fixture valid)
[PASS] C2 alice SELECT shows only public row (boundary holds on SELECT)
[PASS] C3 alice DELETE of unreferenced record succeeds

Payload: alice deletes the referenced `asset:doc_secret`:

[PASS] T1 reject error discloses SELECT-hidden record id 'report:case_hidden'
[PASS] T1b error surfaced as Internal (not a permission denial)
[PASS] T2 control: root's delete rejected by REJECT clause too

The rejected delete returns `Cannot delete 'asset:doc_secret' as it is referenced by 'report:case_hidden' with an ON DELETE REJECT clause` — naming the exact record id that alice's SELECT cannot return. Repeatable per candidate asset, yielding a hidden-row existence and record-id oracle.

Automated run from the attached archive (`surrealdb-delete-reject-record-disclosure-PoC.zip`), executed from an extracted copy in a clean state (fresh container each run):

$ poc/poc.sh
[+] PASS: C0 unauthenticated SELECT denied
[+] PASS: C1 privileged caller sees hidden row (fixture valid)
[+] PASS: C2 alice SELECT shows only public row (boundary holds on SELECT)
[+] PASS: C3 alice DELETE of unreferenced record succeeds
[+] PASS: T1 reject error discloses SELECT-hidden record id 'report:case_hidden'
[+] PASS: T1b error surfaced as Internal (not a permission denial)
[+] PASS: T2 control: root's delete rejected by REJECT clause too

==== result: 7 passed, 0 failed ====
Impact

An authenticated principal holding DELETE permission on a table (the ordinary "users may delete their own content" grant) can enumerate hidden referencing rows about records they can delete: hidden moderation, watchlist, or ownership rows are revealed one record id per query, together with a boolean existence oracle for the hidden rows themselves. This crosses the row-level SELECT permission boundary on the current patched release, in a codebase that already treats error-text content as permission-relevant. No integrity or availability impact (the delete is correctly rejected).

Patches

A patch has been created that withholds a referencing record's id from an `ON DELETE REJECT` error unless the caller is permitted to read it, so a referential-integrity failure no longer discloses a SELECT-hidden record id to a permission-checked caller.

  • Version 4.0.0 and later are not affected by this issue.
References
  • SurrealQL Documentation — DEFINE FIELD https://surrealdb.com/docs/surrealql/statements/define/field
  • `fix(refs): ON DELETE REJECT errors disclose SELECT-hidden referencing record ids` (commit `d31793fdc5`)

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Versiones

Rangos afectados

Afectada Corregida Última
surrealdb< 4.0.0
4.0.0
4.0.1
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
crates.iosurrealdb
Corregida 4.0.0 0 d 4.0.1 no afectada
Versiones corregidas4.0.0
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/surrealdb/surrealdb/security/advisories/GHSA-ff2q-h4x7-cpj4

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.