Technical impact
The vulnerability occurs because SurrealDB does not properly validate the authenticated context when a user changes the active database using the USE clause or the equivalent method. An attacker who has a valid authenticated session can switch to a database where a user record with a matching identifier exists, thereby impersonating that user if permissions are granted solely based on the $auth token. This allows the attacker to perform any action the impersonated user is permitted to do, such as reading, modifying or deleting data. The flaw is an authentication bypass, identified as CWE-287, enabling unauthorized access to data that should be protected by the $auth parameter.
Affected Systems
This issue affects SurrealDB deployments running any version prior to 1.5.4 and the 2.0.0-alpha series before 2.0.0-alpha.6. The product is the SurrealDB database engine (surrealdb:surrealdb), and the flaw manifests when a user record with the same identifier exists in multiple databases. Vulnerable builds include surrealdb:surrealdb and surrealdb:surrealdb-core.
Risk and Exploitability
The CVSS score of 5.3 denotes moderate severity, while the EPSS score of less than 1% indicates a low probability of exploitation in the wild. The vulnerability is not listed in CISA’s KEV catalog. Exploitation requires an attacker to first acquire a valid authenticated session on the SurrealDB instance, then issue a USE directive that points to a database containing a user record with the same identifier. Once the context switches, the attacker can act as that user, thereby accessing functionality that depends solely on the $auth token. The attack vector is therefore limited to authenticated users and does not involve remote code execution or privilege escalation from an unauthenticated state.