GHSA-GX67-694C-655C
TOTP setup in AshAuthentication lets a user install their own authenticator secret on another user's account
CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-GX67-694C-655C divulgada · CVSS 7.6 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Incorrect Authorization vulnerability in team-alembic ash_authentication allows a user with an account to install a TOTP secret they control on another user's account. With that, they can sign in as the victim or hold the victim's second factor.
With `confirm_setup_enabled? true`, TOTP setup takes two actions. `setup` generates a pending secret and returns it to the caller, together with a setup token. `confirm_setup` takes the setup token and a code, and saves the pending secret on the record it is called on. `AshAuthentication.Strategy.Totp.ConfirmSetupChange` checked that the setup token was genuine, but not that it was issued to that record. So an attacker could confirm their own pending secret onto another user's record.
The TOTP setup changes also marked their own changesets as AshAuthentication interactions, which the standard `bypass AshAuthentication.Checks.AshAuthenticationInteraction` policy lets through. As a result, a policy limiting these actions to the actor's own record did not apply when `setup` or `confirm_setup` was called directly. A direct call to `setup` on another user's record returned that user's own pending secret and setup token. In single-step setup, it replaced that user's secret.
With `sign_in_enabled? true`, the installed secret is enough to sign in as the victim using their email address and a code. Without it, the attacker holds the victim's second factor.
Configurations
Reachable when the application exposes the TOTP `setup` or `confirm_setup` action on a record the caller identifies, and the attacker can read the victim's user record. Examples of such exposure are AshJsonApi, AshGraphql, or a controller that passes a user it looked up to `AshAuthentication.Strategy.Totp.Actions.confirm_setup/3`. The routes that AshAuthentication and AshAuthenticationPhoenix provide always use the signed-in user and are not affected.
Workarounds
Do not expose `setup` or `confirm_setup` on a record the caller chooses. Call them through `AshAuthentication.Strategy.Totp.Actions` with the signed-in user instead, as the built-in routes do. When the actions are exposed through AshJsonApi or AshGraphql, a read policy that only lets users read their own record also blocks the attack, because those load the record through it before the action runs.
Patches
Fixed in ash_authentication `5.0.0-rc.16`.
- `confirm_setup` now refuses a setup token whose `sub` claim does not name the record.
- The TOTP setup changes no longer mark their changesets as AshAuthentication interactions. `AshAuthentication.Strategy.Totp.Actions` still does, for the record it is given, so direct calls to the actions now follow the resource's policies. Applications that call these actions directly and relied on the bypass need a policy that permits the actor.
- The same token check was added to `AshAuthentication.Strategy.Password.ResetTokenValidation`.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Hexash_authentication |
Corregida | 5.0.0-rc.16 | — | — |
5.0.0-rc.16Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/team-alembic/ash_authentication/security/advisories/GHSA-gx67-694c-655cLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
