Join our Newsletter — 33% off our NHI Course
Home› Guides› DNS Rebinding Guide: How Browsers Reach Internal Services…
Guide Network Security

DNS Rebinding Guide: How Browsers Reach Internal Services and How to Block It

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 27 November 2026 13 min read
On this page

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-address and dnsmasq --stop-dns-rebind drop 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:

  1. 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.
  2. 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.
  3. 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.
  4. 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

TargetWhy it is exposedTypical consequence
Home and SOHO routers, printers, cameras, NASWeb admin panels on private addresses, often with default or no credentialsConfiguration change, DNS hijack of the whole network, data exposure
Developer tools on localhostDev servers, debuggers, notebook servers and build dashboards bound to 127.0.0.1 and trusting local callersSource code and secret disclosure, code execution through tool features
Local AI agent and MCP serversStreamable HTTP servers on localhost that accept tool callsTool invocation with the user's local credentials and files
Internal web apps and admin consolesReachable from the corporate network, assumed safe because they are not internet-facingData read, unauthenticated admin actions
Cloud metadata servicesLink-local endpoints such as 169.254.169.254 reachable from workloads that run browsers or headless renderersTheft 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 with Access-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 LocalNetworkAccessAllowedForUrls to 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 layerSettingNotes
Unboundprivate-address: for each internal range, private-domain: for internal zones that legitimately resolve to private spaceNo 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 domainsRejects 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 serviceRebinding or private-answer protection where the service offers itConfirm in the provider's documentation that answers in RFC 1918 and loopback ranges are stripped for public names.
Split-horizon internal DNSServe internal names only from internal authoritative zonesLets you filter private answers from external resolution without breaking internal names.
Network egress and segmentationBlock workstations from reaching device management interfaces they do not administerLimits 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 Host header 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's ALLOWED_HOSTS is an example: with DEBUG on and the list empty it accepts only .localhost, 127.0.0.1 and [::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 Origin header 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

LayerControlStopsGap
ServiceHost allow list, Origin check, authenticationRebinding against that service from any browserOnly covers services you control or can configure
BrowserChrome Local Network Access, managed allow list policyPublic pages reaching local and loopback addresses without consentUser can grant; other browsers and some transports not covered
ResolverStrip private answers for public namesThe rebind step for every client on the resolverBypassed by external DoH; loopback usually exempt
NetworkSegmentation and egress rules to management interfacesReach to devices the user does not administerDoes 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.

  1. Inventory listeners: list TCP listeners on developer and admin workstations (for example with ss -ltnp or netstat -ano) and flag HTTP services on 127.0.0.1 or 0.0.0.0 without authentication.
  2. Check Host handling: send a request to each internal service with an unrelated Host value from an approved test client. A 200 response with real content means the service would serve a rebound request; expect 400 or 421.
  3. Check Origin handling: repeat with a foreign Origin on state-changing and WebSocket endpoints.
  4. 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.
  5. 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.
  6. Roll back safely: enable resolver filtering on one site or pilot group first, add private-domain or --rebind-domain-ok exceptions 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

FrameworkReferenceRelevance
MITRE CAPECCAPEC-275 DNS RebindingAttack pattern definition
MITRE ATT&CKT1189 Drive-by Compromise; M1021 Restrict Web-Based Content; M1037 Filter Network TrafficBrowser-borne initial access and the mitigations that apply
NIST SP 800-53 Rev. 5SC-7 Boundary Protection; SC-21 Secure Name/Address Resolution Service (Recursive or Caching Resolver); SC-22 Architecture and Provisioning for Name/Address Resolution ServiceNetwork boundary and resolver controls
NIST CSF 2.0DE.CM-01 networks and network services monitored; ID.RA-01 vulnerabilities identifiedMonitoring 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 LocalNetworkAccessAllowedForUrls list 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

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

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.