GHSA-848m-r628-vrxw: High severity rust/surrealdb vulnerability

Published Sep 4, 2026
·
Updated

An authenticated user scoped to one namespace/database could invoke a custom API (DEFINE API) belonging to a different namespace/database, reaching another tenant's endpoint.

The route /api/{namespace}/{database}/{endpoint} took the namespace and database from the URL and applied them to the caller's session before the endpoint was looked up or run, without checking that the caller's authenticated scope covered them. Because a custom API handler runs with permissions disabled (definer's rights), the endpoint's own PERMISSIONS clause was the only gate — open to everyone for a PERMISSIONS FULL endpoint. The api::invoke() function was affected the same way, resolving against the session's selected namespace/database (settable via the surreal-ns / surreal-db headers or USE).

Impact

What an attacker can do:

- With valid credentials for any one namespace/database (a VIEWER is enough), invoke a custom API in another namespace/database by naming the victim scope in the URL. - Read data that endpoint returns — including from PERMISSIONS NONE tables, since the handler runs with permissions disabled — or trigger any writes and side effects it performs.

What it can't do:

- Reach a scope without valid credentials for some namespace/database on the instance; this is not an unauthenticated bypass. - Affect single-tenant deployments, or any deployment where callers already hold instance-wide (root) scope.

Patches

The namespace/database is now validated against the caller's authenticated level — which the request cannot change — before the endpoint is resolved or run. A target scope outside that level is rejected with 403 Forbidden, both at the HTTP entry point and at the dispatch step shared with api::invoke(). Root reaches any scope; namespace principals their namespace; database and record principals their exact namespace/database; anonymous callers remain governed by the endpoint's PERMISSIONS.

- Versions 3.2.0 and later are not affected by this issue.

Workarounds

Users unable to patch should consider the following workarounds:

- Disable the custom API HTTP route via capabilities where it is not required. - Treat separate deployments, not namespace/database boundaries, as the tenant isolation boundary on shared instances. - Prefer a PERMISSIONS WHERE clause that checks the authenticated identity over PERMISSIONS FULL (reduces exposure but does not restore the boundary).

Resources

- SurrealQL Documentation — DEFINE API - SurrealDB Documentation — Capabilities - fix(core/api): reject cross-tenant custom API access (included in SurrealDB 3.2.0)

Acknowledgements

SurrealDB thanks sondt99 for reporting this issue.

Affected Software

1 affected componentFixes available
rust/surrealdb<3.2.0
3.2.0

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.2.0
  2. Upgrade

    Upgrade SurrealDB to a version that resolves this vulnerability.

    Fixed in 3.2.0Patch fix(core/api): reject cross-tenant custom API access
  3. Configuration

    Disable the custom API HTTP route via capabilities where it is not required.

    SurrealDB custom API HTTP route (/api/{namespace}/{database}/{endpoint}) capabilities for enabling the custom API HTTP route = disable (where not required)

Event History

Sep 4, 2026
Advisory Published
via GitHub·08:07 PM
Data Sourced
via GitHub·08:07 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Who can exploit this issue?

An attacker needs valid credentials in any namespace/database; a VIEWER role is sufficient. They can then target a custom API in a different namespace/database by selecting that victim scope in the request URL.

2

Which custom APIs present the greatest exposure?

Endpoints with a PERMISSIONS FULL clause are open to everyone once reached and are therefore directly exposed to cross-namespace/database invocation. Any data returned, writes, or other side effects performed by such an endpoint may be accessible or triggerable by the attacker.

3

Can endpoint handlers access data that would normally be restricted?

Yes. Custom API handlers run with permissions disabled, so an invoked handler can read data from PERMISSIONS NONE tables if its logic accesses that data.

4

Does this also affect API calls made through api::invoke()?

Yes. api::invoke() resolves using the session's selected namespace/database, which can be set through the surreal-ns and surreal-db headers or with USE.

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