Skip to content

Commit ad1d4df

Browse files
authored
Merge pull request #20 from Esonhugh/doc/Readme-Attack-Technique-Update
doc: readme, usage of k8spider other commands and features.
2 parents 378806e + b8e1c04 commit ad1d4df

File tree

1 file changed

+59
-1
lines changed

1 file changed

+59
-1
lines changed

README.md

+59-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ echo $KUBERNETES_SERVICE_HOST
3535

3636
## Example
3737

38+
### Normal Attack - all command - ALL IN ONE
39+
3840
```bash
3941
root@pod:/var/www/html/tools# env |grep KUBERNETES
4042
KUBERNETES_SERVICE_PORT_HTTPS=443
@@ -45,13 +47,69 @@ KUBERNETES_PORT_443_TCP_ADDR=10.43.0.1
4547
KUBERNETES_SERVICE_HOST=10.43.0.1
4648
KUBERNETES_PORT=tcp://10.43.0.1:443
4749
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
4952
INFO[0000] PTRrecord 10.43.43.87 --> kube-state-metrics.lens-metrics.svc.cluster.local.
5053
INFO[0000] PTRrecord 10.43.43.93 --> metrics-server.kube-system.svc.cluster.local.
5154
INFO[0000] SRVRecord: kube-state-metrics.lens-metrics.svc.cluster.local. --> kube-state-metrics.lens-metrics.svc.cluster.local.:8080
5255
INFO[0000] SRVRecord: metrics-server.kube-system.svc.cluster.local. --> metrics-server.kube-system.svc.cluster.local.:443
5356
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}]}]}
5457
```
5558

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.
56114

57115

0 commit comments

Comments
 (0)