DNS rebinding: one name, two addresses
DNS rebinding is an attack in which a host name is first answered with an address the attacker controls and later with an address on a private network. The browser keeps treating the name as one site, so script delivered by the attacker's page can read replies from a service that was never meant to be reachable from the internet. That service does not need a conventional vulnerability. It only needs to trust everyone who can reach it.
Quick facts
- Attack pattern
- CAPEC-275: DNS rebinding, in the MITRE catalogue of attack patterns
- Where it runs
- In the victim's browser. The target is whatever that browser can reach
- Core trick
- One host name, answered first with the attacker's address and later with a private one
- Private ranges
- RFC 1918 reserves 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16
- Related OWASP category
- A02:2025 Security Misconfiguration, where unauthenticated internal services fit
- Does a WAF stop it?
- Only at the margin. The requests travel between a browser and a private network. The fixes sit on the service, the resolver and the browser
The attack description follows CAPEC-275 and the Private Network Access draft; the origin definition is from MDN. No working procedure is given here, only what a defender needs to recognise.
How DNS rebinding works
The attacker needs a domain name and a DNS server that answers for it. A visitor is lured to a page under that name, by a link, an advert or a frame on another site. The first DNS answer points to the attacker's own web server, which returns an ordinary-looking page with a script in it.
Every DNS answer carries a time to live, the interval for which it may be cached before the source should be asked again (RFC 1035, section 3.2.1). The attacker sets it short. When the script makes its next request to the same name, the old answer has expired, the browser asks again, and the reply is now an address on a private network: one of the blocks in RFC 1918, or a loopback address on the visitor's own machine.
That request goes to the internal service. Nothing visible changed for the browser: same name, same scheme, same port. It attaches the response to the page's origin, so the script can read it and pass it back out. CAPEC-275 describes the effect as the browser querying an internal host on the attacker's behalf.
What the attacker does not need
No foothold on the internal network. No stolen credential. The visitor's browser supplies the route, because it sits on the inside and speaks to the outside at the same time. The exposure comes from where the browser is, which is why the usual perimeter thinking does not cover it.
Why the same-origin policy does not help
The browser's same-origin policy lets a page read replies only from its own origin. MDN defines two URLs as having the same origin when protocol, port and host are the same. The host there is a name. The check never asks which address the name currently points to, so when the address changes underneath an unchanged name, the policy sees nothing to object to.
CORS does not help either. It exists to relax the policy for deliberate cross-origin reads, and a rebound request is not cross-origin from the browser's point of view. The reverse mistake, a server that grants cross-origin access too freely, is covered under CORS misconfiguration.
One limit is worth knowing, because it points to a defence. Cookies belong to a name. The cookies a visitor holds for an internal service's own name are not sent to the attacker's name. The services that suffer are therefore the ones that need no login at all, on the reasoning that only trusted machines can reach them.
What can be reached
Anything the visitor's browser can route to and that answers HTTP. Typical candidates are the admin pages of routers and printers, internal dashboards, and development or desktop tools that listen on the loopback interface. MDN's page on local network access describes attacks that begin with a website reaching a user's router, which shows why browser vendors treat the local network as a boundary.
What follows depends on the service. Reading what it returns may already be the damage: configuration pages, stored records, tokens shown in a status screen. A service that accepts state-changing requests without a login can be told to do things as well. Neither needs a flaw in the service beyond trusting its network.
Neighbouring attacks
Host header injection. A rebound request reaches the service carrying the attacker's name in the Host header. That is the detail a defender can use, since the service can see a name that is not its own. The Host header and how applications misuse it are covered under host header injection.
SSRF. In server-side request forgery the vulnerable server makes the request. In rebinding the visitor's browser does, and the attacker's script reads the answer. A server-side fetcher that resolves a name once to check it and again to connect has a timing problem of the same shape.
Subdomain takeover. A subdomain takeover captures a name your organisation owns through a dangling record. Rebinding uses a name the attacker owns and changes what it answers. The causes differ; both depend on DNS being trusted more than it should be.
Where a WAF helps and where it does not
The attack runs between a visitor's browser and a service on a private network. A WAF in front of your public site is not on that path, so it neither sees nor stops those requests. Internal services need the controls in the next section; they live on the service, at the resolver and in the browser.
The filter has a narrower use. When one of your applications answers any Host value, a request that arrives with a name that is not yours is visible in the request, and can be flagged or refused if the list of valid names is known. If the same application is also reachable on an internal address, requests sent straight to that address never pass the edge, so the check belongs in the application too.
Bridge WAF matches named categories on the request and records what matched. It works in three modes, off, monitor and block, and which categories flag a given Host value depends on the rules in use. Start in monitor mode: matches are recorded and every request is still served. Read the activity log for real traffic, learn which Host values are genuine, and only then consider block.
How to prevent DNS rebinding
- Validate the Host header on every service. Answer only to the names the service is meant to have and refuse the rest. A rebound request carries the attacker's name and fails. CAPEC-275 lists Host header validation as a mitigation.
- Authenticate internal services. A private address is not a credential. Require a login or token on the office network and on loopback too; the idea behind zero trust is that network location proves nothing.
- Filter answers at the resolver. CAPEC-275 also lists resolvers that refuse to return internal addresses for external names. Some networks legitimately answer private addresses for names in their own zones, so scope the rule to names outside them.
- Follow browser protections. The Private Network Access draft names DNS rebinding as a reason for its checks. According to Chrome's announcement, that effort was put on hold and replaced by Local Network Access, which asks the user for permission; the same post says the prompt was launching in Chrome 142. Check what the browsers your users run actually do before counting on it.
- Close what nobody needs. Default-open admin interfaces and development servers are what OWASP A02:2025 groups under misconfiguration; see also security misconfiguration.
CAPEC-275 also names IP pinning, where a browser keeps the first address it received, as a design mitigation, with the note that it can break legitimate sites. This page does not rely on it.
Questions
What is DNS rebinding?
DNS rebinding is an attack in which a host name first resolves to an address the attacker controls and later to a private address, so the browser treats a service on a private network as the same origin as the attacker's page and lets the page's script read its replies.
Does the same-origin policy stop DNS rebinding?
No. The policy compares scheme, host name and port, and the host name stays the same while the address behind it changes, so the replies from the internal service still count as same-origin.
How do you prevent DNS rebinding?
Validate the Host header on every service, require authentication even on private networks, filter DNS answers so that external names cannot resolve to private addresses, and keep browsers current for their local network access protections.
Can a WAF stop DNS rebinding?
Only in part. The attack runs between a browser and a service on a private network, which an edge filter does not see. A WAF can flag requests that arrive with an unexpected Host value for the applications behind it, but Host validation and authentication belong in the service itself.
How is DNS rebinding different from SSRF?
In server-side request forgery the vulnerable server is tricked into making a request. In DNS rebinding the victim's browser makes the requests and the attacker's script reads the answers.