DNS Rebinding Explained
DNS rebinding exploits the time gap between DNS resolution and browser security checks. The attacker’s domain first resolves to their own server (to plant malicious JavaScript), then rebinds to an internal IP (to access devices on your network) using the browser’s trust.
DNS rebinding defenses
| Defense | Layer | Notes |
|---|---|---|
| Host header validation | Application | Reject requests whose Host is not your hostname |
| Split-horizon DNS hygiene | Network | Keep private answers off public resolvers |
| Browser-side protections | Client | Modern browsers pin public suffixes |
The attack sequence
- The victim visits attacker.com, which resolves to the attacker’s server.
- The page loads JavaScript that keeps running in the victim’s browser.
- The DNS TTL expires; the page re-queries attacker.com.
- This time the DNS answer is 192.168.1.1 (the victim’s router).
- The JavaScript can now read responses from 192.168.1.1 because the browser thinks it’s still same-origin (same domain name).
What attackers target
- Router admin panels (change DNS, open ports, install firmware).
- IoT devices (cameras, thermostats) with unauthenticated APIs.
- Development servers (localhost:3000, :8080) running on the victim’s machine.
- Enterprise applications on internal networks accessible from the employee’s browser.
Defenses
- Browser-level: modern browsers pin the resolved IP for the page’s lifetime (defense in depth).
- DNS-level: your resolver can filter rebinding attempts (answer A records for public domains only with public IPs).
- Application-level: validate the Host header on internal services; reject requests for external domain names.
- Router-level: don’t expose admin interfaces on the LAN without authentication.
Frequently asked questions
Is DNS rebinding still a threat?+
Yes, especially against IoT devices and internal services that lack host-header validation. Browsers have improved, but the attack surface persists.
How is this different from DNS spoofing?+
Spoofing forges answers. Rebinding uses legitimate answers that change over time: the DNS is working correctly, the attack exploits the time gap.
Does HTTPS prevent rebinding?+
It complicates it (the attacker needs a valid certificate for their domain that rebinding preserves), but does not eliminate the underlying issue for internal HTTP services.
Can I prevent rebinding on my own devices?+
Set your resolver to filter rebind attempts (dnsmasq: stop-dns-rebind). Most modern routers and Pi-hole include this.
Why doesn’t the same-origin policy prevent this?+
The browser judges origin by domain NAME, not IP. attacker.com resolving to 192.168.1.1 is still attacker.com to the browser.
What is the DNS TTL requirement for rebinding?+
The attacker needs a very low TTL (0 or 1) so the browser re-queries quickly. Legitimate domains should never use TTL 0.
Related DNS Security Guides
Explore related DNS attack vectors and cryptographic defenses:
- DNS Hijacking
- DNS Cache Poisoning
- DNS Amplification Attacks
- DNS Tunneling
- DNSSEC: the cryptographic defense
Related
Last verified: 2026-11-28