---
title: "better-auth 1.7.16 fixes 12 flaws: who is exposed, and what to do?"
description: "better-auth 1.7.16 fixes 12 flaws. The critical one only hits servers that register the expo() plugin, Electron plugin users must rotate their secrets, and web-only apps should still read the moderate list."
url: https://ihsanalapsi.dev/articles/better-auth-1-7-16-security-release
lang: en
date: 2026-11-09
updated: 2026-11-09
tags: ["Security updates", "App security", "Web development"]
author: Ihsan Alapsi (إحسان العبسي)
---
# better-auth 1.7.16 fixes 12 flaws: who is exposed, and what to do?

If your app uses better-auth, one release just fixed 12 flaws at once, and not all of them touch you. The critical one needs a specific plugin registered on the server, and both high ones need plugins too, so the first question is what sits in your `plugins` array. By the end of this article you will know whether upgrading is enough, or whether you also need to rotate secrets.

## What does better-auth 1.7.16 fix?

better-auth 1.7.16 fixes 12 flaws whose advisories went out on November 3, 2026: one critical, two high, eight moderate and one low. On the beta line, the fix is in 1.8.0-beta.5.

The count and the split come from [Vercel's bulletin on the release](https://vercel.com/kb/bulletin/better-auth-november-2026-security-release). That is a hosting company writing about a library it does not own, so every detail below comes from the project's own advisories on GitHub. The bulletin does add two things you should know. First, the `@better-auth/*` packages (such as expo, electron, passkey and stripe) ship with the same version numbers as better-auth, so you upgrade them together. Second, Vercel deployed WAF rules for the projects it hosts, and it says plainly: "do not rely on the WAF for full protection".

Here is where you stand:


| If you have             | Severity         | What to do                                              |
| ----------------------- | ---------------- | ------------------------------------------------------- |
| The `expo()` plugin     | Critical         | Upgrade, then rotate the secret                         |
| The `electron()` plugin | High             | Upgrade, then rotate the secret and every client secret |
| The phone number plugin | High             | Upgrade, then clear numbers that were never verified    |
| None of these           | Moderate and low | Upgrade, then read the moderate table below             |


## Who is exposed to the critical Expo flaw?

The critical Expo flaw only affects servers that register the `expo()` plugin from @better-auth/expo, version 1.4.0-beta.6 or later. An unauthenticated attacker who knows a user's email can sign in as that user and change the account's email, with no action from the user.

According to [advisory GHSA-4wq4-2ppv-q3hg](https://github.com/better-auth/better-auth/security/advisories/GHSA-4wq4-2ppv-q3hg), it scores 9.1 on CVSS 3.1. The plugin exposed a public endpoint, `/expo-authorization-proxy`, that signed any value the caller sent with the application secret and returned it in a cookie. The same secret signs email verification links and the session cookie cache. So the attacker gets a real signature on a value of their choosing, and with the session cookie cache enabled, knowing the user's ID is enough.

Like the [Magic Link flaw we wrote about before](/articles/better-auth-magic-link-takeover), the attacker here again needs nothing but the victim's email.

The advisory lists two more problems in the same plugin. The endpoint could redirect visitors to outside HTTPS sites, which helps with convincing phishing links. And a wildcard `trustedOrigins` entry such as `myapp://*` could match URLs outside its intended scheme, host or path.

Affected versions: @better-auth/expo from 1.4.0-beta.6 up to, not including, 1.7.16, and from 1.8.0-beta.0 up to, not including, 1.8.0-beta.5, plus better-auth below 1.7.16.

### If the plugin is registered

1. Upgrade both @better-auth/expo and better-auth to 1.7.16 or later.
2. Rotate the application secret after upgrading if the endpoint was reachable. The advisory says signatures issued before the fix stay valid until the secret changes. The secret is the `secret` option in your config, and when that is not set, better-auth reads `BETTER_AUTH_SECRET` or `AUTH_SECRET`, according to the [better-auth options reference](https://www.better-auth.com/docs/reference/options).
3. If Expo sign-in through an SSO provider fails after the upgrade, add that provider's origin to `trustedOrigins`.

### What if you can't upgrade today?

If you don't use Expo social sign-in, the advisory says to remove the `expo()` server plugin. If you do use it, block requests to `/expo-authorization-proxy` (under your auth base path) whose `authorizationURL` carries a `state` value that is not exactly 32 characters from `A-Z`, `a-z`, `0-9`, `-` and `_`. That is the form better-auth always issues. This workaround only blocks the signing problem, not the redirect or the wildcard match.

## Why do Electron plugin users need to rotate their secrets?

The @better-auth/electron plugin let any user who can sign in read the auth secret and the client secrets of your social sign-in providers. Upgrading closes the hole, but it does not undo what was already read.

According to [advisory GHSA-9p5w-h4pr-fcrc](https://github.com/better-auth/better-auth/security/advisories/GHSA-9p5w-h4pr-fcrc), it is rated high, 8.1, and the affected versions run from 1.5.0-beta.12 up to, not including, 1.7.16, and from 1.8.0-beta.0 up to, not including, 1.8.0-beta.5. A normal sign-in could return the server's internal auth context, with the secret inside. With that secret, an attacker can get a session as any user whose email they know, and the victim does nothing.

The same advisory covers a second problem: a password sign-in could create a desktop sign-in code before the second factor was checked, and that code could be exchanged for a full session. So anyone who knows a user's password could skip two-factor.

The advisory says that if the plugin has been running, you should treat the auth secret and every social provider client secret as disclosed, and rotate them. You change the secret in your config, and each client secret in that provider's own console. If other secrets live in the same place, put them in order the way we explained in [the Railway breach and which secrets to rotate first](/articles/railway-breach-env-vars-rotate-secrets).

Until you upgrade, the workaround that closes both problems is removing the `electron()` plugin, which turns off desktop sign-in. Placing `twoFactor()` before `electron()` blocks the two-factor path on recent releases, but the secret problem stays.

## What is the phone number problem in better-auth?

The phone number plugin could save a number on an account before its owner proved control of it. So an attacker saves the victim's number on an account the attacker controls, and when the victim signs in with a valid OTP, they land in the attacker's account.

According to [advisory GHSA-q747-mqgr-4gh7](https://github.com/better-auth/better-auth/security/advisories/GHSA-q747-mqgr-4gh7), it is rated high, 8.1, and it affects the phone number plugin from 0.4.12-beta.7. The attacker does not get into the victim's own account, but whatever the victim enters after signing in can reach the attacker. There is a second problem too: phone verification codes shared storage with other codes, so someone who can predict a pending code's record identifier can cancel it again and again, and keep its owner from signing in or recovering the account.

After upgrading to 1.7.16, the advisory asks you to clear numbers that were saved before the upgrade and never verified. Users who had not finished verification add their number again. The advisory's PostgreSQL example follows; if your table or column names differ, change them:

```sql
UPDATE "user" SET "phoneNumber" = NULL
WHERE "phoneNumber" IS NOT NULL AND "phoneNumberVerified" IS NOT TRUE;
```

On 1.8.0-beta.5, the fix requires proof of account ownership before any pending number is verified, including numbers saved before the upgrade.

## My app is web-only. Which moderate flaws matter to me?

Even without Expo, Electron or phone numbers, several moderate flaws touch ordinary web setups: OAuth sign-in, session revocation with the cookie cache, email changes and Email OTP codes.

All of them are fixed in 1.7.16:


| Flaw                                                                                                                                                  | Affects you if                                                                                                                                                                                                                              |
| ----------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Revoked sessions can stay valid](https://github.com/better-auth/better-auth/security/advisories/GHSA-fvxx-76fc-893x)                                 | You use `secondaryStorage`, or `session.cookieCache` together with passkey registration, device authorization or passwordless two-factor enrollment                                                                                         |
| [OAuth can treat an unverified email as verified](https://github.com/better-auth/better-auth/security/advisories/GHSA-9hm7-xhfp-cx58)                 | A provider sends `email_verified` as a string (Amazon Cognito is one example), or you use `genericOAuth()` with a provider that has a JWKS endpoint, or Zoom with `disableSignUp`, `requireEmailVerification` or `overrideUserInfoOnSignIn` |
| [Email-change links stay valid after the address changes hands](https://github.com/better-auth/better-auth/security/advisories/GHSA-hwq2-v29r-p69r)   | `user.changeEmail.enabled` is on with `emailVerification.sendVerificationEmail`, and a new user can register an address its previous owner moved away from                                                                                  |
| [Email OTP attempt limit can be raced](https://github.com/better-auth/better-auth/security/advisories/GHSA-2f9c-7xj7-gh55)                            | You use the `emailOTP()` plugin                                                                                                                                                                                                             |
| [MySQL can return another request's record](https://github.com/better-auth/better-auth/security/advisories/GHSA-48c2-w96j-mv3m)                       | MySQL or MariaDB with `generateId: "serial"`, and the default Kysely adapter or Drizzle with a connection pool                                                                                                                              |
| [A role with user:update can change another user's phone number](https://github.com/better-auth/better-auth/security/advisories/GHSA-g95c-wqvr-8c3j)  | You use the admin and phone number plugins, and a role other than the full admin holds `user:update`                                                                                                                                        |
| [Organization admins can invite an owner with a padded role name](https://github.com/better-auth/better-auth/security/advisories/GHSA-c85h-5mrr-mgx4) | You use the organization plugin, and a role other than the creator role can invite, which the default roles allow                                                                                                                           |
| [Stripe billing actions can target another customer](https://github.com/better-auth/better-auth/security/advisories/GHSA-x8j7-xh58-rv6x)              | The `stripe()` plugin is registered; the billing effects need `subscription.enabled: true`                                                                                                                                                  |
| [Passkey checks skip origin and user verification](https://github.com/better-auth/better-auth/security/advisories/GHSA-gv75-j3v8-3crm) (the low one)  | `userVerification` is set to `"required"`, or your relying party ID covers origins you do not control                                                                                                                                       |


The upgrade does not fix what was written before it, so four of them need work from you afterwards:

- For Stripe, look for any customer ID linked to more than one user, and compare it with the Stripe customer's `metadata.userId`. Repeat the check on `organization` if organization billing is on.
- For organizations, audit invitations and memberships whose role value changes when trimmed, and don't trim them in place, because that can turn a member into a real owner. Review any owners those members invited.
- If you have custom admin permissions, add `set-phone` to your statements and grant `user:set-phone` only to roles that should change phone numbers. The default admin role already has it.
- For Email OTP, email-change codes issued before the upgrade no longer work, and users request a new one.

If revocation has to take effect immediately and you can't upgrade today, the sessions advisory suggests turning off `session.cookieCache`.

## Where do you start now?

Start with what is registered in your `plugins` array, because that decides whether upgrading is enough or you also need to rotate secrets.

1. Check the versions installed in your project:
   ```bash
   npm ls better-auth @better-auth/expo @better-auth/electron @better-auth/passkey @better-auth/stripe
   ```
2. Search your code for the registered plugins:
   ```bash
   grep -rnE "expo\(|electron\(|phoneNumber|emailOTP\(|stripe\(" --include=*.ts --exclude-dir=node_modules .
   ```
3. Upgrade better-auth and every `@better-auth/*` package you use to 1.7.16 or later, all to the same version:
   ```bash
   npm install better-auth@latest @better-auth/expo@latest
   ```

   On the beta line the version is 1.8.0-beta.5. Read [its release notes](https://github.com/better-auth/better-auth/releases/tag/v1.8.0-beta.5) first, because they include breaking changes: sign-up and sign-in now reject `phoneNumber`, and Electron desktop sign-in completes only after two-factor verification.
4. If `expo()` was registered, rotate the secret after upgrading. If `electron()` was running, rotate the secret and every client secret.
5. If the phone number plugin is on and you are on 1.7.16, run the cleanup statement above.
6. Deploy, then try sign-up and sign-in with every method you offer.

If your app is built on Next.js, there is also the [Next.js November security release](/articles/nextjs-16-4-5-security-release) to check. And if you want someone to test your platform's sign-in flow the way an attacker would, that is what [Muhassan](/muhassan) does.

Which plugins are in your `plugins` array right now?

## FAQ

**If my app runs on Vercel, does the WAF protect me?**

Not fully. Vercel's bulletin says it deployed WAF rules for every project it hosts at no cost, but it also says not to rely on the WAF for full protection: it cannot invalidate signatures forged before the rules, and it cannot block logic flaws such as session revocation. The upgrade is the fix.

**Has anyone exploited these flaws?**

Nothing is published. None of the 12 advisories mentions exploitation, and Vercel's bulletin does not say either way. That does not prove it never happened, so if the Expo or Electron conditions match your app, rotate the secret even if you saw nothing odd.

**The expo() plugin is registered but I don't use Expo sign-in. Am I affected?**

Yes. The advisory's condition is that the server registers the plugin, not that you use it. If you don't use Expo social sign-in, the same advisory says to remove the plugin from the server.

**Do I need to move every @better-auth package to the same version?**

Yes. According to Vercel's bulletin, the @better-auth/* packages ship with the same version numbers as better-auth, and the Expo advisory itself asks you to upgrade both @better-auth/expo and better-auth.

**If I use none of these plugins, is upgrading enough?**

Usually yes, but read the moderate table first. Four of them need work after the upgrade: Stripe customer links, organization roles, the set-phone permission for custom roles, and old email-change codes.
