Summary
A routing flaw in Traefik's Kubernetes ingress-nginx provider can create an unintended sibling router that omits authentication and other annotation-derived middleware. Under specific Host header conditions, an unauthenticated request may bypass access controls and reach a protected backend service.
Affected context
The issue affects Traefik deployments using the Kubernetes ingress-nginx provider with Ingress resources that combine an authentication annotation with the nginx.ingress.kubernetes.io/from-to-www-redirect annotation. The provider may generate a host-only sibling router that retains the backend association but does not inherit the parent router's authentication, authorization, or other annotation-derived middleware. The described behavior applies to affected Traefik v3.7.x releases and depends on request host parsing and redirect-pattern behavior.
Exploit preconditions
- Attack surface: HTTP request handling through a Traefik entry point - Required access: Network access to an affected host or route; backend
credentials are not necessarily required
- Trigger point: A request whose Host authority causes the sibling router to
match while the redirect middleware does not produce a redirect
- Why exploitation is possible: The sibling router points to the protected
backend but lacks the authentication and access-control middleware applied
to the parent router
Why this happens
The provider constructs an additional router for the combined authentication and www-redirect configuration but fails to preserve the complete middleware chain from the parent router. RedirectRegex is non-terminal, so when its pattern does not match, processing continues to the backend service. A mismatch between accepted host-port forms and the redirect pattern can therefore expose a route that forwards traffic without the intended protections. This represents an authorization-control failure consistent with CWE-639, because routing behavior allows access to a protected resource without applying the expected authorization mechanism.
Potential impact
- An attacker may bypass configured authentication such as BasicAuth.
- An attacker may reach backend endpoints intended to be restricted.
- Source-IP allowlisting and other annotation-derived controls could be bypassed.
- Sensitive data may be disclosed or protected operations may be performed.
- The affected backend could be exposed to follow-on attacks.
General mitigation guidance
Mitigation generally focuses on ensuring that every generated route preserves the complete security middleware chain of its parent route. Secure-by-default patterns include treating authentication, authorization, source-IP restrictions, and similar controls as mandatory route invariants rather than optional annotation side effects. Redirect handling should be terminal or should fail closed when its pattern does not match, and host canonicalization should use one consistently validated authority format. Organizations can reduce input trust by validating Host values at the edge, restricting accepted port syntax, and preventing ambiguous route combinations. Backends should remain protected independently where feasible, and proxy workloads should use least-privilege identities and network policies.
How teams detect issues like this
Detection can combine configuration analysis with request-level testing. Static analysis and provider tests can look for generated sibling routers that share a backend but omit inherited authentication or authorization middleware. Code review should flag route-generation branches that copy matchers or services without copying security middleware, as well as non-terminal redirects followed by protected backends. Policy enforcement can require authentication and access-control middleware on every externally reachable route and can reject ambiguous combinations of redirect and authentication annotations. Automated security review tools and integration tests can exercise unusual, malformed, empty, or nonstandard Host ports and verify that requests are rejected or redirected rather than forwarded.

