github.com/traefik/traefik/v3
Affected
- introduced
0, fixed3.6.21(semver)
Fixed versions
3.6.21
Fix
- Fixed version
3.6.21go get github.com/traefik/traefik/[email protected]
Advisory
Also known as: CVE-2026-54761, GO-2026-5083
Traefik: Kubernetes Gateway crossProviderNamespaces bypass allows HTTPRoute outside the allowlist to expose internal Traefik services
Summary
There is a high severity vulnerability in Traefik's Kubernetes Gateway provider affecting the crossProviderNamespaces allowlist. For HTTPRoute rules that declare multiple (WRR) backendRefs, Traefik evaluates the allowlist against the target backendRef.namespace instead of the route's own namespace. As a result, an HTTPRoute created in a namespace that is not allow-listed can reference a cross-provider TraefikService such as api@internal, dashboard@internal or rest@internal by pointing backendRef.namespace at an allow-listed namespace covered by a Gateway API ReferenceGrant, exposing internal Traefik services on the data plane. Exploitation requires the ability to create an accepted HTTPRoute and a matching ReferenceGrant from an allow-listed namespace ; it does not require any change to Traefik static configuration, RBAC, or the deployment itself.
Patches
For more information
If you have any questions or comments about this advisory, please open an issue.
<details>
<summary>Original Description</summary>
Summary
The Kubernetes Gateway provider's crossProviderNamespaces option is documented as restricting which Gateway API route namespaces may declare TraefikService backendRefs.
For HTTPRoute rules with multiple backendRefs, Traefik checks this allowlist against backendRef.namespace instead of the HTTPRoute namespace. A route in a namespace that is not allow-listed can therefore add api@internal to the generated WRR service by setting backendRef.namespace to an allow-listed namespace, as long as a normal Gateway API ReferenceGrant permits that cross-namespace reference.
Verified affected versions:
v3.7.1 (fa49e2bcad7ffd8a80accdf1fae1ae480913d93d)29406d42898547f1ffabd904f66af06c212740cf)Expected Behavior
With:
providers:
kubernetesGateway:
crossProviderNamespaces:
- trusted
only Gateway API routes whose own namespace is trusted should be allowed to declare TraefikService backendRefs such as api@internal, dashboard@internal, or rest@internal.
An HTTPRoute in namespace attacker should not be able to expose an internal Traefik service by setting:
backendRefs:
- group: traefik.io
kind: TraefikService
name: api@internal
namespace: trusted
Actual Behavior
For an HTTPRoute in namespace attacker with two backendRefs, Traefik generates a WRR service containing:
[api@internal attacker-whoami-http-80]
even though crossProviderNamespaces only allows trusted.
Threat Model
This does not require changing Traefik static configuration or Traefik process state. The relevant boundary is the Kubernetes Gateway provider's crossProviderNamespaces policy: namespaces outside the allowlist should not be able to declare cross-provider TraefikService backendRefs.
The precondition is a Gateway API environment where an untrusted or less-trusted namespace can create HTTPRoute objects accepted by a Gateway, and a namespace in the crossProviderNamespaces allowlist has a matching ReferenceGrant. ReferenceGrant should satisfy Gateway API cross-namespace reference rules, but it should not override Traefik's separate provider-level namespace allowlist for cross-provider internal services.
A Gateway API ReferenceGrant should be treated as necessary but not sufficient for this case. It authorizes the cross-namespace object reference under Gateway API rules, but Traefik's crossProviderNamespaces option is an additional Traefik-specific security control for cross-provider TraefikService backendRefs, especially @internal services. Therefore a ReferenceGrant from trusted must not make a route in attacker equivalent to a route whose own namespace is trusted.
Required Attacker Capability
Required:
HTTPRoute in namespace attacker;HTTPRoute accepted by a Gateway;ReferenceGrant from an allow-listed namespace, or on a delegated namespace setup where such ReferenceGrant objects are managed separately from Traefik's provider configuration.Not required:
providers.kubernetesGateway.crossProviderNamespaces;api.insecure;Documentation Evidence
The documented boundary is the namespace of the Gateway API route/resource that declares the cross-provider reference, not the namespace named in backendRef.namespace.
The Kubernetes Gateway provider option is documented as:
List of namespaces from which Gateway API routes (HTTPRoute, TCPRoute, TLSRoute) are allowed to declare a backendRef of kind TraefikService.
The migration notes also describe the security reason for the option:
those references ... allow a user to cross namespace boundaries, as well as exposing @internal services, that only the operator should be able to expose.
and the documented behavior is:
["ns-a"] | Only Kubernetes resources in the listed namespaces can declare cross-provider references.
The provider struct uses the same route-namespace wording:
CrossProviderNamespaces []string `description:"List of namespaces from which Gateway API routes are allowed to declare TraefikService backendRef references." ...`
The reproduced route kind is HTTPRoute; no Gateway API experimental-channel resources are required for the PoC.
PoC
I validated the issue end-to-end in a local kind cluster with Traefik v3.7.1, real Gateway API CRDs, real Kubernetes Gateway, HTTPRoute, and ReferenceGrant resources, and HTTP requests to Traefik's normal web entrypoint.
The complete local reproducer I used is a self-contained kind PoC with these files:
external-repro-kind/kind-config.yaml
external-repro-kind/traefik-v371.yaml
external-repro-kind/gateway-exploit.yaml
external-repro-kind/run-kind-repro.sh
Run command:
./external-repro-kind/run-kind-repro.sh
The script creates a local kind cluster, loads local traefik:v3.7.1 and traefik/whoami:v1.11.0 images, installs Gateway API CRDs, deploys Traefik and the PoC Gateway resources, sends the control and exploit curl requests to 127.0.0.1:18080, prints route status, and deletes the cluster on exit.
Traefik was started with:
--api=true
--api.dashboard=true
--api.insecure=false
--providers.kubernetesgateway=true
--providers.kubernetesgateway.crossprovidernamespaces=trusted
The local host entrypoint was:
127.0.0.1:18080 -> kind NodePort -> Traefik web entrypoint
The target namespace has a normal Gateway API ReferenceGrant:
Medium Basis: The source's own band: MODERATE
0, fixed 3.6.21 (semver)3.6.21
3.6.21go get github.com/traefik/traefik/[email protected]0, last affected 2.11.50 (semver)None listed
No fixed version is listed.
0, last affected 1.7.34 (semver)None listed
No fixed version is listed.
3.7.0-ea.1, fixed 3.7.5 (semver)3.7.5
3.7.5go get github.com/traefik/traefik/[email protected]Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0