better-auth is vulnerable to Improper Authentication
91
CVE Score
Critical
Improper Authentication
Affected versions of this package are vulnerable to authentication bypass when the expo() plugin from @better-auth/expo is registered. The plugin's public /expo-authorization-proxy endpoint reads the state value from a caller-supplied authorizationURL, and signs it with the application secret (HMAC-SHA256) without checking that the server issued it, returning the signature in a cookie. Because the same secret and computation are used for HS256 JSON Web Tokens (email verification and email-change links) and for the session cookie cache, an unauthenticated attacker can forge valid tokens: knowing only a victim's email address they can sign in as that user and change the account's email address, and with the session cookie cache enabled, knowing a user's ID is enough to act as that user. The same endpoint also acts as an open redirect to any external HTTPS site, and wildcard trustedOrigins entries (e.g. myapp://*) could match URLs outside the intended scheme, host, or path. The fix signs only unexpired state values issued by the server, redirects only to the authorization endpoint origin of a configured provider, and matches wildcard trusted origins by parsed scheme, host, and path.
Upgrade the better-auth library to the patch version, and upgrade @better-auth/expo to the same version. Rotate the application secret afterwards, since signatures issued before the fix remain valid until the secret changes. If Expo sign-in through an SSO identity provider fails after upgrading, add the identity provider's origin to trustedOrigins.
You are affected if you are using a version that falls within the vulnerable range and your server registers the expo() plugin from @better-auth/expo 1.4.0 or later. The wildcard trusted origin issue additionally requires a wildcard entry in trustedOrigins.
0.0.1 - 1.7.15
Fixed in 1.7.16better-auth is vulnerable to Improper Authentication in versions 0.0.1 - 1.7.15.
Secure your code, cloud, and runtime in one central system. Connect a repo to discover what the reasoning agents find in your codebase.
No credit card required | Scan results in 32 seconds.
I consent to receiving marketing communications based on Aikido’s Privacy Policy.
SOC 2Compliant
ISO 27001Compliant
ISO 42001Compliant© All Intel data is openly available and commercially licensed.