@@ -35,6 +35,8 @@ echo $KUBERNETES_SERVICE_HOST
35
35
36
36
## Example
37
37
38
+ ### Normal Attack - all command - ALL IN ONE
39
+
38
40
``` bash
39
41
root@pod:/var/www/html/tools# env | grep KUBERNETES
40
42
KUBERNETES_SERVICE_PORT_HTTPS=443
@@ -45,13 +47,69 @@ KUBERNETES_PORT_443_TCP_ADDR=10.43.0.1
45
47
KUBERNETES_SERVICE_HOST=10.43.0.1
46
48
KUBERNETES_PORT=tcp://10.43.0.1:443
47
49
KUBERNETES_PORT_443_TCP_PORT=443
48
- root@pod:/var/www/html/tools# ./k8spider all -c 10.43.43.1/24
50
+
51
+ root@pod:/var/www/html/tools# ./k8spider all # or try ./k8spider all -c 10.43.0.1/16
49
52
INFO[0000] PTRrecord 10.43.43.87 --> kube-state-metrics.lens-metrics.svc.cluster.local.
50
53
INFO[0000] PTRrecord 10.43.43.93 --> metrics-server.kube-system.svc.cluster.local.
51
54
INFO[0000] SRVRecord: kube-state-metrics.lens-metrics.svc.cluster.local. --> kube-state-metrics.lens-metrics.svc.cluster.local.:8080
52
55
INFO[0000] SRVRecord: metrics-server.kube-system.svc.cluster.local. --> metrics-server.kube-system.svc.cluster.local.:443
53
56
INFO[0000] {" Ip" :" 10.43.43.87" ," SvcDomain" :" kube-state-metrics.lens-metrics.svc.cluster.local." ," SrvRecords" :[{" Cname" :" kube-state-metrics.lens-metrics.svc.cluster.local." ," Srv" :[{" Target" :" kube-state-metrics.lens-metrics.svc.cluster.local." ," Port" :8080," Priority" :0," Weight" :100}]}]}
54
57
```
55
58
59
+ This command will try wildcard (any.any.svc.cluster.local) / Axfr dumping at first and brute force all services in the cluster.
60
+
61
+ #### Advanced 1: threading mode
62
+
63
+ ``` bash
64
+ ./k8spider all -t
65
+ # if you want to higher threads, you can use
66
+ ./k8spider all -t -n 16
67
+ ```
68
+
69
+ #### Advanced 2: no default Zone (cluster.local) and specific DNS server
70
+
71
+ ``` bash
72
+ ./k8spider all -z myzone.com -d 10.43.0.10:53
73
+ ```
74
+
75
+ > remember if kubernetes DNS is reachable at remote, you can use it to scan all services under the cluster COMPLETELY REMOTELY.
76
+ >
77
+
78
+ ### Normal Attack - wildcard and axfr command
79
+
80
+ ``` bash
81
+ ./k8spider axfr
82
+ ./k8spider axfr -z myzone.com -d 10.10.0.10:53
83
+ ./k8spider wild
84
+ ```
85
+
86
+ ### Advanced Conditional Attack - neighbor command
87
+
88
+ ``` bash
89
+ ./k8spider neighbor -p < pod-cidr check your ifconfig eth0> -n < current-ns>
90
+ ```
91
+
92
+ If your kubernetes dns sets verified pod mode, it will give your pod ip a DNS name under this namespace, and non allocated
93
+ IP never have.
94
+
95
+ But it's non-default option for dns settings.
96
+
97
+ Default is insecure pod, and it will respond your any (include invalid/non-exists) pod DNS with given IP.
98
+
99
+ ### Customized Attack - service
100
+
101
+ ``` bash
102
+ ./k8spider srv -s kubernetes.default
103
+ ```
104
+
105
+ This command will respond you with registered service ports.
106
+
107
+ ### Customized Attack - subnet
108
+
109
+ ``` bash
110
+ ./k8spider subnet < -c cidr-srv>
111
+ ```
112
+
113
+ This command will only scan PTR service in the given subnet.
56
114
57
115
0 commit comments