ACE Journal

DNS Rebinding Attacks Against Cloud-Native API Services

Abstract

DNS rebinding is a decades-old attack class that has found renewed relevance in cloud-native environments, where internal metadata APIs, service meshes, and cluster-local endpoints are often reachable with minimal authentication. By manipulating DNS TTL values and pivoting through a victim’s browser, an attacker can bypass same-origin policy restrictions and issue authenticated requests against localhost-bound or private-network services. Modern container orchestration stacks inadvertently expand the attack surface, making DNS rebinding a practical threat that engineering teams must actively mitigate.

How DNS Rebinding Works Against Kubernetes Workloads

A classic DNS rebinding attack proceeds in two phases. In the first phase, the attacker controls a domain whose authoritative nameserver responds with a legitimate external IP. Once the victim’s browser has loaded attacker-controlled JavaScript, the attacker drops the DNS TTL to zero and re-responds with a private IP - often 169.254.169.254 for cloud instance metadata or an in-cluster ClusterIP. Because the browser considers the origin unchanged, subsequent XHR or fetch calls from that JavaScript carry cookies and are treated as same-origin.

In Kubernetes clusters, the threat surface includes the kubelet read-only port (10255), the API server if exposed on node interfaces, and any service that trusts X-Forwarded-For headers without verifying the originating network. Istio and Envoy sidecar proxies listening on 127.0.0.1:15000 for admin APIs have historically been reachable via this vector. Clusters running kube-dns or CoreDNS with default permissive settings do not inherently block these rebinding attempts.

Practical Defenses for Platform Teams

Several countermeasures can be layered to eliminate or substantially reduce DNS rebinding risk.

Bind sensitive internal APIs to specific interfaces rather than 0.0.0.0. Kubelet’s --address flag and CoreDNS’s bind plugin both support interface-scoped listeners. Combined with NetworkPolicy objects that deny ingress from non-cluster CIDRs, this limits the reachable internal surface considerably.

Host header validation is the most direct defense. Services should reject requests whose Host header does not match an expected allowlist of internal service names. NGINX and Envoy both support header-match route predicates for this purpose. AWS IMDSv2 added the requirement for a PUT preflight with a X-aws-ec2-metadata-token-ttl-seconds header precisely because GET-based rebinding attacks against IMDSv1 were widely exploited.

Private Network Access (PNA), a W3C specification now implemented in Chromium-based browsers, adds a CORS preflight for requests from public origins to private-network destinations. Platform teams should validate that internal services send the Access-Control-Allow-Private-Network: true header only when requests genuinely require it, and should audit services that accept it unconditionally.

Detection and Monitoring

DNS rebinding attacks are difficult to detect purely from network logs because the rebinding response originates from a legitimate nameserver. Effective detection relies on anomaly signals: a DNS response for an external domain that resolves to an RFC 1918 address, a short TTL combined with a rapid re-query, or outbound DNS queries for internal service hostnames from endpoints that should not be initiating such lookups. Tools like Zeek with its dns.log and http.log correlation, and BIND’s response policy zones, can flag private-IP-resolving external records in near real time. Integrating these signals into a SIEM with an alert tuned on A record value in [10/8, 172.16/12, 192.168/16] for external FQDNs provides a low-noise early warning layer.

Conclusion

DNS rebinding is not a theoretical risk in cloud-native environments - it is a practical technique that adversaries have used to exfiltrate credentials from instance metadata endpoints and pivot through service meshes. Hardening internal APIs with host validation, interface binding, and Private Network Access headers, alongside DNS anomaly detection, provides defense-in-depth against an attack class that the industry continues to rediscover.