Summary
A flaw in Traefik's StripPrefix middleware allows crafted paths containing .. or its encoded form to slip past route-level authentication and authorization.
When a public router uses StripPrefix on PathPrefix rules, the request can be routed as public, then normalized to a protected path, enabling unauthenticated access to backend admin or internal endpoints.
Affected context
This vulnerability appears when Traefik is configured with:
- At least one public router that matches requests using a
PathPrefixrule and applies the StripPrefix middleware, and - One or more protected routers (for admin, internal, or configuration endpoints) that rely on route-level authentication or authorization middleware.
The risk is present when these routers ultimately serve paths under a common backend hierarchy, such that prefix stripping and path normalization can cause a request initially matched by the public router to resolve into a path intended for an authenticated router.
Exploit preconditions
- Attack surface: Any Traefik instance exposing HTTP(S) endpoints through a public router using
PathPrefixwithStripPrefix. - Required access: No prior authentication is required; the attacker only needs network access to the public-facing routes.
- Trigger point: Sending HTTP requests whose paths include
..or percent-encoded variants (such as%2e%2e) that: - Match the public router's
PathPrefixrule at routing time, and - After StripPrefix and path normalization, resolve to a path handled by a protected router.
- Why exploitation is possible: The routing decision is based on the pre-normalized request path, while StripPrefix and normalization occur afterward, allowing a request to be treated as public during routing but resolved to a protected backend path without invoking its authentication middleware.
Why this happens
The core issue stems from a mismatch between routing-time path evaluation and post-processing path resolution.
Traefik's StripPrefix middleware removes a prefix from paths matched by PathPrefix rules on a public router. However, normalization and security decisions are not consistently aligned: routing decisions are made before StripPrefix and full normalization, while backend resolution uses the modified path. When relative segments like .. or encoded variants are present, this leads to a situation described by CWE-288 (Authentication Bypass Using an Alternate Path or Channel).
The behavior also aligns with CWE-22 (Path Traversal) patterns, in that ..-style segments are interpreted in a way that changes the effective resource being accessed after the initial security check. Abstractly, the insecure pattern is: authorization is bound to one view of the resource path, while the actual resource served is derived from a differently transformed path.
Potential impact
- Unauthenticated access to admin or management endpoints that are intended to be protected.
- Unauthorized interaction with internal APIs or configuration routes behind Traefik.
- Potential modification of application or infrastructure configuration via exposed control panels.
- Retrieval of sensitive operational data or logs from internal-only routes.
- Escalation of impact within the broader environment if internal endpoints grant further privileges.
General mitigation guidance
Effective mitigation focuses on aligning routing, normalization, and authorization and reducing reliance on URL-based boundaries alone.
Non-version-specific defensive patterns include:
- Avoiding configurations where public and protected routers share overlapping path hierarchies that can be bridged by prefix stripping or relative path segments.
- Designing router rules so that protected routes are served from clearly separate path spaces or hostnames (e.g., distinct domains or subdomains) rather than relying solely on path prefixes.
- Minimizing or eliminating the use of
StripPrefixon routers that front security-sensitive backends, especially where..or encoded path segments may appear. - Enforcing backend-side authentication and authorization as a second line of defense, rather than relying exclusively on Traefik route-level middleware.
- Applying least-privilege principles to admin and internal services, ensuring that actions exposed via HTTP endpoints require strong authentication and explicit authorization checks.
How teams detect issues like this
Detection usually involves both configuration review and behavioral testing:
- Static analysis or configuration scanning for routers that:
- Use
PathPrefixrules withStripPrefix, and - Point to backends that also host admin, internal, or configuration endpoints.
- Code or config review checklists that explicitly flag any use of
StripPrefixon routes near security-sensitive paths, or where public and protected routers share path hierarchies. - Automated policy enforcement in CI/CD to reject configurations where:
- A public router with
StripPrefixoverlaps in path space with an authenticated router, or - Relative path segments (
..) could alter the effective target of a request. - Dynamic security testing (DAST) to probe public routes with
..and encoded variants in paths, verifying whether protected endpoints become reachable without authentication.
Organizations may also integrate Traefik configuration linters or generic infrastructure-as-code scanning tools to enforce safe routing and middleware patterns as part of their pipeline.

