The vulnerability lies in Traefik's Kubernetes Gateway provider, specifically in how it handles crossProviderNamespaces for HTTPRoute, TCPRoute, and TLSRoute with multiple backendRefs. The core issue is that when multiple backends are defined, the validation to check if a route is allowed to reference a cross-provider service (like api@internal) was using the namespace defined in the backendRef (backendRef.namespace) instead of the namespace of the route itself (route.Namespace).
This allowed an attacker who can create a route in a non-privileged namespace to still access and expose internal Traefik services by creating a route with multiple backendRefs, where one of them points to a legitimate service and the other points to an internal Traefik service, but with the namespace field in the backendRef pointing to a namespace that is in the crossProviderNamespaces allowlist. The ReferenceGrant mechanism in Kubernetes Gateway API would allow this cross-namespace reference, and Traefik's vulnerable logic would then incorrectly authorize the request.
The patch addresses this by explicitly disallowing the use of backendRef.namespace when the backendRef is a cross-provider service (i.e., contains an '@'). This ensures that for cross-provider services, the check is always performed against the route's own namespace, correctly enforcing the crossProviderNamespaces security boundary.