What Is DNS? Resolution Mechanics and DNS Rebinding Risks Explained

    This article explains what DNS is and how domain name resolution works, from record types such as A, AAAA, CNAME, MX, NS, TXT, and PTR to the recursive lookup path and the role of TTL-based caching. It then examines the browser same-origin policy and shows how DNS rebinding exploits the gap between the hostname used for origin checks and the resolved IP address used for the actual connection. Finally, it outlines why traditional controls often fail and how to reduce the risk across resolution, network, and application layers.

    1. From Names to Addresses: The Problem DNS Solves

    Computers locate each other using IP addresses, but people cannot efficiently memorize long strings of arbitrary numbers. DNS (Domain Name System) was designed to bridge that gap as a distributed naming and resolution system. Its core job can be stated in one sentence: translate human-friendly domain names into IP addresses that machines can route to.

    Beyond the most common record types—A (domain to IPv4 address) and AAAA (domain to IPv6 address)—DNS serves several other roles:

    • CNAME: creates an alias for a domain, often used for site migration and traffic steering;
    • MX: identifies the mail servers that receive email;
    • NS: identifies the authoritative servers for a zone;
    • TXT: carries verification strings, email anti-spoofing policies, and other text data;
    • PTR: reverse resolution, mapping an IP address back to a domain name.

    This design—one system with many record types—makes DNS one of the most critical dependencies of the internet, and therefore a primary target for attackers.

    2. The Resolution Path: What Happens Behind a Single Query

    A typical recursive resolution proceeds roughly as follows:

    1. The client (usually through a stub resolver in the operating system) sends a query to a local recursive resolver;
    2. The recursive resolver checks its own cache first and returns immediately on a hit;
    3. On a miss, it starts from the root zone and works downward, querying the top-level domain zone and then the authoritative zone;
    4. The authoritative server returns the final record, which the recursive resolver caches and passes back to the client.

    Caching is the step that must be emphasized here. To reduce latency and query volume, results are not recomputed every time; they are cached for a period determined by the record’s TTL (Time To Live). A smaller TTL means changes take effect faster but increases query load; a larger TTL improves performance but slows change propagation. TTL is the tuning knob between DNS performance and flexibility—and, as discussed later, a key variable in the security problem.

    The query flow can be abstracted as:

    1. client -> recursive resolver -> root -> tld -> authoritative -> record
    2. | |
    3. +----------- cache(TTL) -----------+

    3. The Same-Origin Policy: A Browser Boundary

    Understanding browser-based DNS attacks requires understanding the Web same-origin policy. Its rule is precise: two URLs are same-origin only when their scheme, domain (hostname), and port are all identical. If any one of them differs, the URLs are cross-origin.

    The same-origin policy restricts script behavior: by default, a script on one page cannot read the DOM or response data of another page with a different origin. Because web applications commonly rely on cookies to maintain session state, this boundary is the foundation for preventing cross-site data leakage.

    Two frequently misunderstood points deserve attention:

    • The same-origin policy governs script reads, not resource loading. Loading cross-origin resources through tags such as img, link, and script is allowed;
    • Form submissions and navigations are not subject to the same-origin read restriction either. CSRF exploits exactly this: the request can be sent and credentials are attached automatically.

    So the same-origin policy does not mean “cross-origin requests cannot happen”; it means “cross-origin responses cannot be read by scripts.” The attacker’s question then becomes: can the browser be made to believe the request is not cross-origin at all?

    4. DNS Rebinding: Making a Domain “Move House” in the Browser’s Eyes

    The core idea of a DNS rebinding attack is to abuse the fact that resolution results can change, bypassing the origin check. The flow is:

    1. The victim visits a domain controlled by the attacker. On first resolution, the domain points to the attacker’s public server, and the page loads and runs its script normally;
    2. The record’s TTL is set to an extremely short value (for example 0 or 1 second) so that browsers and intermediate resolvers barely cache it;
    3. The page script keeps issuing same-origin requests (the hostname never changes, so the browser always treats them as same-origin);
    4. Once the cache expires and resolution happens again, the authoritative server returns an internal address—an enterprise intranet service or the loopback address on the local machine;
    5. The browser now sends the request to the internal target, and because the hostname is unchanged, the script can read the response, exposing the internal service.

    The key is that the origin check uses the hostname while the actual connection uses the resolved IP. The two are decoupled in time, which gives the attacker the ability to switch targets.

    A practice mentioned in the source material encodes two IPs in hexadecimal form into a subdomain and uses a resolution service that alternates between the two addresses, so repeated queries show the result flipping back and forth. To stay neutral, this article references no specific service or domain; the principle can be reproduced as follows:

    1. .attacker.example TTL=1 -> 203.0.113.10 (public, first lookup)
    2. .attacker.example TTL=1 -> 127.0.0.1 (local, after cache expiry)
    3. .attacker.example TTL=1 -> 192.168.32.10 (intranet, after expiry again)

    As long as the client keeps the page open between the two resolutions, the attack chain holds.

    5. Why Traditional Controls Often Miss This Attack

    • The requested hostname is entirely legitimate; at the domain level, attack traffic looks no different from normal visits;
    • The target address is internal or loopback, and traditional access controls built around public IPs often do not block it;
    • The browser’s same-origin policy is satisfied “legitimately,” so script reads of the response are not blocked;
    • Extremely small TTLs make cache-based defenses nearly useless.

    This also explains why a domain blacklist alone has limited effect: both the resolution result and network reachability must be addressed.

    6. Defense: Convergence Across Resolution, Network, and Application Layers

    Layer one, resolution-side controls. Avoid extremely short TTLs for domains involved with untrusted external pages; enable filtering in the recursive resolver for results that resolve to loopback or private address ranges, and refuse to return internal addresses to requests from public sources.

    Layer two, network-side isolation. Apply outbound address validation on the browser access path, blocking traffic from public pages directly to private ranges and loopback addresses; add source validation to internal management interfaces rather than assuming external reachability is impossible.

    Layer three, application-side hardening. Require explicit second confirmation and random tokens for critical operations instead of relying solely on automatically attached cookies; validate the Host header and origin on management interfaces and reject requests with unexpected hostnames; where necessary, bind HTTPS certificates so that tampered resolution results cause the handshake to fail.

    In cloud environments, these can be combined with general-purpose capabilities: a domain resolution service manages records and TTLs centrally, load balancers and network access controls perform address-range filtering, and logging and monitoring services continuously watch for abnormal resolution and abnormal internal access, closing the loop.

    7. Summary

    DNS is essentially a distributed translation system from names to addresses. Its caching and TTL mechanisms deliver performance but also create room for abuse. Rebinding attacks work because they separate the origin check from the actual connection along the time dimension. Once that is clear, defense should not stop at single-point blocking; it must converge on resolution filtering, network isolation, and application validation at the same time so that domain resolution stays both efficient and controllable.