DNS rebinding lets a web page that a user visits turn their browser into a relay into the network behind it, reaching routers, admin consoles, developer tools and local agent servers that were never meant to face the internet. It works because browsers enforce the same-origin policy on host names, not on the IP addresses those names resolve to. This guide explains the mechanism at a defensive level, what is exposed, and the controls at each layer that stop it: browser Local Network Access, resolver filtering of private ranges, and Host and Origin header validation in the services themselves. It is written for network and application security engineers, and for teams that ship software which listens on localhost. It contains no attack tooling or step-by-step attack procedure.
Key takeaways
- The browser is the bridge. A rebinding page keeps the same origin while its host name starts resolving to a private or loopback address, so scripts can talk to internal services from inside the user's network.
- Fix it in the service first. Validating the Host header against an allow list, and the Origin header on state-changing or streaming endpoints, defeats rebinding regardless of browser or resolver.
- Filter private answers at the resolver. Unbound
private-addressand dnsmasq--stop-dns-rebinddrop public names that resolve to internal ranges, which protects every device that uses that resolver. - Browser protection is now real but partial. Chrome 142 gates requests from public sites to local and loopback addresses behind a Local Network Access permission; other browsers and older builds may not, so never rely on it alone.
- Localhost is not a security boundary. Developer servers, local MCP servers and device admin panels that trust any request from 127.0.0.1 without authentication are the most common real exposure.
How DNS rebinding works
The same-origin policy treats http://site.example:8080 as one origin whatever IP address the name points to. A rebinding attack exploits that gap. MITRE CAPEC lists it as CAPEC-275 DNS Rebinding, linked to CWE-350 (reliance on reverse DNS resolution for a security-critical action). In outline:
- The lure: a user loads a page from a domain whose authoritative DNS the attacker controls. The first answer points to a public server that delivers script.
- The rebind: later lookups for the same name, often with a very short TTL, return a private or loopback address such as an RFC 1918 range or 127.0.0.1.
- The same-origin request: the script makes requests to its own origin. The browser now connects to the internal address but still treats the response as same-origin, so the script can read it.
- The action: the script reads data from, or sends commands to, the internal service and can relay results back out.
Two details explain most defensive choices. First, the request carries the attacker's host name in the Host header, not the internal service's real name or IP, which is why Host validation works. Second, cookies for the internal service are not sent, because the browser sees a different site; services that need no authentication, or that trust the source address, are the ones at risk.
DNS rebinding differs from server-side request forgery. In SSRF the server makes the request; in rebinding the victim's browser does. Rebinding can also be used to bypass SSRF filters that check a host name once and connect later. See the SSRF Prevention Guide.
What is at risk
| Target | Why it is exposed | Typical consequence |
|---|---|---|
| Home and SOHO routers, printers, cameras, NAS | Web admin panels on private addresses, often with default or no credentials | Configuration change, DNS hijack of the whole network, data exposure |
| Developer tools on localhost | Dev servers, debuggers, notebook servers and build dashboards bound to 127.0.0.1 and trusting local callers | Source code and secret disclosure, code execution through tool features |
| Local AI agent and MCP servers | Streamable HTTP servers on localhost that accept tool calls | Tool invocation with the user's local credentials and files |
| Internal web apps and admin consoles | Reachable from the corporate network, assumed safe because they are not internet-facing | Data read, unauthenticated admin actions |
| Cloud metadata services | Link-local endpoints such as 169.254.169.254 reachable from workloads that run browsers or headless renderers | Theft of workload credentials |
The local agent case matters for identity teams. The Model Context Protocol specification for the Streamable HTTP transport states that servers must validate the Origin header on all incoming connections to prevent DNS rebinding, should bind only to 127.0.0.1 when running locally rather than all interfaces, and should authenticate all connections. A local server that ignores this lets any web page act with whatever API keys and tokens the server holds. See the Local MCP Server Security Guide.
Browser protections
Browser defences have changed several times, so check the current state for the browsers you manage.
- Private Network Access (PNA): a WICG specification, published as a Draft Community Group Report dated 26 September 2024 (not a W3C Standard), previously called CORS-RFC1918. It classifies addresses as public, private and local and requires a CORS preflight carrying
Access-Control-Request-Private-Network, answered withAccess-Control-Allow-Private-Network: true, before a public page can reach a private address. It applies the check to the address actually connected to, for each new connection, which addresses rebinding directly. Google has said Chrome put PNA on hold in favour of Local Network Access. - Local Network Access (LNA) in Chrome: Chrome 142, released on 28 October 2025, restricts requests from a public site to a local IP address or loopback, and from a local site to loopback, behind a user permission prompt available only in secure contexts. Google's documentation lists WebSockets, WebTransport and WebRTC as not yet gated in the first milestone, and Microsoft documents enforcement extending to WebRTC from Chrome 146.
- Enterprise policy: Chromium-based Chrome and Edge support
LocalNetworkAccessAllowedForUrlsto pre-approve specific sites that legitimately need local network access. Keep that list short and owned, because every entry re-opens the path for that origin. - Other browsers: as of Microsoft's eCDN documentation checked in November 2026, Firefox had similar restrictions in Nightly but not in the release channel. Treat non-Chromium browsers, embedded webviews and headless renderers as unprotected unless you have confirmed otherwise.
Two limits remain even where LNA is on. A user can grant the prompt, and a page served from an internal origin is not treated as public. Browser controls reduce exposure; they do not replace server-side checks. See the Browser Security Hardening Guide.
Resolver and network defences
A recursive resolver can refuse to return private addresses for public names, which breaks the rebind step for every client that uses it.
| Resolver or layer | Setting | Notes |
|---|---|---|
| Unbound | private-address: for each internal range, private-domain: for internal zones that legitimately resolve to private space | No private addresses are filtered by default. Unbound documents adding 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16, fd00::/8 and fe80::/10, plus ::ffff:0:0/96 so IPv4-mapped IPv6 answers cannot bypass the filter. Loopback is left out by default because blocklists use it. |
| dnsmasq (common in routers) | --stop-dns-rebind, with --rebind-domain-ok for internal domains | Rejects and logs upstream answers in private ranges, including IPv4-mapped, link-local and ULA IPv6. --rebind-localhost-ok exempts 127.0.0.0/8 and ::1 if a blocklist service needs it. |
| Protective DNS service | Rebinding or private-answer protection where the service offers it | Confirm in the provider's documentation that answers in RFC 1918 and loopback ranges are stripped for public names. |
| Split-horizon internal DNS | Serve internal names only from internal authoritative zones | Lets you filter private answers from external resolution without breaking internal names. |
| Network egress and segmentation | Block workstations from reaching device management interfaces they do not administer | Limits what a rebound browser can reach even if DNS filtering fails. |
Resolver filtering has gaps. Clients that use DNS over HTTPS to an outside resolver bypass your filter, so enforce the managed resolver through browser policy and egress rules. The filter cannot cover loopback without breaking blocklists, and it does not help a laptop off the corporate network. See the Protective DNS Guide and the DNS Security Guide.
Application-side defences
Service owners can close rebinding without depending on any client. Apply these to anything that listens on localhost or an internal address.
- Host header allow list: reject any request whose
Hostheader is not one of the names or addresses the service is meant to answer to. A rebound request carries the attacker's domain, so it fails. Django'sALLOWED_HOSTSis an example: withDEBUGon and the list empty it accepts only.localhost,127.0.0.1and[::1], and in production unmatched hosts get HTTP 400. Avoid wildcard*values. See the Host Header Attacks and Validation Guide. - Origin validation: for state-changing requests, WebSocket upgrades and streaming endpoints, check the
Originheader against an allow list. This is the control the MCP specification makes mandatory. - Authentication even on localhost: require a token or session for every request. A random per-install token held by the legitimate client, or a Unix domain socket or named pipe instead of TCP, removes the browser's path entirely.
- Bind narrowly: listen on 127.0.0.1 or ::1, never 0.0.0.0, unless remote access is a requirement.
- HTTPS with a real name: a TLS service with a certificate for its own name will fail the handshake for a rebound attacker host name. This suits internal apps more than localhost tools.
- Strict CORS: do not reflect arbitrary origins or send
Access-Control-Allow-Origin: *with sensitive data. CORS does not stop same-origin rebinding on its own, but loose CORS adds a second path. See the CORS Misconfiguration Guide. - Server-side fetchers: when your server fetches user-supplied URLs, resolve once, validate the IP against blocked ranges, and connect to that validated IP, so a second lookup cannot rebind.
Defence by layer
| Layer | Control | Stops | Gap |
|---|---|---|---|
| Service | Host allow list, Origin check, authentication | Rebinding against that service from any browser | Only covers services you control or can configure |
| Browser | Chrome Local Network Access, managed allow list policy | Public pages reaching local and loopback addresses without consent | User can grant; other browsers and some transports not covered |
| Resolver | Strip private answers for public names | The rebind step for every client on the resolver | Bypassed by external DoH; loopback usually exempt |
| Network | Segmentation and egress rules to management interfaces | Reach to devices the user does not administer | Does not protect the user's own machine |
Testing exposure
Test in your own environment with authorisation. The aim is to find services that would answer a rebound request, not to run attacks.
- Inventory listeners: list TCP listeners on developer and admin workstations (for example with
ss -ltnpornetstat -ano) and flag HTTP services on 127.0.0.1 or 0.0.0.0 without authentication. - Check Host handling: send a request to each internal service with an unrelated
Hostvalue from an approved test client. A 200 response with real content means the service would serve a rebound request; expect 400 or 421. - Check Origin handling: repeat with a foreign
Originon state-changing and WebSocket endpoints. - Check the resolver: query a test name you control that resolves to a private address through each managed resolver. The answer should be empty or refused, and the resolver should log the block.
- Check browser policy: confirm the managed Chrome or Edge version is 142 or later, LNA is enforced, and the allow list matches the approved register.
- Roll back safely: enable resolver filtering on one site or pilot group first, add
private-domainor--rebind-domain-okexceptions for internal zones that break, then widen.
Detection and measurement
- Resolver logs: alert on dnsmasq rebind rejections and on public names answering with private addresses; a spike from one client suggests a lure page.
- Service logs: log rejected Host and Origin values; unexpected external domains hitting internal services are a strong signal.
- Metrics: percentage of managed resolvers with private-answer filtering; count of unauthenticated localhost HTTP listeners on managed endpoints; percentage of internal services with a Host allow list; size of the LNA allow list and its review date; percentage of managed browsers on an LNA-enforcing version.
Common failure patterns
- Trusting loopback: a local tool accepts any request from 127.0.0.1 with no token, on the assumption that only the user can reach it.
- Wildcard hosts:
ALLOWED_HOSTS = ['*']or a reverse proxy that forwards any Host header disables the most effective control. - Binding to all interfaces: a dev or agent server listens on 0.0.0.0 and is reachable from the LAN as well as through the browser.
- Filtering at one resolver only: laptops use browser DoH to a public resolver and skip the corporate filter.
- Relying on the browser prompt: users accept the LNA prompt on a convincing page, or the browser fleet includes versions and webviews without it.
- Check then connect in server fetchers: a URL validator resolves the name, approves it, and the HTTP library resolves again and connects to a private address.
Framework mapping
| Framework | Reference | Relevance |
|---|---|---|
| MITRE CAPEC | CAPEC-275 DNS Rebinding | Attack pattern definition |
| MITRE ATT&CK | T1189 Drive-by Compromise; M1021 Restrict Web-Based Content; M1037 Filter Network Traffic | Browser-borne initial access and the mitigations that apply |
| NIST SP 800-53 Rev. 5 | SC-7 Boundary Protection; SC-21 Secure Name/Address Resolution Service (Recursive or Caching Resolver); SC-22 Architecture and Provisioning for Name/Address Resolution Service | Network boundary and resolver controls |
| NIST CSF 2.0 | DE.CM-01 networks and network services monitored; ID.RA-01 vulnerabilities identified | Monitoring resolver blocks; finding exposed listeners |
Practitioner checklist
- Enable private-address filtering on every managed recursive resolver, with explicit exceptions for internal zones.
- Enforce the managed resolver: control browser DoH settings and block outbound DNS to unapproved resolvers.
- Require a Host header allow list and Origin checks on every internal and localhost HTTP service you build or deploy.
- Require authentication on localhost services, including local MCP and agent servers, and bind them to 127.0.0.1.
- Keep managed Chrome and Edge on version 142 or later with Local Network Access enforced, and keep the
LocalNetworkAccessAllowedForUrlslist short and reviewed. - Inventory unauthenticated listeners on developer and admin endpoints each quarter.
- Resolve once and connect to the validated IP in any server-side URL fetcher.
- Alert on rebind rejections and unexpected Host values in service logs.
Standards and references
- MITRE CAPEC: CAPEC-275 DNS Rebinding
- WICG: Private Network Access
- Google Chrome for Developers: Local Network Access
- Google Chrome for Developers: Chrome 142 release notes
- Model Context Protocol: Transports specification
- NLnet Labs: unbound.conf reference
- dnsmasq: manual page
- Django: Settings reference (ALLOWED_HOSTS)
Related NHI Mgmt Group resources: DNS Security Guide · Protective DNS Guide · Host Header Attacks and Validation Guide · Local MCP Server Security Guide · NIST SP 800-81 Rev. 3 Secure DNS Deployment Guide