What is DNS rebinding, and how do you stop it?
DNS rebinding abuses the fact that a browser's same-origin policy trusts a hostname, not the IP behind it: an attacker's DNS server first answers with its own address to pass an initial check, then swaps the answer to a private address — letting a page you're viewing reach your own network. AdminKit's DNS lookup tool shows a hostname's current answer.
By AdminKit team, Netbase JSC · Updated
Key takeaways
- DNS rebinding works because the browser’s same-origin policy compares hostnames, not IP addresses. An attacker’s name can point at the attacker’s server first and at a device on your network a moment later.
- The attack needs only a domain the attacker controls, a very short TTL, and a victim who keeps a malicious page open. No malware runs on your machine.
- The most reliable fixes sit outside the browser: a resolver that drops private addresses in public answers, and devices that check the
Hostheader and require a real login. - Browsers are adding their own checks on public-to-local requests, but the draft specification says routers and local services must still defend themselves.
Why does DNS rebinding work at all?
DNS rebinding is one of several DNS-tampering and DNS-trust topics covered in AdminKit’s DNS cluster. A browser’s same-origin policy decides whether a page’s JavaScript can read data from another page by comparing hostnames — not IP addresses. DNS rebinding exploits the gap between those two things. An attacker controls the DNS server for a domain they own, and configures it to answer the first lookup with their own server’s address, so a victim’s browser loads the page normally and treats it as a legitimate origin. The attacker then sets a very short TTL on that DNS record and, once the victim’s browser or resolver re-resolves the name, switches the answer to a private address — commonly one of the ranges RFC 1918 reserves for internal networks (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) or 127.0.0.1 itself. The browser never sees the hostname change, so it keeps treating requests from that page as same-origin, even though they now land on a device inside the victim’s own network.
Nothing here breaks a rule: DNS may change an answer when the TTL runs out. The flaw is in what the browser concludes from an unchanged name.
What does a rebinding attack look like step by step?
The attack has two phases: get a script running under the attacker’s hostname, then make that hostname point somewhere else. Here is the sequence with documentation names and addresses, against a router whose admin page lives at an RFC 1918 private address:
| Step | What happens | Answer for rebind.example.net | What the browser treats as the origin |
|---|---|---|---|
| 1 | The victim opens a link to http://rebind.example.net/ | 203.0.113.10, TTL 1 second | http://rebind.example.net |
| 2 | The attacker’s server sends a page with a script that waits | (cached) | same |
| 3 | The TTL expires and the attacker’s DNS server switches its answer | 192.168.1.1 | same |
| 4 | The script calls fetch("/status"); the browser resolves the name again | 192.168.1.1 | same, so the response is readable |
| 5 | The script sends what it read back to a second attacker host | not relevant | a separate, normal request |
Step 4 is the whole attack. The request goes to the router, but because the hostname has not changed, the script is allowed to read the reply. Step 5 is ordinary: any page may send data to another server it controls.
From the outside, the two answers look like this. Example output (illustrative, documentation addresses):
$ dig +noall +answer rebind.example.net A
rebind.example.net. 1 IN A 203.0.113.10
$ dig +noall +answer rebind.example.net A # a few seconds later
rebind.example.net. 1 IN A 192.168.1.1
A one-second TTL and a public name that suddenly resolves to a private address are the two signs to look for. Neither is proof on its own: some legitimate services publish private addresses on purpose, which is why resolvers let you list exceptions.
Why doesn’t DNS pinning stop it?
The classic browser defence was DNS pinning: once a page has loaded, keep using the first IP address for that hostname and ignore later answers. The 2007 paper Protecting Browsers from DNS Rebinding Attacks by Jackson, Barth, Bortz, Shao and Boneh reported that pinning was ineffective in the browsers of the time, largely because of how browsers interacted with plug-ins such as Flash Player and Java.
Pinning also fights normal operations: sites move between servers and failover changes addresses. Pin too long and failover breaks; pin briefly and the attacker just waits. That is why the later defences focus on which address a request ends up at, not on freezing the first answer.
What can an attacker actually reach this way?
The paper by Jackson, Barth, Bortz, Shao and Boneh showed that a successful rebind effectively turns a victim’s browser into an open proxy that can reach anything the victim’s network can reach — including hosts with no direct path from the public internet at all. In practice that means a router’s web admin panel, a smart-home hub’s local API, a network printer, or an internal dashboard someone assumed was safe simply because it “isn’t exposed to the internet.” If that device’s admin interface doesn’t require its own authentication — a common assumption for LAN-only devices — a rebind attack can read its configuration or send it commands, entirely through a tab the victim thinks is just browsing an ordinary website.
| Target | Example address | Why it is exposed |
|---|---|---|
| Home or office router admin page | 192.168.1.1 | Often plain HTTP, sometimes with default or no credentials |
| Smart-home hub or camera API | 10.0.0.20 | Local APIs frequently assume the LAN is trusted |
| Developer tool or desktop app on the same machine | 127.0.0.1:8080 | Loopback services often skip authentication entirely |
| Internal dashboard or wiki | 172.16.5.10 | “Internal only” is used in place of a login |
Devices that announce themselves on the LAN make the attacker’s guessing easier; see mDNS, SSDP and UPnP discovery leaks for what those protocols reveal. The server-side cousin of this problem, where a server is tricked into fetching an internal address, is server-side request forgery.
What are browsers doing about it?
Browsers are moving towards treating a request from a public site to a local address as a separate, gated event. The WICG Local Network Access draft, edited by Google engineers, sorts every IP address into one of three address spaces and asks the user for permission before a public website can reach a less public one. The draft notes that it builds on Chrome’s earlier Private Network Access work, which it describes as paused, and replaces that design’s preflight requests with a permission prompt.
| Address space in the draft | Meaning | Examples |
|---|---|---|
loopback | Reachable only on the same device | 127.0.0.1, ::1 |
local | Meaningful only on the current network | 192.168.1.1, 10.0.0.20 |
public | Same target for every device on the internet | 203.0.113.10 |
Two details in its security section matter for rebinding. The check runs on the IP address the browser actually connects to, and it must run on every new connection, so changing the DNS answer halfway through does not get around it. The draft also says plainly that it only mitigates attacks: a router’s admin interface must still defend itself and should not rely on browsers behaving this way. Support differs between browsers and versions, so treat it as an extra layer, not the fix.
How do you check whether you’re exposed?
There’s no single “rebinding check” the way there is a port-exposure check, because the vulnerability lives in how a device or resolver handles DNS answers that resolve to private addresses, not in whether a port responds publicly. Two things are worth confirming on your own network:
- What your DNS resolver does with a public-looking name that resolves to a private address. Use AdminKit’s DNS lookup tool to inspect a hostname’s current answer and TTL — an unusually short TTL on a record you don’t control is one of the signatures rebinding attempts rely on.
- Whether devices on your network require authentication regardless of where a request appears to originate. A router or IoT hub’s admin interface that trusts “requests from the LAN” without checking credentials is exposed to rebinding even if its own firmware has nothing else wrong with it.
A practical order of work:
- Find out which resolver your devices use. On most home and small-office networks it is the router, handed out by DHCP. If you have a Pi-hole or another local resolver, that is the one to check.
- Open the router’s DNS settings and look for an option named “DNS rebind protection”, “rebind protection” or similar.
- Test it with a name you control. Publish a test record in a domain you own that points to a private address, then query it through your local resolver. With protection on, the private answer should be dropped; without it, you will see the address.
- List your management interfaces. For each router, hub or printer admin page, note whether it requires a password and whether it uses HTTPS. Using port check to inventory IoT device exposure covers the related job of finding what is listening.
How do you turn on rebind protection in dnsmasq or Unbound?
Both resolvers can strip private addresses from answers to public names, and both let you exempt names that are meant to resolve internally. In dnsmasq, the manual page describes --stop-dns-rebind as rejecting and logging upstream answers in private ranges, which “blocks an attack where a browser behind a firewall is used to probe machines on the local network”. In the configuration file the same options are written without the leading --:
# /etc/dnsmasq.conf
stop-dns-rebind
# Allow 127.0.0.0/8 and ::1 (used by some DNS blocklists)
rebind-localhost-ok
# Names that are allowed to resolve to private addresses
rebind-domain-ok=/home.example.com/
For IPv6, the manual says the private range covers IPv4-mapped private addresses plus all link-local and unique local addresses. rebind-localhost-ok exists because, in the manual’s words, 127.0.0.0/8 is returned by realtime black hole servers, so blocking it can break them.
Unbound’s equivalent is private-address, documented in unbound.conf. Matching A, AAAA, SVCB and HTTPS records are removed from answers, and private-domain names the domains still allowed to contain private addresses. No private addresses are enabled by default, so you list them yourself:
server:
private-address: 10.0.0.0/8
private-address: 172.16.0.0/12
private-address: 192.168.0.0/16
private-address: 169.254.0.0/16
private-address: fd00::/8
private-address: fe80::/10
private-address: ::ffff:0:0/96
private-domain: "home.example.com"
The last private-address line matters: the Unbound documentation notes that adding ::ffff:0:0/96 stops IPv4-mapped IPv6 addresses from bypassing the filter. Like dnsmasq, Unbound advises against filtering 127.0.0.0/8 if you rely on DNS blocklists.
Why does Host header validation defeat rebinding?
Because the browser still believes it is talking to the attacker’s hostname, it says so in every request. HTTP requires a user agent to send the target’s host in the Host header (or :authority in HTTP/2 and HTTP/3), as RFC 9110 §7.2 describes. The rebound request that reaches the router looks like this. Example request (illustrative):
GET /status HTTP/1.1
Host: rebind.example.net
Accept: */*
A router that expects to be reached as 192.168.1.1 or router.home.example.com can see that rebind.example.net is not one of its names and refuse to answer. RFC 9110 §7.4 describes this case directly: a Host value that doesn’t match the connection “might indicate an attempt to bypass security filters, trick the server into delivering non-public content, or poison a cache”. The 2007 paper proposed the same idea as “host name authorization”. It works no matter which resolver the victim uses or which browser they run, which is why it belongs in the device itself.
How do you prevent DNS rebinding?
- Enable rebind protection on your DNS resolver. Resolvers built on dnsmasq (including many router firmware images and Pi-hole) can drop any answer that resolves a public-looking query to a private IP range, stopping the attack before a browser ever sees the rebound address.
- Never rely on source network location as authentication. The OWASP SSRF Prevention Cheat Sheet makes the same point for server-side requests: validating a hostname once and trusting it afterward doesn’t hold, because the IP behind that hostname can legitimately change between the check and the connection. Internal admin interfaces should require their own login, not just “came from inside the network.”
- Keep DNS answer TTLs sane on infrastructure you control, and be suspicious of unusually short TTLs on third-party domains your internal tooling trusts automatically.
- Segment management interfaces so that even a successful rebind against one device can’t reach others — a flat network makes every additional device reachable the moment one DNS resolver fails to filter correctly.
| Layer | Control | What it stops | What it misses |
|---|---|---|---|
| Resolver | dnsmasq stop-dns-rebind, Unbound private-address | Private answers for public names | Devices that use a different resolver, such as a hard-coded public one |
| Device | Host header check plus a real login | Rebound requests, whatever the DNS path | Devices that skip the check |
| Browser | Local Network Access permission | Silent public-to-local requests | Older or non-supporting browsers |
| Network | Separate management VLAN | Reach from ordinary clients | Attacks from a browser inside that VLAN |
A resolver filter is quick to turn on; device-side checks still hold when the resolver is bypassed.
Related checks
DNS rebinding and certificate validation solve adjacent but different problems — one is about which IP a hostname is allowed to resolve to, the other is about whether the server on the other end is who it claims to be. See our guide on reading a TLS/SSL certificate check result for the latter, and is my router’s DNS hijacked for a related but distinct DNS-tampering scenario worth ruling out on the same network.
This guide is general information, not a security audit of your specific network — see our disclaimer for what AdminKit's guidance does and does not commit to.
Frequently asked questions
What is DNS rebinding in plain terms?
It's a technique that tricks a browser's same-origin security check, which only looks at a hostname, by changing what IP address that hostname resolves to after the page has already loaded. The browser keeps treating later requests as same-origin because the hostname never changed, even though the IP behind it now points inside your own network instead of the attacker's server.
Is this a flaw in a specific browser?
No — it's a structural gap between how DNS (which maps names to addresses, and can change that mapping at any time) and the same-origin policy (which checks names, not addresses) interact. Every mainstream browser is exposed to the same underlying mechanism unless something else in the stack — a resolver, a firewall, or the target server itself — refuses the rebound request.
Does HTTPS on my internal devices prevent this?
Only partially. TLS proves the server presented a certificate for that hostname, but if an internal device doesn't actually enforce certificate validation, or the attack targets a plain HTTP admin page (common on routers and IoT hubs), TLS does nothing to stop the rebind. The real fix has to happen at the DNS resolver or the target device's own request validation, not the transport encryption.
How do routers and resolvers defend against DNS rebinding today?
Many consumer router firmware images and DNS resolvers (dnsmasq, Pi-hole, and similar) ship a 'rebind protection' option that drops any DNS answer pointing to a private address range when the query came from a public-facing lookup, closing the attack at the resolver before it ever reaches a browser.
How do I check if my own setup is vulnerable?
Confirm whether your router or local DNS resolver has rebind protection enabled — it's often on by default on modern firmware but worth verifying explicitly, especially on older or replaced router firmware. Use AdminKit's DNS lookup tool to inspect what a given hostname actually resolves to and how its TTL behaves, which is the first signal worth checking.
Sources
- RFC 1918 — Address Allocation for Private Internets
- OWASP Server-Side Request Forgery Prevention Cheat Sheet
- Jackson, Barth, Bortz, Shao, Boneh — Protecting Browsers from DNS Rebinding Attacks (UC Berkeley TRUST project)
- dnsmasq manual page (--stop-dns-rebind, --rebind-localhost-ok, --rebind-domain-ok)
- Unbound documentation — unbound.conf (private-address, private-domain)
- WICG — Local Network Access (Draft Community Group Report)
- RFC 9110 — HTTP Semantics (Host header, rejecting misdirected requests)
Want AdminKit to watch this for you?
Free checks tell you the state today. Protective DNS and monitoring tell you when it changes.
Talk to an expert
Huy Nguyen (David), Founder & CEO, Netbase JSC
Ask whether this fix applies to your setup, or get a second pair of eyes on your DNS and mail records.