Intel

AIKIDO-2026-771807

better-auth is vulnerable to Improper Authentication

Pre-CVE
Found by Aikido Intel before public disclosure or CVE publication.
Published Jun 19, 2026
June 19, 2026

53

CVE Score

Medium

Improper Authentication

Are you affected? Scan for Free

TL;DR

The getSessionCookie helper reads session tokens from incoming request cookies for middleware and integrations. When both a non-secure and a __Secure- prefixed session cookie were present, the helper preferred the non-secure value and could return a stale leftover token instead of the current secure session. Applications relying on getSessionCookie could therefore treat an outdated session as active after HTTPS or secure-cookie rollout. The fix prefers the __Secure- prefixed cookie and only falls back to the non-secure name when the secure value is absent.

How do I fix this?

Upgrade the better-auth library to the patch version.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and your deployment can send both a non-secure and a __Secure- prefixed session cookie in the same request.

Versions

1.2.5 - 1.6.13

Fixed in 1.6.14

Background info

better-auth is vulnerable to Improper Authentication in versions 1.2.5 - 1.6.13.

Get secure today,
quickly and for free.

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.

Trusted by 150k+ orgs
  • Revolut
  • n8n
  • Lovable
  • Deel
  • Prove
  • Omnea