GHSA-PRPR-5GJ3-QQHG
@better-auth/sso: Four SSO flaws let an attacker sign in as another user
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-PRPR-5GJ3-QQHG divulgada · CVSS 8.1 (GitHub) | |
| Remediación | Parche 1.7.0-beta.10 | @better-auth/sso · 0 d desde divulgación | |
| Divulgación | Modificada | Última actualización del registro | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Am I affected?
You may be affected if you use `@better-auth/sso` 1.6.20 or older, or `1.7.0-beta.0` through `1.7.0-beta.9`, and users or organization admins can register their own SSO providers.
You are affected if all of these are true:
- Self-service SSO registration is on (`providersLimit` is greater than 0).
- You keep the default account linking (you have not set `account.accountLinking.disableImplicitLinking: true`).
- At least one flaw's condition applies: domain verification is on, an SSO provider that had linked accounts was deleted, SAML sign-in uses an identity provider that also serves other apps, or `saml.enableSingleLogout` is on.
You are not affected if users and organization admins cannot register SSO providers (`providersLimit: 0`).
Summary
The SSO plugin can trust a sign-in for an identity it should not trust. Four separate flaws cause this: in domain verification, in deleting SSO providers, in SAML sign-in, and in SAML single logout. Each one lets an attacker sign in as another user, and one upgrade fixes all four.
Impact
An attacker can get a valid session as another user. This is account takeover. In the domain verification, deleted provider, and single logout flaws, the attacker registers their own SSO provider. In the SAML sign-in flaw, the attacker needs no signing key. The victim does not need to act, except in the single logout flaw, where the attacker must lure the victim into triggering the logout. If the victim is an organization owner or admin, the attacker also gets those privileges.
Patches
Upgrade `@better-auth/sso`:
- Stable line: upgrade to `1.6.21` or later.
- 1.7.0 pre-release line: upgrade to `1.7.0-beta.10` or later.
All four flaws are fixed in these versions.
Workarounds
If you cannot upgrade right away, these steps reduce the risk:
- Turn off self-service SSO registration (`providersLimit: 0`). Or require an admin to review each provider's `domain` and identity provider metadata before use.
- Turn off implicit account linking (`account: { accountLinking: { disableImplicitLinking: true } }`). This removes the linking step that the domain verification, deleted provider, and SAML audience flaws rely on.
- Check the `ssoProvider` table for verified rows whose `domain` contains `://`, `/`, `?`, `#`, or a comma. Check the `account` table for rows whose `providerId` has no matching provider. The upgrade stops new orphaned rows, but it does not remove old ones.
- For SAML, prefer pre-validated `defaultSSO` providers. Do not share one identity provider signing certificate across service providers when its assertions are not restricted to one service provider.
- Leave `saml.enableSingleLogout` off (the default) unless you need it.
Technical details
Each flaw needs its own condition, listed with it below. An identity provider (IdP) is the service that signs users in. A service provider is an app that accepts those sign-ins.
Domain verification can trust a domain you do not own. This needs domain verification turned on. Two different parsers read a provider's `domain` value. One parser checks who owns the domain. The other decides which domains to trust at sign-in. A value that mixes a URL, a path, and a comma-separated list can pass the ownership check for the attacker's own domain. At sign-in, the same value also trusts the victim's domain. The attacker's IdP can then claim an identity on the victim's domain, and account linking attaches it to the real user. The fix requires DNS proof for every hostname a provider lists. URL, path, and comma input is now rejected.
Deleting an SSO provider leaves its linked accounts behind. Deleting a provider removes only the provider record. The linked `account` rows stay, and the provider's `providerId` becomes free to register again. A new provider that reuses that `providerId` and points to the attacker's IdP can then sign in to the old linked accounts, because trust is not checked again. Domain verification does not stop this. The fix deletes the linked `account` rows when a provider is deleted.
A SAML assertion is not tied to this service provider. A SAML assertion is the signed message an IdP sends to say who the user is. The SAML sign-in checks the signature, issuer, status, timestamps, and reuse. It does not check `AudienceRestriction`, `Recipient`, or `Destination`, the values that tie an assertion to one service provider. So when one IdP serves many service providers, a signed assertion meant for a different one is accepted. The attacker does not need a signing key. The fix checks the assertion's `Audience` against this service provider before it creates a session.
Cross-site scripting (XSS) on the SAML single logout endpoint. XSS means an attacker's script runs inside your site. This needs `saml.enableSingleLogout: true`. With single logout on, the logout handler builds a form that submits itself. The form's `action` address comes from the provider's registered metadata. The address is HTML-encoded, but its scheme is not checked. A `javascript:` or `data:` address therefore runs script in the auth origin. The endpoint needs no sign-in, skips origin checks, and accepts an unsigned `LogoutRequest` by default. An attacker who registers a provider with such a logout address can steal the session of a victim who is lured into triggering the logout. The fix allows only `http` and `https` addresses in the form `action`.
References
- CWE-287 (Improper Authentication): https://cwe.mitre.org/data/definitions/287.html
- CWE-345 (Insufficient Verification of Data Authenticity): https://cwe.mitre.org/data/definitions/345.html
- CWE-347 (Improper Verification of Cryptographic Signature): https://cwe.mitre.org/data/definitions/347.html
- CWE-459 (Incomplete Cleanup): https://cwe.mitre.org/data/definitions/459.html
- CWE-79 (Cross-site Scripting): https://cwe.mitre.org/data/definitions/79.html
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
npm@better-auth/sso |
Corregida | 1.7.0-beta.10 | 0 d | 1.7.25 no afectada |
1.7.0-beta.10Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/better-auth/better-auth/security/advisories/GHSA-prpr-5gj3-qqhgLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
