GHSA-CRC8-Q4HM-4564
Third-party application with only the openid scope can set an initial password on a passwordless, email-less, phone-less account, enabling account takeover
Texto original en inglés · Ver en español
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-CRC8-Q4HM-4564 divulgada · CVSS 7.3 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
A third-party OIDC application holding an access token with only the `openid` scope could set an initial password on a Logto user account that had no password, no primary email, and no primary phone — without a `logto-verification-id` header or any other security verification.
`POST /api/my-account/password` deliberately skips the verification-record requirement when the account has no existing credential to verify against, so that a social-only or SSO-only user can establish a first password. The exception was correct for its intended caller, the first-party Account Center. But nothing on the route distinguished a first-party caller from a third-party one:
- `koaOidcAuth` gates the whole user router on the `openid` scope alone, and `openid` is unconditionally part of every third-party client's scopes.
- This route has no claim-scope check at all — it is the one Account API route where the scope column is empty. Not even `profile` or `email` is required.
The result is that a plain `openid` authorization, the minimum any OIDC client asks for and the one users are least likely to scrutinize on the consent screen, carried a latent credential-enrollment capability. Once the password exists the exception closes and further changes require verification, so the window is one-shot — but one shot is enough, because the attacker chooses the password and can then sign in directly as the user through the normal username/password flow.
Preconditions
This is not exploitable against a default installation, and it is not a consent bypass or an unauthenticated issue. All of the following must hold:
- Account Center is enabled for the tenant. It ships disabled — `account_centers.enabled` is seeded `false` for every non-admin tenant. While it is off, every Account API route returns `400 account_center.not_enabled` regardless of the caller.
- The `password` field is set to `Edit` in the Account Center field controls. Field controls are seeded empty, so this defaults to off and an admin has to switch it on.
- The tenant admin registered the attacker's application as a third-party application in the tenant.
- The end user completed the consent screen for that application.
- The victim account has no password, no primary email, and no primary phone — the eligibility condition for the initial-password exception. In practice this means a pure social or enterprise-SSO user who has never set a password or verified a contact identifier. Every other account is protected: the same request against an account with any one of those returns `401 verification_record.permission_denied`.
Condition 5 is the real limiter. The affected population is a specific and usually small subset of a tenant's users, and it shrinks over time as users add identifiers.
Impact
Full account takeover of an eligible user, by an application the user authorized for `openid` only.
The attacker plants a known password on the victim's account, then authenticates as that user through the ordinary username/password sign-in flow — outside the third-party application, with none of the scope restrictions that applied to the original token, and persisting after the user revokes the application's consent.
Reproduced end to end by the reporter on a local deployment of `@logto/core` 1.42.0: `POST /api/my-account/password` with only the third-party Bearer token, no cookies and no verification-record header, returned `204`; the password was persisted and accepted in a fresh username/password login; the same request repeated afterwards returned `401 verification_record.permission_denied`, confirming the exception had closed. No database modification was used to create the vulnerable precondition — the eligible user was produced through a normal social sign-up flow.
Related surface fixed in the same patch
While fixing the reported route, we audited the rest of the Account API and Verification API and found the same first-party assumption throughout: the per-route authorization reuses OIDC claim scopes as write permissions. An admin who enables `email` for a third-party application is told the application reads the user's email address, and the user consents to *"Your email address"*; neither is told it can replace the primary email. The patch therefore guards every route that changes account data or mints a verification record, not just the reported one.
Those other routes are a lesser concern than the reported issue and mostly required more than a bare `openid` token — either the corresponding claim scope, or a verification record that a third-party application cannot mint on its own, or both. The main ones reachable with a consented claim scope and no verification record were the profile writes (`PATCH /api/my-account`, including the `customData` blob, and `PATCH /api/my-account/profile`) and the avatar upload.
Patch
Fixed in https://github.com/logto-io/logto/pull/9430.
The patch adds `assertFirstPartyClient`, called alongside the existing authorization on every route that changes account data or mints a verification record — 24 call sites across the Account API and Verification API. Third-party applications receive `403 auth.third_party_application_forbidden`. The check fails closed: a client identifier that does not resolve to a registered application, including a client identifier metadata document (CIMD) URL, is treated as third-party.
Read routes are unguarded and continue to work. Three reads become unreachable for third-party applications as a consequence, because they require a verification record that only a now-guarded route can mint: `GET /api/my-account/grants`, `GET /api/my-account/sessions`, and `GET /api/my-account/mfa-verifications/backup-codes`.
This is a breaking change for any third-party application that was calling the guarded routes, and there is intentionally no configuration to re-enable the old behavior.
Workarounds
For anyone who cannot upgrade immediately, any one of these closes the reported issue:
- Set the Account Center `password` field to `Off` or `Read only` rather than `Edit`, or disable Account Center entirely.
- Ensure users have at least one of a password, a verified primary email, or a verified primary phone — accounts outside that shape are not eligible for the initial-password exception.
- Review the third-party applications registered in the tenant, and remove any that are not trusted.
To check whether the issue was exploited, look for `User.Data.Updated` hook events or audit log entries for password changes originating from a third-party client ID.
Credits
Reported by Jaejun Cho, who provided a complete reproduction and a proposed severity assessment.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
npm@logto/core |
Sin parche | — | — | — |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/logto-io/logto/security/advisories/GHSA-crc8-q4hm-4564Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
