Summary
Certain authorization helpers in Clerk JavaScript, including has() and auth.protect(), can incorrectly return true for combined authorization checks that should evaluate to false.
When reverification or billing checks are combined with role, permission, feature, or plan checks, a gated action may proceed for users who do not fully satisfy the intended authorization conditions.
Affected context
This vulnerability appears in applications that rely on Clerk's JavaScript and related framework SDKs (@clerk/shared, @clerk/nextjs, @clerk/backend, and others) to enforce fine-grained access control.
It is relevant where developers use has(), auth.protect(), or similar predicates to gate actions or routes using combined conditions such as reverification plus role/permission, or billing (feature/plan) plus role/permission.
The issue manifests when application logic assumes that all specified conditions must be satisfied but the underlying predicate logic may incorrectly treat certain combined checks as passing.
Exploit preconditions
- Attack surface: Application endpoints, API routes, web pages, or actions protected via Clerk's authorization helpers (has(), auth.protect(), or related predicates).
- Required access: An attacker must have (or be able to create) a Clerk user account or session that satisfies some but not all of the combined conditions (for example, a user with a valid subscription but without the required role, or a user with the right role but without the required reverification state).
- Trigger point: Invocation of has(), auth.protect(), or equivalent checks in a call pattern that:
- Combines a reverification requirement with any of: role, permission, feature, or plan; or
- Combines a billing check (feature or plan) with a role or permission check.
- Why exploitation is possible: Due to a logic flaw in the way combined predicates are evaluated, the helper can return true when not all requested conditions are satisfied, effectively relaxing the intended authorization policy.
Why this happens
The core issue is an authorization logic error where combined access-control predicates are not evaluated in a strictly conjunctive manner, or where certain state dimensions (reverification, billing, role, permission, feature, plan) are incorrectly short-circuited or aggregated.
Instead of enforcing "all of these conditions must hold," the implementation can, in specific call shapes, treat partial satisfaction as sufficient and return a positive authorization result.
This maps to CWE-863 (Incorrect Authorization) because the system grants access to resources without confirming that the caller meets every required security condition.
It also aligns with CWE-754 (Improper Check for Unusual or Exceptional Conditions), as the specific combined patterns (reverification + role/permission/feature/plan, or billing + role/permission) represent edge cases in which the authorization logic fails to handle the complexity of multiple overlapping checks.
Conceptually, the insecure pattern is: "composing multiple authorization checks without rigorously defining and testing their combined semantics," leading to unexpected, overly permissive decisions.
Potential impact
- Users who lack required roles or permissions may access routes or actions reserved for higher-privilege users.
- Users who have not passed required reverification steps may perform sensitive operations that should require fresh verification.
- Users without appropriate billing status (feature/plan) may access paid or premium functionality.
- Access-control boundaries between subscription tiers, feature sets, or administrative roles may be weakened.
- Business logic relying on strict billing and role checks can be bypassed, potentially impacting revenue protection or data confidentiality.
General mitigation guidance
Effective mitigation centers on hardening authorization composition and minimizing reliance on complex, implicit predicate semantics.
Conceptual defensive patterns include:
- Enforce explicit conjunction of conditions: Treat each authorization requirement (role, permission, reverification, billing, feature, plan) as a separate boolean and explicitly combine them with logical AND in application code, rather than relying on opaque combined helper semantics.
- Separate concerns for clarity: Implement separate checks for identity/session validity, reverification state, roles/permissions, and billing/entitlements, then clearly define which combinations are required for each endpoint.
- Fail closed on ambiguous states: Design authorization flows so that any ambiguous or partially satisfied condition (for example, missing reverification, unclear billing status) results in denial of access.
- Centralize authorization policies: Use a consistent policy layer or utility module that encodes access rules in one place, minimizing ad hoc predicate combinations scattered across the codebase.
- Apply least-privilege defaults: Default routes and actions to "no access" until all relevant predicates explicitly confirm authorization, and avoid "allow unless denied" patterns.
- Document supported call shapes: For any authorization helper, maintain internal documentation on safe and supported usage patterns so developers avoid ambiguous or previously problematic combinations.
How teams detect issues like this
Detection typically involves scrutinizing how authorization helpers are used and validating that combined conditions behave as intended.
High-level approaches:
- Static analysis and code search:
- Search for calls to has(), auth.protect(), and related predicates where multiple conditions (e.g., role + plan, permission + feature, reverification + role/permission/feature/plan) are passed in a single expression.
- Flag patterns where billing/feature checks are bundled together with role or permission checks as candidates for review.
- Targeted code review:
- Review all authorization-gated endpoints to confirm that every stated requirement is enforced independently or through well-defined compositional logic.
- Pay particular attention to routes handling sensitive operations (administrative actions, billing changes, data exports) that rely on combined predicate checks.
- Policy-driven tests and access-control matrices:
- Maintain an access-control matrix describing expected permissions by role, plan, feature, and reverification state, then derive automated tests that validate these combinations against the code.
- Use negative tests (users who should not pass) to catch cases where combined predicates mistakenly authorize access.
- Instrumented runtime checks:
- Add telemetry or logging when authorization predicates evaluate to true, including which conditions were satisfied; analyze logs for suspicious authorizations that conflict with documented policies.
- Automated review tools:
- Integrate linters or custom rules in CI that flag complex or multi-argument authorization predicates for mandatory human review, aiding in early detection of misconfigured conditions.

