Skip to content

πŸ§ͺ 06-08: DNS Rebinding Attack

πŸ“Œ Definition

DNS Rebinding is an attack that bypasses the Same Origin Policy (SOP) by changing the IP address of a domain over time.

πŸ‘‰ The browser trusts the domain
πŸ‘‰ But the IP behind that domain changes

πŸ’₯ Result: attacker gains access to internal/private services


🧠 Basic Idea

Normal behavior:

User β†’ visits attacker website
Browser β†’ enforces Same Origin Policy

πŸ‘‰ Cannot access internal network (e.g., 192.168.x.x)


Attack behavior:

  1. User visits: attacker32.com
  2. DNS returns attacker’s server IP
  3. Browser loads malicious JavaScript
  4. DNS changes IP β†’ points to internal device
  5. Same domain, different IP β†’ SOP bypassed

πŸ’₯ Browser now talks to internal device!


🌐 Scenario

  • User VM β†’ 192.168.60.1
  • IoT Device β†’ 192.168.60.80
  • Attacker Server β†’ 10.9.0.180

πŸ‘‰ IoT device is password protected
πŸ‘‰ But inside local network


πŸ”’ Same Origin Policy (SOP)

SOP allows requests only if:

  • Same protocol
  • Same domain
  • Same port

πŸ‘‰ It does NOT check IP changes

⚠️ That is the weakness exploited


πŸ’₯ Attack Flow

  1. User visits attacker website
  2. Attacker serves JavaScript
  3. JavaScript sends requests to attacker domain
  4. DNS changes mapping:
attacker32.com β†’ 10.9.0.180   (initial)
attacker32.com β†’ 192.168.60.80 (after rebinding)
  1. Browser still trusts the domain
  2. Requests now go to IoT device

🧾 Example HTTP Traffic

GET /password HTTP/1.1

POST /temperature?value=88&password=8xk...

πŸ‘‰ Sensitive data is exposed


βš™οΈ DNS Rebinding Setup (Initial Zone File)

$TTL 1

@   IN  SOA ns.attacker32.com. admin.attacker32.com. (
        2008111001
        8H
        2H
        4W
        1D )

@   IN  NS  ns.attacker32.com.

@   IN  A   10.9.0.180
www IN  A   10.9.0.180
ns  IN  A   10.9.0.153
*   IN  A   10.9.0.100

πŸ‘‰ TTL is very low β†’ allows fast IP switching


πŸ”„ DNS Rebinding Modification

@   IN  NS  ns.attacker32.com.

@   IN  A   10.9.0.180
www IN  A   192.168.60.80   ← switched to internal device
ns  IN  A   10.9.0.153
*   IN  A   10.9.0.100

πŸ‘‰ Now same domain points to internal IP


πŸ” Apply Changes

# service named restart

πŸ‘‰ Restart DNS server to apply rebinding


🎯 Why This Works

Component Weakness
DNS TTL Allows fast IP change
Browser Trusts domain, not IP
SOP Does not verify IP change

πŸ’₯ Final Outcome

Before:
attacker32.com β†’ attacker server

After:
attacker32.com β†’ internal IoT device

πŸ‘‰ Browser sends requests to internal network
πŸ‘‰ Attacker controls communication


🚨 Impact

  • Access internal services
  • Steal credentials
  • Control IoT devices
  • Bypass network isolation

🧠 Final Intuition

πŸ‘‰ DNS controls where traffic goes
πŸ‘‰ Browser trusts who (domain name)
πŸ‘‰ Attacker manipulates DNS

πŸ’₯ Trust is broken β†’ attack succeeds