The vulnerability exists in Traefik's Kubernetes CRD provider, where the allowCrossNamespace=false setting was not being honored for Chain middlewares. This allowed an attacker with permissions to create Traefik CRDs in one namespace to reference and use middlewares from another namespace, bypassing the intended isolation boundary.
The root cause was in the createChainMiddleware function in pkg/provider/kubernetes/crd/kubernetes.go. This function was responsible for resolving the middlewares listed in a Chain's specification. However, it did not have a mechanism to check whether cross-namespace references were permitted. It would unconditionally resolve the namespace from the middleware reference or default to the Chain's own namespace.
The function loadConfigurationFromCRD, which is responsible for loading the configuration from CRDs, called createChainMiddleware without passing the necessary allowCrossNamespace context.
The patch addresses this by modifying the signature of createChainMiddleware to accept the allowCrossNamespace boolean. Inside the function, new logic was added to check this flag and return an error if a cross-namespace reference is attempted when it's disallowed. Consequently, the call to createChainMiddleware within loadConfigurationFromCRD was updated to pass the provider's AllowCrossNamespace setting, effectively closing the security gap.