Istio Gateway can bypass strict gateway merging via internal annotationsGHSA-94hp-7c48-x2x3
MEDIUMFix: istio/istio@a0bd9d6GHSA-94hp-7c48-x2x3 is a medium-severity (CVSS 6.4) CWE-807 vulnerability in istio.io/istio. A fix is available for istio.io/istio — see the affected versions and patch details below.
Real-World Exposure
istio.io/istioReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Go packages — download data is not available via public APIs for these ecosystems.
Description
Summary
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 workload is merged with the managed gateway, which the feature is designed to prevent.
The internal.istio.io/gateway-semantics annotation also relaxes validation for the Gateway (the DNS-1123 name check and namespace/hostname checks in validateServer), so a user-set value also changes what validation accepts.
The fix has three independent layers:
- Admission validation.
validateMetadatanow rejects user-setinternal.istio.io/gateway-semanticsandinternal.istio.io/service-account-name, in addition toparent-namespaceandparents. The list is defined once asconstants.UserForbiddenInternalAnnotationsand shared with layer 2. - Ingestion sanitization. When istiod reads Istio resources from the Kubernetes API (CRD client), it removes the same four annotations from the in-memory config and logs a warning. The stored object is not modified. This neutralizes resources that were persisted before the fix, or while the webhook was down or failing open, without requiring operators to find and edit them first. Configs generated internally by the Kubernetes Gateway API controller do not pass through the CRD client and are unaffected.
- Merge-time provenance.
filterStrictGatewayMergingno longer trusts the annotation alone. A config is treated as a managed Gateway API gateway only if it also carries the in-memory markerMeta.Synthesized, which is set only by the Gateway API controller, is not serialized, and cannot be set from a stored resource. This protects against annotations reaching the merge through any path other than the CRD client.
Internally generated configs are not affected by validation, because they do not pass through the user-facing validation path.
Fixes are available in 1.30.9, 1.31.5 and 1.32.1.
Workaround
Upgrading to a fixed version is the recommended remediation. It also neutralizes Gateway resources that were already stored with the annotations, so no manual cleanup is required for correctness. Until you can upgrade, these mitigations reduce exposure:
- Use Kubernetes
ValidatingAdmissionPolicy, Kyverno or OPA Gatekeeper to deny any IstioGateway(networking.istio.io) that carries an annotation with the prefixinternal.istio.io/. Trade-off: the policy must be maintained by the cluster operator. Existing resources are not affected by a new admission policy, so also audit storedGatewayresources, for examplekubectl get gateways.networking.istio.io -A -o json | grep -F internal.istio.io/, and remove any such annotation. - Set
PILOT_SCOPE_GATEWAY_TO_NAMESPACE=trueon istiod so that a gateway workload only selectsGatewayresources in its own namespace. Trade-off: this disables cross-namespaceGatewayselection for all gateways, including legitimate setups that rely on it. - Restrict
createandupdateongateways.networking.istio.ioto trusted users. Trade-off: it removes self-service gateway configuration for tenants.
Proof of concept
Reproduced end-to-end on an Istio 1.32.0 kind cluster: a managed Kubernetes Gateway API gateway in one namespace (victim), and an Istio Gateway created by an attacker in another namespace. The attacker's Gateway was correctly dropped by strict gateway merging until the attacker set internal.istio.io/gateway-semantics: gateway on it; its server then appeared as a new listener and route on the victim's managed gateway proxy. Setting this single annotation was sufficient; validation accepted it while rejecting the already-banned sibling internal.istio.io/parent-namespace on the same path.
The minimum configuration that shows the validation gap is an Istio Gateway created by a user with both annotations set:
apiVersion: networking.istio.io/v1
kind: Gateway
metadata:
name: example
namespace: tenant-b
annotations:
internal.istio.io/gateway-semantics: gateway
internal.istio.io/service-account-name: example-sa
spec:
selector:
gateway.networking.k8s.io/gateway-name: managed-gw
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "tenant-b/*"
Verified behavior after the fix, same cluster:
- A create or update carrying
internal.istio.io/gateway-semanticsorinternal.istio.io/service-account-nameis rejected by validation withannotation found, this may not be set by users. - A resource of this shape already stored in etcd (applied while bypassing the webhook) is no longer merged: strict gateway merging ignores it because it was not synthesized by the Gateway API controller.
Impact
Any user who can create or update networking.istio.io Gateway resources in any namespace can attempt this. The cluster must run a managed Gateway API gateway whose proxy labels the attacker's Gateway selector can match, and PILOT_ENABLE_STRICT_GATEWAY_MERGING must be enabled (the default). The protection added by strict gateway merging is lost for that proxy.
The attacker can add servers (listeners and hosts) to a gateway proxy owned by another namespace. This affects integrity (unexpected listeners or routes on another tenant's gateway) and availability (conflicting servers can cause legitimate configuration to be rejected or shadowed).
Confidentiality is not rated as impacted. Per code reading, secrets referenced by the merged Gateway are only authorized when the proxy's verified identity namespace equals the Gateway namespace (mergeGateways in pilot/pkg/model/gateway.go), which does not hold for a Gateway from another namespace. This was not tested.
Sidecars and ambient workloads are not affected. The issue applies to gateway proxies configured through the Gateway resource.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐹Go | istio.io/istio | ≥ 0.0.0-20260112152740-3af7534ca9a9&&< 0.0.0-20261202224500-02f27003a69d | 0.0.0-20261202224500-02f27003a69dgo get istio.io/istio@v0.0.0-20261202224500-02f27003a69d |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for istio.io/istio, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update istio.io/istio to 0.0.0-20261202224500-02f27003a69d or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-94hp-7c48-x2x3 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
Frequently Asked Questions
Is GHSA-94hp-7c48-x2x3 in your dependencies?
Find it across Go, including transitive dependencies.