GitHub advisory · Go
Istio Gateway can bypass strict gateway merging via internal annotations
Description
Istio validation rejects the internal annotations internal.istio.io/parent-namespace and internal.istio.io/parents when users set them, but it does not reject internal.istio.io/gateway-semantics and internal.istio.io/service-account-name. A user who can create an Istio Gateway in one namespace can set these two annotations to make the Gateway look like one generated by the Kubernetes Gateway API controller. This bypasses the strict gateway merging protection (PILOT_ENABLE_STRICT_GATEWAY_MERGING, enabled by default), so the Gateway is merged into a managed Gateway API gateway proxy in a different namespace. Because istiod read these annotations from stored resources and trusted them at merge time, a Gateway stored before the fix, or created while the validation webhook was unavailable, was also exploitable.
Strict gateway merging is implemented in filterStrictGatewayMerging in pilot/pkg/model/push_context.go. When a proxy matches at least one managed Gateway API gateway, Istio Gateway resources from other namespaces are dropped from the merge. The function decides whether a config is a managed Gateway API gateway, and which namespace it belongs to, only from two annotations on the config: internal.istio.io/gateway-semantics and internal.istio.io/service-account-name.
These annotations are meant to be set only by Istio's Kubernetes Gateway API controller (pilot/pkg/config/kube/gateway/gateway_collection.go). The metadata validation wrapper validateMetadata in pkg/config/validation/validation.go rejects user-set internal.istio.io/parent-namespace and internal.istio.io/parents, but it did not reject these two. A user-created Gateway carrying both annotations is therefore accepted. In filterStrictGatewayMerging it is then treated as a Gateway API gateway: its namespace is added to the set of managed namespaces and the config is kept in the merge. A Gateway in an unrelated namespace that selects the same gateway…
Manual fix · Go
go get istio.io/istio@v0.0.0-20261202224500-02f27003a69dSources