GHSA-X8J7-XH58-RV6X
@better-auth/stripe: Billing actions can target another customer's Stripe account
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:H/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-X8J7-XH58-RV6X divulgada · CVSS 5.9 (GitHub) | |
| Remediación | Parche 1.7.16 | @better-auth/stripe · 0 d desde divulgación | |
| Remediación | Parche 1.8.0-beta.5 | @better-auth/stripe · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Am I affected?
You are affected if you register the `stripe()` plugin from `@better-auth/stripe` 1.2.0-beta.18 or later. The billing effects need `subscription.enabled: true`.
Summary
The Stripe plugin stores each user's Stripe customer ID on the user record. That field accepted values from sign-up and profile update requests, so a user could replace their own customer ID with another customer's. The billing portal, checkout, and webhook handling then treated that customer as theirs.
Impact
A signed-in user who knows another customer's Stripe ID can open the billing portal for that customer. There they can see invoices and billing details, change payment methods, and cancel or change subscriptions. A subscription created for that customer outside checkout could also be attributed to the attacker. The flaw does not sign anyone in as another user or expose Stripe API keys.
Patches
Upgrade `@better-auth/stripe` to 1.7.16, or to 1.8.0-beta.5 on the beta line.
Customer IDs and the subscription fields the plugin manages can no longer be set from sign-up or update-user requests, including server calls such as `auth.api.updateUser`. Write them through your database adapter instead.
The upgrade does not change values written before it. Check for customer IDs held by more than one user (see Workarounds).
Workarounds
Add `databaseHooks.user.create.before` and `databaseHooks.user.update.before` hooks that remove `stripeCustomerId` from incoming data.
To find values written before the fix, look for customer IDs held by more than one user. For example, on PostgreSQL with the default schema names:
SELECT "stripeCustomerId", array_agg("id") AS user_ids
FROM "user"
WHERE "stripeCustomerId" IS NOT NULL
GROUP BY "stripeCustomerId"
HAVING count(*) > 1;Compare each row with the Stripe customer's `metadata.userId`. Run the same check on `organization` if organization billing is enabled.
Technical details
`stripeCustomerId` had no `input: false`, so the generic user routes accepted it. The billing routes now also take the customer type from the authorized reference instead of the request body. When several records share a customer ID, the `customer.subscription.created` webhook now attributes the subscription to the owner recorded on the Stripe customer, and skips it with a warning when no recorded owner holds the ID.
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/stripe |
Corregida | 1.7.16, 1.8.0-beta.5 | 0 d · 0 d | 1.7.25 no afectada |
1.7.161.8.0-beta.5Arsenal 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-x8j7-xh58-rv6xLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
