Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: GSA_kwCzR0hTQS14NWZyLTdoaGotMzRqM84AA3yk

Full Table Permissions by Default

Default table permissions in SurrealDB were FULL instead of NONE. This would lead to tables having FULL permissions for SELECT, CREATE, UPDATE and DELETE unless some other permissions were specified via the PERMISSIONS clause.

We have decided to treat this behaviour as a vulnerability due to its security implications, especially considering the lack of specific documentation and potential for confusion due to the INFO FOR DB statement previously not displaying default permissions. Treating it as a bug fix provides justification for a change in default behavior outside of a major release.

Impact

Any client authorized to query data in a SurrealDB instance will have full access to any tables that were defined with no explicit permissions and that are within its authorization scope (i.e. namespace or database), including creating, reading, updating and deleting data. This is specially relevant for SurrealDB instances allowing guest access with publicly exposed interfaces (e.g. HTTP REST API or WebSocket API), since a remote unauthenticated user may gain full access to any tables that were defined without any explicit permissions. Tables that were defined with explicit permissions using the PERMISSIONS clause are not affected.

Patches

In patched versions:

Workarounds

In unpatched versions, this issue can be resolved by explicitly defining table permissions as shown in the following examples:

-- INSECURE EXAMPLE
-- DEFINE TABLE insecure;
-- SECURE EXAMPLE 1
DEFINE TABLE secure PERMISSIONS NONE;
-- SECURE EXAMPLE 2
DEFINE TABLE secure PERMISSIONS FOR SELECT, CREATE, UPDATE, DELETE NONE;
-- SECURE EXAMPLE 3
DEFINE TABLE secure PERMISSIONS FOR
  SELECT WHERE user = $auth.id,
  CREATE, UPDATE, DELETE NONE;
-- SECURE EXAMPLE 4
DEFINE TABLE secure PERMISSIONS
  FOR select WHERE published = true OR user = $auth.id
  FOR create, update WHERE user = $auth.id
  FOR delete WHERE user = $auth.id OR $auth.admin = true;

References

Permalink: https://github.com/advisories/GHSA-x5fr-7hhj-34j3
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS14NWZyLTdoaGotMzRqM84AA3yk
Source: GitHub Advisory Database
Origin: Unspecified
Severity: High
Classification: General
Published: about 1 year ago
Updated: about 1 year ago


CVSS Score: 8.8
CVSS vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Identifiers: GHSA-x5fr-7hhj-34j3
References: Repository: https://github.com/surrealdb/surrealdb
Blast Radius: 19.3

Affected Packages

cargo:surrealdb
Dependent packages: 42
Dependent repositories: 158
Downloads: 256,478 total
Affected Version Ranges: < 1.0.1
Fixed in: 1.0.1
All affected versions: 1.0.0
All unaffected versions: 1.0.1, 1.0.2, 1.1.0, 1.1.1, 1.2.0, 1.2.2, 1.3.0, 1.3.1, 1.4.0, 1.4.2, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.1.4