CVE-2024-58363 — Vulnerability in surrealdb-core — CVE Details
SurrealDB vulnerable to Improper Authentication when Changing Databases as Scope User
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.34%). Schedule for your next planned update.
Does your project use an affected surrealdb-core version?
Paste your Cargo.lock to check it for CVE-2024-58363 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
Authentication would not be properly validated when an already authenticated scope user would use the use method or USE clause to switch working databases in a session. If there was a user record in the new database with identical record identifier as the original record that the user authenticated with in the original database, this could result in the user being able to perform actions under the identity of the unrelated user in the new database. This issue does not affect system users at any level.
By default, record identifiers are randomly generated with sufficient complexity to prevent the identifier collision required to trigger this issue. However, the issue may trigger in situations where multiple databases in the same SurrealDB instance are using explicitly defined or incremental record identifiers to identify users on an identically named table.
Impact
Under the circumstances described above, a user who has an authenticated session as a scope user in a database could become authorized to query data under the identity of a specific scope user associated with an identical record identifier in a different database within the same SurrealDB instace if the PERMISSIONS clause would allow it due to relying exclusively on the $auth parameter, which would point to the impersonated user. The impact is limited to the single user with matching record identifier.
The impact of this issue is mitigated if the table PERMISSIONS clause explicitly checks for an scope that only exists in the specific database (e.g. $scope = "production") or certain claims of the authentication token (e.g. $token.email = "example@example.com"), both of which would remain unchanged in the session of the authenticated user after changing databases. Permissions will default to NONE if there is no PERMISSIONS clause, which also mitigates this impact of this issue.
Patches
- Version 1.5.4 and later are not affected by this issue.
- Version 2.0.0-alpha.6 and later will not be affected by this issue.
Workarounds
Users unable to update may want to ensure that table PERMISSIONS clauses explicitly check that the $scope parameter matches a scope that is uniquely named across databases in the same SurrealDB instance. Ensuring that record identifiers for users are automatically generated or explicitly generated to be unique across databases may also be sufficient to mitigate this issue, as the $auth parameter will not link to any user record and any PERMISSIONS clauses restricting authorization based on the authenticated user should fail to successfully evaluate.
References
Advisory Timeline
- First published July 11, 2024 (868 days ago).
- Last revised July 19, 2026 — 738 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
cargo update -p surrealdb-core --precise 1.5.1
cargo update -p surrealdb --precise 1.5.4
cargo update -p surrealdb --precise 2.0.0-alpha.6
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (3)
Affects 1 ecosystem: crates.io (2).
| Package | Fixed In |
|---|---|
| surrealdb-core crates.io · Affected: All versions | 1.5.1 |
| surrealdb crates.io · Affected: All versions | 1.5.4 |
| surrealdb crates.io · Affected: All versions | 2.0.0-alpha.6 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-287Improper AuthenticationMITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 6.3 score means for each attack dimension.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L
References
Frequently Asked Questions
- What is CVE-2024-58363?
- SurrealDB vulnerable to Improper Authentication when Changing Databases as Scope User. This vulnerability has been assigned a severity rating of MEDIUM (CVSS score: 6.3/10).
- How do I check if my project is affected by CVE-2024-58363?
- CVE-2024-58363 affects surrealdb-core and surrealdb. It has a 0.3% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2024-58363 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Exploitation requires specific conditions, or the impact is limited.
This is a below-median EPSS score — only 20.3% of tracked vulnerabilities score at or below it, so most tracked vulnerabilities are considered more likely to be exploited than this one.
Also Known As
Related CVEs
- CVE-2024-58362HIGH
Untrusted Query Object Evaluation in RPC API
- CVE-2024-58367HIGH
SurrealDB: Improper Authorization in Select Permissions
- CVE-2026-63739HIGH
SurrealDB: Arbitrary file read via DEFINE ANALYZER mapper() filter
- CVE-2024-58361HIGH
SurrealDB has an Uncaught Exception Handling Parsing Errors on Empty Strings
- CVE-2026-63743MEDIUM
SurrealDB: Port-specific --deny-net rules silently bypassed on HTTP redirect
- CVE-2026-63755MEDIUM
SurrealDB: Scraping a TABLE with no available PERMISSIONS to current auth level
- CVE-2024-58357MEDIUM
SurrealDB has an Uncaught Exception in Function Generating Random Time
- CVE-2024-58359MEDIUM
SurrealDB has an Uncaught Exception Sorting Tables by Random Order