Summary
Nuxt suffers from a route-rule middleware bypass caused by case-sensitivity mismatches between vue-router and the internal routeRules matcher.
Under certain URL casing patterns, security or logic middleware configured via route rules may not execute as intended, allowing attackers to reach routes that should be protected.
Affected context
This vulnerability affects Nuxt applications built with:
- Nuxt 3.11.0 to before 3.21.7, and
- Nuxt 4.0.0 to before 4.4.7.
It is relevant where applications rely on routeRules-based middleware for authentication, authorization, or other security-sensitive checks.
The issue appears when URLs are matched differently by vue-router (with one case-sensitivity behavior) and by the routeRules matcher (with another), creating edge cases where middleware is skipped for certain path casing variants.
Exploit preconditions
- Attack surface: Public HTTP endpoints exposed by a Nuxt application.
- Required access: Network access to the affected Nuxt app; no prior authentication is strictly required if the target route is intended to be protected only by route-rule middleware.
- Trigger point: Crafting requests to routes using alternate letter casing or path variants that confuse the routeRules matcher while still resolving via vue-router.
- Why exploitation is possible: The framework uses two different matching behaviors—vue-router and routeRules—with inconsistent case sensitivity, allowing route resolution without triggering the intended route-rule middleware.
Why this happens
The core issue is inconsistent case handling between the vue-router path resolution and the Nuxt routeRules matcher.
Routes may be considered equivalent by vue-router but not by the routeRules system, or vice versa, due to different assumptions around case sensitivity and normalization.
This maps to:
- CWE-178: Improper Handling of Case Sensitivity, where security decisions depend on string comparisons that do not consistently normalize case.
- CWE-863: Incorrect Authorization, because the authorization logic (middleware executed via route rules) can be bypassed when the framework treats differently cased URLs inconsistently.
Conceptually, the bug reflects a general pattern where access control enforcement relies on multiple components that interpret identifiers (like URLs) differently.
Potential impact
- Attackers could bypass authentication middleware on routes that rely solely on routeRules for protection.
- Sensitive endpoints may be accessible without the expected authorization checks.
- Rate limiting, logging, or request validation middleware could be skipped for certain URL variants.
- Security assumptions about "protected routes" may be invalid, leading to data exposure or unintended actions.
General mitigation guidance
Mitigation generally focuses on aligning routing and authorization behavior and avoiding ambiguity in path handling:
- Prefer centralized, path-agnostic authorization checks (e.g., global guards or server-side middleware) rather than relying exclusively on per-route case-sensitive rules.
- Normalize and canonicalize request paths (e.g., to a consistent case or format) before applying security decisions when designing custom routing logic.
- Avoid having security posture differ based only on path case; treat URLs case-insensitively in access control design or document and enforce a strict, single canonical form.
- Apply defense-in-depth by performing critical authorization checks closer to the data or business action, not only in frontend router middleware.
- Restrict exposure of sensitive functionality by combining route middleware with server-side checks, ensuring that bypassing client-side or edge routing logic is not sufficient.
How teams detect issues like this
Useful detection strategies include:
- Code review patterns: Look for heavy reliance on Nuxt routeRules or case-sensitive route-based middleware to enforce authentication and authorization. Flag routes where the only protection is a route-rule middleware attached by path string.
- Static analysis and configuration linting: Enforce policies that disallow or warn on multiple route definitions or security rules that differ only in path case; identify routeRules that protect high-value actions.
- Dynamic testing and fuzzing: Perform automated scans that request protected routes using different casing (e.g.,
/Admin,/ADMIN, mixed case) and observe whether middleware or auth flows are triggered consistently. - Logging and monitoring: Instrument logs to include both the original request path and the route identifier used for authorization decisions; discrepancies or unusual casing patterns can indicate bypass attempts.
- Automated CI tools and framework-aware security scanners can be configured to check for inconsistent routing or case-handling behaviors as part of regular testing.

