PROBABLYPWNED
VulnerabilitiesApril 25, 20264 min read

Clerk Auth Bypass Lets Attackers Skip Middleware in Next.js Apps

CVE-2026-41248 in Clerk's JavaScript libraries allows crafted requests to bypass authentication middleware. CVSS 9.1—patch your Next.js, Nuxt, and Astro apps now.

Marcus Chen

A critical authentication bypass vulnerability in Clerk's JavaScript libraries lets attackers skip middleware protection and access restricted routes in Next.js, Nuxt, and Astro applications. The flaw, tracked as CVE-2026-41248, carries a CVSS score of 9.1 and was patched on April 15, 2026.

Clerk is a popular authentication provider used by thousands of web applications. The vulnerability in its createRouteMatcher function affects any application that relies on middleware-based route protection—a common pattern in modern JavaScript frameworks. Authentication bypasses like this often serve as entry points for broader attacks—see our guide on social engineering techniques that attackers combine with technical vulnerabilities.

How the Bypass Works

The vulnerability exists in Clerk's createRouteMatcher function, which developers use to define which routes require authentication. When middleware intercepts a request, it passes the route to createRouteMatcher to determine whether the user needs to be authenticated.

Attackers discovered they can craft HTTP requests that trick createRouteMatcher into misidentifying protected routes as public. The exact exploitation technique involves manipulating request properties in a way that causes the route matcher to return a false negative, allowing unauthenticated requests to reach handlers that should be protected.

According to Clerk's disclosure, the issue stems from how the matcher validates incoming request paths. Specially constructed requests can slip through validation checks that would normally block unauthenticated access.

Affected Packages

The vulnerability affects multiple Clerk integrations:

  • @clerk/nextjs: Versions prior to 5.7.6, 6.39.2, and 7.2.1
  • @clerk/nuxt: Versions prior to 1.13.28 and 2.2.2
  • @clerk/astro: Versions prior to 1.5.7, 2.17.10, and 3.0.15
  • @clerk/shared: Versions prior to 2.22.1, 3.47.4, and 4.8.1

Any application using these packages with middleware-based route protection is potentially vulnerable.

Why This Matters

Authentication bypass vulnerabilities in widely-used libraries have outsized impact. Clerk powers authentication for startups and enterprises alike, meaning a single CVE can expose thousands of applications simultaneously.

The middleware protection pattern is especially common in Next.js applications, where developers use Clerk's middleware to gate entire route groups. An application might protect /dashboard/* or /api/admin/* using middleware alone, trusting that Clerk's route matching correctly identifies these as requiring authentication.

This vulnerability breaks that trust. Until patched, attackers could potentially access admin panels, API endpoints, and user data across any application relying solely on Clerk middleware for protection.

Authentication issues in JavaScript frameworks have become a recurring theme. We've seen similar middleware bypass vulnerabilities affect OAuth2-Proxy deployments and other authentication layers in recent weeks. The pattern suggests attackers are actively probing the boundaries between middleware and route handlers.

Patched Versions

Clerk released fixes across all affected packages on April 15, 2026:

PackageFixed Versions
@clerk/nextjs5.7.6, 6.39.2, 7.2.1
@clerk/nuxt1.13.28, 2.2.2
@clerk/astro1.5.7, 2.17.10, 3.0.15
@clerk/shared2.22.1, 3.47.4, 4.8.1

Recommended Actions

  1. Update Clerk packages immediately: Run npm update @clerk/nextjs or equivalent for your package manager
  2. Add server-side auth checks: Don't rely solely on middleware. Call auth() inside route handlers and server components as defense-in-depth
  3. Audit access logs: Review logs for unusual access patterns to protected routes between April 1-15, 2026
  4. Test your routes: Verify that protected routes properly reject unauthenticated requests after updating

Clerk recommends treating middleware as one layer of defense, not the only layer. Even with the patch applied, adding explicit auth() checks in your handlers provides resilience against future middleware-layer vulnerabilities.

Timeline

  • April 13, 2026: Vulnerability reported to Clerk
  • April 15, 2026: Patches released
  • April 15, 2026: Public disclosure

The two-day turnaround from report to patch demonstrates responsive security practices, though the critical severity means organizations should prioritize updates regardless of when they first learn of the issue. Stay current on similar authentication and authorization flaws in our hacking news section.

Related Articles