GHSA-h4h3-3rfj-x6fq: Infoleak

Published Jun 19, 2026
·
Updated

A field can be hidden from a user with a field-level SELECT permission (DEFINE FIELD code ON secret PERMISSIONS FOR select WHERE owner = $auth.id). When that field is indexed, a record user who cannot read it could still recover the relative ordering of its values across every record by issuing ORDER BY <field>: the field came back null as intended, but the rows were returned in the hidden values' true sorted order.

To satisfy the sort, the planner selects the field's index and walks it in value order; the field-level permission is applied later, when the row is projected, so the value is nulled but the row order already encodes it. The guard that withholds restricted fields from the WHERE path was never applied to ORDER BY.

Impact

What an attacker can do:

- As a record (scope) user with table SELECT, learn the relative ordering of a field hidden by a field-level SELECT permission, across other users' records, by ordering on it when an index covers the field — the value returns null, but the rows come back in the hidden values' order. - With rows they control in the same table, use that ordering to narrow the hidden values toward exact ones.

What it can't do:

- Read the field value directly — only its relative ordering leaks; the projected value is correctly redacted. - Cross table, record, or namespace/database boundaries — the table's SELECT permission and any row-level WHERE are still enforced, so only records the caller may already read are ordered. - Leak anything when the restricted field is not indexed, affect root or record-owner sessions, or modify data (confidentiality only).

Patches

The query planner now applies the field-permission guard to the ORDER BY clause as well as the WHERE clause. When an ordered field is hidden from the caller by a field-level SELECT permission, the index sort pushdown is withheld and the rows are sorted after redaction instead, so the row order no longer reflects the hidden values. The dynamic-scan fallback is closed the same way, and a regression test was added.

The fix is included in SurrealDB 3.1.5.

Workarounds

Users unable to upgrade are advised to consider the following:

- Force the legacy executor with SURREALPLANNERSTRATEGY=compute-only; the sort then runs after redaction, so no ordering leaks. - Do not place an index on a field whose values are hidden by a field-level SELECT permission — without the index the leak does not occur. - Do not rely on field-level SELECT permissions to hide values on indexed fields from record users; restrict at the table level instead. - Use namespace / database isolation as the primary trust boundary where feasible.

References

- SurrealQL Documentation — DEFINE FIELD - SurrealQL Documentation — DEFINE INDEX - SurrealQL Documentation — DEFINE TABLE … PERMISSIONS - Related advisory (same class, indexed COUNT variant): GHSA-c8jx-96c9-8xrp - fix(planner): prevent ORDER BY value-ordering oracle on restricted SELECT fields - fix(planner): close ORDER BY value-ordering oracle on the DynamicScan fallback

Acknowledgements

Thanks to George Chen (@geo-chen) for finding and reporting this issue.

Affected Software

1 affected componentFixes available
rust/surrealdb>=3.0.0<3.1.5
3.1.5

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade rust/surrealdb to a version that resolves this vulnerability.

    Fixed in 3.1.5
  2. Configuration

    Set the environment variable SURREAL_PLANNER_STRATEGY=compute-only to force the legacy executor; the sort then runs after redaction so ordering leaks do not occur.

    SurrealDB runtime SURREAL_PLANNER_STRATEGY = compute-only
  3. Configuration

    Do not place an index on a field whose values are hidden by a field-level SELECT permission — without the index the leak does not occur.

    SurrealDB schema (indexes/fields) indexing on fields with field-level SELECT permissions = do not index
  4. Configuration

    Do not rely on field-level SELECT permissions to hide values on indexed fields from record users; restrict access at the table level instead (use table-level SELECT permissions for sensitive fields).

    SurrealDB permissions SELECT permission scope = table-level
  5. Compensating control

    Use namespace/database isolation as the primary trust boundary where feasible (isolate sensitive data in separate namespaces or databases).

Event History

Jun 19, 2026
Advisory Published
via GitHub·10:10 PM
Data Sourced
via GitHub·10:10 PM
DescriptionSeverityWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of GHSA-h4h3-3rfj-x6fq?

The severity of GHSA-h4h3-3rfj-x6fq is medium with a score of 4.3.

2

What type of vulnerability is GHSA-h4h3-3rfj-x6fq?

GHSA-h4h3-3rfj-x6fq is classified as an information leak vulnerability.

3

How can I mitigate GHSA-h4h3-3rfj-x6fq in my application?

To mitigate GHSA-h4h3-3rfj-x6fq, ensure that fields with SELECT permissions are not indexed if the user should not have access to their values.

4

Which software does GHSA-h4h3-3rfj-x6fq affect?

GHSA-h4h3-3rfj-x6fq affects the Rust SurrealDB software.

5

What is the potential impact of GHSA-h4h3-3rfj-x6fq?

The potential impact of GHSA-h4h3-3rfj-x6fq is that unauthorized users could gain insights into hidden data through indexed field ordering.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203