Disclosed on June 19, 2026 (updated June 19, 2026)
PGV-264505D is a category 3 vulnerabilty that affects surrealdb, versions ≥ 3.0.0 & < 3.1.5
The risk assessment shows that this vulnerability is exlpoited by a rogue user. A legitimate user who abuses authorized access to exploit this vulnerability.
The impact is contained to the application. Exploitation remains confined to the application and cannot affect the host environment or external systems.
The threat damage is caused by a data breach (limited). Exploitation does not provide access to data beyond what the user is already authorized to access.
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.
What an attacker can do:
null, but the rows come back in the hidden values' order.What it can't do:
WHERE are still enforced, so only records the caller may already read are ordered.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.
Users unable to upgrade are advised to consider the following:
SURREAL_PLANNER_STRATEGY=compute-only; the sort then runs after redaction, so no ordering leaks.fix(planner): prevent ORDER BY value-ordering oracle on restricted SELECT fieldsfix(planner): close ORDER BY value-ordering oracle on the DynamicScan fallbackThanks to George Chen (@geo-chen) for finding and reporting this issue.
| Network Exposure | External Accessable from the public internet |
| Access Interface | WebBrowser Primarily web-based applications |
| Service Outage | Disruptive Operations would be impacted |
| Data Breach | Disruptive Operations would be impacted |
| Data Tampering | Disruptive Operations would be impacted |
| Customize | |