Уязвимость компонента Webhook программного обеспечения управления кластерами Kubernets Rancher связана с недостатками разграничения доступа. Эксплуатация уязвимости может позволить нарушителю, действующему удалённо, повысить свои привилегии
Использование рекомендаций:
https://github.com/rancher/webhook/commit/a4a498613b43a3ee93c5ab06742a3bc8adace45d
https://github.com/rancher/rancher/security/advisories/GHSA-6m9f-pj6w-w87g
Компенсирующие меры:
Рекомендуется вручную перенастроить Webhook с помощью приведенного ниже сценария. Обратите внимание, что скрипт должен запускаться внутри local кластера или с kubeconfig, указывающим на local кластер с правами администратора:
#!/bin/bash
set -euo pipefail
function prereqs() {
if ! [ -x "$(command -v kubectl)" ]; then
echo "error: kubectl is not installed." >&2
exit 1
fi
if [[ -z "$(kubectl config view -o jsonpath='{.clusters[].cluster.server}')" ]]; then
echo "error: No kubernetes cluster found on kubeconfig." >&2
exit 1
fi
}
function restart_deployment(){
kubectl rollout restart deployment rancher-webhook -n cattle-system
kubectl rollout status deployment rancher-webhook -n cattle-system --timeout=30s
}
function workaround() {
echo "Cluster: $(kubectl config view -o jsonpath='{.clusters[].cluster.server}')"
if ! kubectl get validatingwebhookconfigurations.admissionregistration.k8s.io rancher.cattle.io > /dev/null 2>&1; then
echo "webhook rancher.cattle.io not found, restarting deployment:"
restart_deployment
echo "waiting for webhook configuration"
sleep 15s
fi
local -i webhooks
webhooks="$(kubectl get validatingwebhookconfigurations.admissionregistration.k8s.io rancher.cattle.io --no-headers | awk '{ print $2 }')"
if [ "${webhooks}" == "0" ]; then
echo "Webhook misconfiguration status: Cluster is affected by CVE-2023-22651"
echo "Running workaround:"
kubectl delete validatingwebhookconfiguration rancher.cattle.io
restart_deployment
ret=$?
if [ $ret -eq 0 ]; then
echo "Webhook restored, CVE-2023-22651 is fixed"
else
echo "error trying to restart deployment. try again in a few seconds."
fi
else
echo "Webhook misconfiguration status: not present (skipping)"
fi
echo "Done"
}
function main() {
prereqs
workaround
}
main
| Балл | 9 — критическая опасность |