Incorrect Behavior Order: Validate Before Canonicalize Affecting better-auth package, versions >=1.5.5 <1.7.16>=1.8.0-beta.0 <1.8.0-beta.5


Severity

Recommended
0.0
medium
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.45% (42nd percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-JS-BETTERAUTH-23050700
  • published30 Nov 2026
  • disclosed21 Nov 2026
  • creditiabdullah215, 0xaudron

Introduced: 21 Nov 2026

NewCVE-2026-134318  (opens in a new tab)
CWE-180  (opens in a new tab)

How to fix?

Upgrade better-auth to version 1.7.16, 1.8.0-beta.5 or higher.

Overview

better-auth is a The most comprehensive authentication library for TypeScript.

Affected versions of this package are vulnerable to Incorrect Behavior Order: Validate Before Canonicalize via inconsistent whitespace handling in the organization plugin's invitation role validation. The creator role check compares the raw invitation role string, while later checks split and trim it. An admin or other non-creator role that can invite members can submit a padded role value such as " owner" that passes the creator role guard and resolves to owner upon acceptance, allowing the newly elevated account to delete the organization and remove the original owners.

Note: This is only exploitable if a role other than the creator role (by default, owner) has permission to create invitations - with default roles, organization admins can.

Workaround

Remove the invite permission from every role except the creator role, or reject invitation roles with leading or trailing whitespace before they reach the library. Audit existing invitations and memberships for role values that change when trimmed - do not trim them in place, as trimming a value like admin, owner would grant real owner access. Review owners invited by any such members.

References

CVSS Base Scores

version 4.0
version 3.1