{"id":"CVE-2026-63742","aliases":["CVE-2026-63742","GHSA-c8jx-96c9-8xrp"],"related":[],"kind":"vulnerability","state":"published","title":"SurrealDB before 3.1.0 Field Permission Bypass via Indexed COUNT","summary":"SurrealDB versions before 3.1.0 contain a field-level SELECT permission bypass vulnerability in indexed COUNT fast paths. Attackers can execute COUNT queries on indexed fields with field-level SELECT restrictions to confirm or recover restricted field values through repeated guesses.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"SurrealDB versions before 3.1.0 contain a field-level SELECT permission bypass vulnerability in indexed COUNT fast paths. Attackers can execute COUNT queries on indexed fields with field-level SELECT restrictions to confirm or recover restricted field values through repeated guesses.","source":"cvelist"},{"lang":"en","text":"A record user could learn the value of a hidden field by counting how many records match a guess.\n\nWhen `DEFINE FIELD ... PERMISSIONS FOR select WHERE ...` hides a field's contents from a caller, and that field is indexed, running `SELECT count() FROM t WHERE hidden_field = \"guess\" GROUP ALL` returned a count greater than zero whenever a record actually had that value — even though the caller was never allowed to read the field directly. The query planner used an indexed-COUNT shortcut (`Index::Count`, `IndexCountScan`, or the legacy `Iterate Index Count` / `Iterate Index Keys` paths) that counts matching index entries and skips the permission check that would normally hide the value. The same query with `WITH NOINDEX` correctly returned `[]`, confirming the gap.\n\nBy repeating the count query with different guesses, an attacker can confirm or recover the contents of any restricted field they could not read through a normal `SELECT`.\n\n### Impact\n\nWhat an attacker **can** do:\n\n- Confirm or recover values of a field protected by field-level SELECT permissions on any table they hold table-level SELECT on, provided the field is indexed.\n- Repeat the query with different guesses to read restricted field contents one value at a time.\n\nWhat it **can't** do:\n\n- Read fields that are not indexed (the shortcut only fires when an index covers the predicate column).\n- Cross table, database or namespace isolation boundaries.\n- Modify data, escalate privileges, or affect availability.\n\n### Patches\n\nThe legacy planner (`surrealdb/core/src/idx/planner/tree.rs`) and the streaming planner (`surrealdb/core/src/exec/planner/select/mod.rs`) now both refuse the indexed fast path when the WHERE / ORDER tree references a field governed by a non-`Full` SELECT permission:\n\n- `resolve_indexes` skips any B-tree / unique index whose columns are governed by such a permission.\n- A new `cond_touches_restricted_field` flag is propagated; `eval_count` refuses a dedicated `Index::Count` when set.\n- The streaming planner adds `cond_touches_restricted_select_field`, a `RestrictedIdiomChecker` visitor that matches each idiom against the table's field-permission prefixes (loaded via the plan-time txn), and gates `IndexCountScan` emission on it.\n- The fast paths are preserved for root / owner sessions via `should_check_perms_for_view`.\n\nVersions 3.1.0 and later are not affected.\n\n### Workarounds\n\nUsers unable to patch are advised to consider the following workarounds:\n\n- Avoid `DEFINE INDEX` on fields whose values are protected by field-level SELECT permissions. The class of attack is specific to the indexed fast paths.\n- Restrict the ability of record users to issue arbitrary `SELECT count() … GROUP ALL` queries against tables containing field-protected columns.\n- Use namespace / database isolation as the primary boundary where feasible.","format":"markdown","source":"ghsa"}],"published":"2026-07-01T20:22:06.000Z","modified":"2026-11-04T02:56:13.128Z","severity":{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N","score":5.3,"rating":"MEDIUM"},"severities":[{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N","score":5.3,"rating":"MEDIUM"},{"scorer":"VulnCheck","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N","score":4.3,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N","score":4.3,"rating":"MEDIUM"}],"cwes":["CWE-863"],"affected":[{"ranges":[{"type":"semver","introduced":"0","fixed":"3.1.0","status":"affected"},{"type":"semver","version":"3.1.0","status":"unaffected"}],"vendor":"surrealdb","product":"surrealdb","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"3.1.0"}],"ecosystem":"crates.io","package":"surrealdb","purl":"pkg:cargo/surrealdb","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"3.1.0"}],"vendor":"surrealdb","product":"surrealdb","cpe":"cpe:2.3:a:surrealdb:surrealdb:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/surrealdb/surrealdb/security/advisories/GHSA-c8jx-96c9-8xrp","tags":["mitigation","vendor-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://www.vulncheck.com/advisories/surrealdb-before-field-permission-bypass-via-indexed-count","tags":["third-party-advisory"],"sources":["cvelist","nvd"]},{"url":"https://github.com/surrealdb/surrealdb/pull/240","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/surrealdb/surrealdb/commit/0c6dd021bb55b32a78a553c72bb9c0cdd414825f","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/surrealdb/surrealdb","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"VulnCheck","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-07-20T12:53:40.893Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-63742","url":"https://www.cve.org/CVERecord?id=CVE-2026-63742","licence":"CVE Terms of Use","modified":"2026-07-28T01:05:38.097Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-c8jx-96c9-8xrp","url":"https://github.com/advisories/GHSA-c8jx-96c9-8xrp","licence":"CC-BY-4.0","modified":"2026-11-04T02:56:13.128Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-63742","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-63742","licence":"Public domain","modified":"2026-07-22T15:47:01.527Z"}],"updatedAt":"2026-11-25T22:59:29.203Z","epss":{"score":0.00211,"percentile":0.11967,"date":"2026-12-01T12:00:22.000Z"}}