llamaCVEVulnerability Intelligence
/
Advisory · GitHub · crates.io · surrealdb

GHSA-GH9F-6XM2-C4J2

SurrealDB vulnerable to Improper Authentication when Changing Databases as Scope User

Parche disponible
Descargar PNG JSON
CVSS
—
medium
Fuente: —
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche4 versionesPrimer parche a -1 d de la divulgación
Exposición861 dDesde la divulgación, 11 jul 2024, 8:19 a. m.
Detección858 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Modificada
Explotación
Remediación
Parche 1.5.4 +1
Parche 2.0.0
Monitoreo
Detectada
10 jul 24
11 jul 24
17 sept 24
19 jul 26
17 nov 26
19 nov 26
10 jul 24
11 feb 25
14 sept 25
18 abr 26
19 nov 26
FechaFaseEventoDetalle
Remediación Parche 1.5.4 surrealdb · -1 d desde divulgación
Remediación Parche 1.5.1 surrealdb-core · -1 d desde divulgación
Divulgación Publicada GHSA-GH9F-6XM2-C4J2 divulgada
Remediación Parche 2.0.0 surrealdb · 68 d desde divulgación
Divulgación Modificada Última actualización del registro
Monitoreo Detectada Ingresó al índice
Resumen
Descripción del advisory
Texto original · GitHub · en inglés

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
  • https://github.com/surrealdb/surrealdb/pull/4335
Versiones

Rangos afectados

Afectada Corregida Última
surrealdb-core< 1.5.1
surrealdb< 1.5.4
surrealdb≥ 2.0.0-alpha.1 < 2.0.0-alpha.6
1.5.1
1.5.4
2.0.0-alpha.1
2.0.0-alpha.6
4.0.1
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
crates.iosurrealdb
Corregida 1.5.4, 2.0.0 -1 d · 68 d 4.0.1 no afectada
crates.iosurrealdb-core
Corregida 1.5.1 -1 d 4.0.1 no afectada
Versiones corregidas1.5.11.5.42.0.0-alpha.62.0.0
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Otrahttps://github.com/surrealdb/surrealdb/security/advisories/GHSA-gh9f-6xm2-c4j2
Otrahttps://github.com/surrealdb/surrealdb/pull/4335
Otrahttps://github.com/surrealdb/surrealdb/commit/492f8378d57968dbdf5e63fad41b6ff59bba0b80
Otrahttps://github.com/surrealdb/surrealdb

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.