CVE-2022-21701: Istio Privileged Escalation in Kubernetes Gateway API
The Istio gateway deployment controller used an unvalidated annotation to build YAML, allowing an attacker with permission to create Gateway resources to inject additional YAML keys and create arbitrary resources, such as a privileged pod, in any namespace.
amlw.dev
Published on amlw.dev
Advisory: https://github.com/istio/istio/security/advisories/GHSA-mq8f-9446-c28r
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
The deployment controller used a Go text/template to craft YAML from user-controlled annotation values without validation, and the YAML unmarshaller accepted duplicate keys, allowing injection of arbitrary resource definitions.
Impact
An attacker with permission to create Gateway resources could create arbitrary resources, including a privileged pod, in any namespace, potentially leading to cluster compromise.
What the attacker needed
Permission to create Gateway resources; Istio installed with Gateway API CRDs
The fix
The vulnerability was fixed by validating the annotation value to prevent YAML injection.
How it was found
- Install Istio.
- Install the Gateway API CRDs.
- Apply a malicious Gateway resource with a crafted annotation.
- Observe the privileged pod created.
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.
A user with limited rights to create a Gateway object could trick Istio into building a different kind of Kubernetes resource, like a pod with full privileges. This happens because Istio takes a text field from the Gateway and pastes it into a YAML template without checking it, so the user can add extra lines that change what gets created.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.