Breaking the Kubernetes Cluster Using Helm v2 Tiller

Breaking the Kubernetes Cluster Using Helm v2 Tiller

Helm is a package manager for Kubernetes, similar to apt-get that for Ubuntu. In this note, we will look at the previous version of helm (v2) with the tiller service installed by default, through which we will access the cluster.

Let's prepare the cluster, for this we will run the command:

kubectl run --rm --restart=Never -it --image=madhuakula/k8s-goat-helm-tiller -- bash

Breaking the Kubernetes Cluster Using Helm v2 Tiller

Demo

  • If nothing is configured additionally, helm v2 runs the tiller service, which has RBAC with full cluster administrator rights.
  • After installation in the namespace kube-system appears. tiller-deploy, port 44134 is also opened, bound to 0.0.0.0. This can be checked using telnet.

$ telnet tiller-deploy.kube-system 44134

Breaking the Kubernetes Cluster Using Helm v2 Tiller

  • Now we can connect to the tiller service. We will use the helm binary to perform operations while communicating with the tiller service:

$ helm --host tiller-deploy.kube-system:44134 version

Breaking the Kubernetes Cluster Using Helm v2 Tiller

  • Let's try to retrieve the secrets of the Kubernetes cluster from the namespace kube-system:

$ kubectl get secrets -n kube-system

Breaking the Kubernetes Cluster Using Helm v2 Tiller

  • Now we can create our own chart, in which we create a role with administrative rights and assign this role to the default service account. Using the token from this service account, we gained full access to our cluster.

$ helm --host tiller-deploy.kube-system:44134 install /pwnchart

Breaking the Kubernetes Cluster Using Helm v2 Tiller

  • Now that pwnchart is deployed, the default service account has full administrative access. Let's check again to retrieve secrets from kube-system

$ kubectl get secrets -n kube-system

Breaking the Kubernetes Cluster Using Helm v2 Tiller

The successful execution of this script depends on how tiller was deployed; sometimes administrators deploy it in a separate namespace with different privileges. Helm 3 is not subject to such vulnerabilities, as it does not have tiller.

Translator's note: using network policies to filter traffic in the cluster helps protect against vulnerabilities of this type.

Source: habr.com

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster