Istio outboundTrafficPolicy Egress Control Bypass
Istio's egress restriction using REGISTRY_ONLY can be bypassed by a process running with user ID 1337, because iptables rules exempt that UID from redirection. An attacker who has compromised a pod and can set their process UID to 1337 can make outbound connections that the policy should block.
Published on pulsesecurity.co.nz
Istio can be used to control egress traffic from Istio enabled Kubernetes workloads. When combined with the meshConfig.outboundTrafficPolicy.mode=REGISTRYONLY flag, this can be an attractive option for restricting what outbound connections a pod can make.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the iptables rules used by Istio to redirect outbound traffic include an exemption for processes owned by UID/GID 1337, which can be matched by any process that sets its user ID to 1337.
Impact
An attacker who has already compromised a pod and has root can bypass Istio's egress restrictions to reach external services, though Istio maintainers state this is working as expected and not a supported security control.
What the attacker needed
Compromised Istio-enabled pod; root access inside the pod; ability to set process UID to 1337
The fix
Istio maintainers do not consider this a vulnerability and recommend using Kubernetes Network Policies instead of relying on Istio for egress restriction.
How it was found
- Compromise a pod that has Istio egress restriction enabled.
- Obtain root access inside the pod.
- Create a copy of a tool such as curl and set its owner to UID 1337 with the setuid bit.
- Run the tool to make an outbound connection, which bypasses the Istio egress filter.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Istio is a tool that can limit which external sites pods in a Kubernetes cluster can reach. It does this by redirecting traffic through a proxy, but the redirection rules skip any process running as user ID 1337. If an attacker gets into a pod and can change their user ID to 1337, they can avoid the proxy and connect out freely.
What is Misconfiguration?
Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.