π§ͺ 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:
- User visits: attacker32.com
- DNS returns attackerβs server IP
- Browser loads malicious JavaScript
- DNS changes IP β points to internal device
- 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¶
- User visits attacker website
- Attacker serves JavaScript
- JavaScript sends requests to attacker domain
- DNS changes mapping:
- Browser still trusts the domain
- Requests now go to IoT device
π§Ύ Example HTTP Traffic¶
π 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¶
π 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¶
π 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