Community寫作與編輯github.com

yaklang/子域名接管

子域名接管檢測與利用手冊。當目標存在懸空的 CNAME/NS/MX 記錄,指向已撤銷的雲端資源、過期的第三方服務或未認領的 SaaS 租戶時使用,攻擊者可註冊這些資源以在受害者域名下提供內容。

子域名接管 是什麼?

此技能專注於子域名接管漏洞的檢測與利用,這是一種嚴重安全威脅,當域名記錄指向不再由原始所有者控制的雲端服務或第三方平台時發生。它自動掃描懸掛的 CNAME、NS 和 MX 記錄,識別可被註冊的服務實例(如 AWS S3 Buckets、GitHub Pages、Heroku、Azure 等),並提供利用指引。此技能支援 yaklang 平台,透過結合被動列舉(從公共數據庫)與主動驗證(向目標服務發送請求)來運作,以確認接管可行性。最終輸出可執行的利用步驟,幫助安全研究人員在攻擊者之前主動識別並修復這些漏洞。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/yaklang/hack-skills/tree/main/skills/subdomain-takeover

Installed? Explore more 寫作與編輯 skills: steipete/notion, langchain-ai/langchain, bytedance/podcast-generation · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

子域名接管 是做什麼的?

子域名接管檢測與利用手冊。當目標存在懸空的 CNAME/NS/MX 記錄,指向已撤銷的雲端資源、過期的第三方服務或未認領的 SaaS 租戶時使用,攻擊者可註冊這些資源以在受害者域名下提供內容。

概述

子域名接管漏洞發生在組織建立指向外部服務(例如 AWS S3、GitHub Pages、Heroku、Azure 等)的 DNS 記錄,但隨後刪除或停用該資源而未移除 DNS 記錄時。攻擊者可註冊該資源(例如在 AWS 建立相同的 S3 Bucket)並透過該域名提供任意內容,導致權限提升、憑證竊取或聲譽受損。

支援的服務

  • AWS S3 - 檢查懸空的 CNAME 並驗證 S3 Bucket 是否可註冊
  • GitHub Pages - 偵測指向未設定自訂域名的 GitHub Pages 的 CNAME 記錄
  • Heroku - 驗證 Heroku 應用程式是否存在
  • Azure - 檢查 Azure 服務的接管
  • CloudFront - 偵測棄用的 CloudFront 分配

使用方式

偵測流程

  1. 被動列舉: 使用公共數據庫(如 crt.sh、SecurityTrails)收集子域名
  2. DNS 解析: 針對每個子域名,取得 CNAME、NS、MX 記錄
  3. 服務比對: 將記錄值與已知的懸浮服務模式比對
  4. 主動驗證: 向目標服務發送 HTTP 請求,檢查是否返回「未找到」或「無效」錯誤

利用步驟

一旦確認可接管:

  1. 在對應的雲端平台註冊資源(例如在 AWS 建立同名的 S3 Bucket)
  2. 上傳任意內容(使用平台提供的預設或自訂標頭)
  3. 等待 DNS 傳播(通常幾分鐘內)
  4. 使用 CTF 的漏洞利用代碼進行驗證

工具整合

  • subfinder: 被動子域名枚舉
  • httpx: HTTP 服務探測
  • nuclei: 針對特定服務的模板化掃描

參考資料

注意事項

  • 永遠不要接管未經明確授權的子域名
  • 修復優先於利用:通知相關團隊移除懸浮的 DNS 記錄
  • 使用孤立的測試環境進行練習

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

yaklang/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.

yaklang/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.

yaklang/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.

yaklang/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.

yaklang/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.

yaklang/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.

yaklang/anti-debugging-techniques

Anti-debugging detection and bypass playbook. Use when reversing protected binaries that detect debuggers via ptrace, PEB flags, timing checks, or signal/exception handlers on Linux and Windows.

yaklang/api-auth-and-jwt-abuse

API authentication and JWT abuse playbook. Use when testing bearer tokens, API keys, claim trust, header spoofing, rate limits, and API auth boundary weaknesses.

yaklang/api-authorization-and-bola

API authorization and BOLA testing playbook. Use when APIs expose object identifiers, nested resources, hidden writable fields, or weak function-level authorization.

yaklang/api-recon-and-docs

API reconnaissance and documentation review playbook. Use when discovering endpoints, schemas, versions, OpenAPI specs, hidden docs, and surface area for API testing.

yaklang/api-sec

Entry P1 category router for API security. Use when choosing between API recon, authorization, token abuse, and hidden-parameter workflows before any deeper API topic skill.

yaklang/arbitrary-write-to-rce

Arbitrary write to RCE playbook. Use when you have an arbitrary write primitive (from heap exploitation, format string, or OOB write) and need to convert it into code execution by targeting GOT, hooks, _IO_FILE vtable, exit_funcs, TLS_dtor_list, modprobe_path, .fini_array, or C++ vtables.

yaklang/authbypass-authentication-flaws

Authentication bypass testing playbook. Use when assessing login flows, password reset logic, account recovery, MFA bypass, token predictability, brute-force resistance, and session boundary flaws.

yaklang/auth-sec

Entry P1 category router for authentication and authorization. Use when testing login flows, sessions, object authorization, JWT, OAuth, CORS, CSRF, and enterprise SSO weaknesses before any deeper auth topic skill.

yaklang/binary-protection-bypass

Binary protection bypass playbook. Use when identifying and bypassing ASLR, PIE, NX/DEP, stack canary, RELRO, FORTIFY_SOURCE, CET, and MTE protections in ELF binaries to enable exploitation.

yaklang/browser-exploitation-v8

Browser and V8 exploitation playbook. Use when exploiting JavaScript engine vulnerabilities including JIT type confusion, incorrect bounds elimination, and V8 sandbox bypass to achieve renderer RCE and sandbox escape in Chrome/Chromium.

yaklang/business-logic-vuln

Entry P1 category router for business logic testing. Use when workflow abuse, race conditions, pricing flaws, or multi-step state attacks matter more than parser-level input injection.

yaklang/business-logic-vulnerabilities

Business logic vulnerability playbook. Use when reasoning about workflows, race conditions, price manipulation, coupon abuse, state machines, and multi-step authorization gaps.

yaklang/classical-cipher-analysis

Classical cipher analysis playbook. Use when encountering substitution ciphers, Vigenere, transposition, XOR, or encoded text in CTF challenges that requires frequency analysis, Kasiski examination, or known-plaintext cryptanalysis.

yaklang/clickjacking

Clickjacking playbook. Use when testing whether target pages can be framed, whether X-Frame-Options or CSP frame-ancestors are properly configured, and whether UI redress attacks can trigger sensitive actions.

相關技能