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.
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:
| Package | Fixed Versions |
|---|---|
| @clerk/nextjs | 5.7.6, 6.39.2, 7.2.1 |
| @clerk/nuxt | 1.13.28, 2.2.2 |
| @clerk/astro | 1.5.7, 2.17.10, 3.0.15 |
| @clerk/shared | 2.22.1, 3.47.4, 4.8.1 |
Recommended Actions
- Update Clerk packages immediately: Run
npm update @clerk/nextjsor equivalent for your package manager - Add server-side auth checks: Don't rely solely on middleware. Call
auth()inside route handlers and server components as defense-in-depth - Audit access logs: Review logs for unusual access patterns to protected routes between April 1-15, 2026
- 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
Cisco Webex SSO Flaw Let Attackers Impersonate Any User
CVE-2026-20184 (CVSS 9.8) in Cisco Webex Services allowed unauthenticated attackers to impersonate any user through SSO certificate validation bypass. Cloud service already patched.
Apr 22, 2026OAuth2 Proxy Auth Bypass Lets Attackers Access Protected Routes
CVE-2026-40575 (CVSS 9.1) allows unauthenticated attackers to bypass OAuth2 Proxy authentication via X-Forwarded-Uri header spoofing. Patch to v7.15.2 immediately.
Apr 22, 2026FortiSandbox Auth Bypass and RCE Flaws Score CVSS 9.1
Fortinet patches two critical FortiSandbox vulnerabilities allowing unauthenticated attackers to bypass authentication and execute code. Upgrade to 4.4.9 or 5.0.6 immediately.
Apr 18, 2026Nginx-UI Auth Bypass Under Active Exploit — 2,600 Servers at Risk
CVE-2026-33032 lets attackers take full control of nginx-ui servers without credentials. Threat actors are exploiting it now. Upgrade to 2.3.4 immediately.
Apr 16, 2026