
Detecting Exfiltration Over DNS
FreeIdentify DNS tunneling and data exfiltration with Zeek.
Free · Opens the source repo
What Detecting Exfiltration Over DNS does
This skill focuses on detecting DNS-based data exfiltration by analyzing Zeek's dns.log files. Attackers often use DNS tunneling to bypass security controls, encoding stolen data into DNS queries. By evaluating the entropy of subdomains, the length of DNS labels, and the volume of queries, this skill helps identify potential threats that may be hidden in DNS traffic. It is particularly useful for security analysts and incident responders who need to investigate suspicious network activity.
The skill processes Zeek dns.log files in TSV format, extracting relevant fields to analyze each DNS query. It computes Shannon entropy for subdomain components, flagging those that exceed typical entropy levels associated with legitimate DNS queries. Additionally, it identifies queries with long labels, which can indicate data tunneling, and counts unique subdomains per parent domain to detect unusual patterns that may suggest malicious activity.
By generating a comprehensive report that includes flagged domains and their associated risk indicators, this skill provides actionable insights for SOC analysts and threat hunters. It allows teams to validate their security monitoring coverage and refine detection rules for DNS tunneling and exfiltration techniques.
Overall, this skill is essential for cybersecurity professionals looking to enhance their threat detection capabilities in environments where DNS traffic is a potential vector for data exfiltration.
When to use it
Use this skill when investigating potential data exfiltration incidents or when building detection rules for DNS-related threats.
When not to use it
This skill is not suitable for environments without Zeek or those not processing DNS logs, as it relies on specific log formats and analysis techniques.
What you can build with it
Investigating Security Incidents
Use this skill to analyze DNS traffic when you suspect data exfiltration during a security incident.
Building Detection Rules
Leverage the insights from this skill to create detection rules for your security monitoring systems.
Validating Security Coverage
Utilize the skill to assess your organization's monitoring capabilities against potential DNS tunneling threats.
How to install Detecting Exfiltration Over DNS
View source1. Install with the skills CLI
npx skills add mukul975/anthropic-cybersecurity-skills/detecting-exfiltration-over-dns-with-zeek --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by mukul975Detecting Exfiltration over DNS with Zeek
Overview
DNS tunneling and exfiltration is a technique used by attackers to bypass firewalls and DLP controls by encoding stolen data into DNS query subdomains. Legitimate DNS queries have predictable entropy and length patterns, while exfiltration queries contain encoded data with high Shannon entropy, unusually long subdomain labels, and high volumes of unique subdomains per parent domain.
This skill analyzes Zeek dns.log files (TSV format) to detect exfiltration indicators. The agent computes Shannon entropy for each subdomain component, identifies queries exceeding the 63-character DNS label limit, counts unique subdomains per parent domain, and flags domains that exceed configurable thresholds. These techniques detect tools like dnscat2, iodine, dns2tcp, and custom DNS tunneling implementations.
When to Use
- When investigating security incidents that require detecting exfiltration over dns with zeek
- When building detection rules or threat hunting queries for this domain
- When SOC analysts need structured procedures for this analysis type
- When validating security monitoring coverage for related attack techniques
Prerequisites
- Python 3.9 or later with math and collections modules (stdlib)
- Zeek dns.log files in TSV format with standard field headers
- Network capture data processed by Zeek 5.0+ or later
- Understanding of DNS protocol structure and query types
Steps
-
Parse Zeek dns.log headers: Read the TSV file, extract the
#fieldsheader line to identify column positions forts,id.orig_h,query,qtype_name,rcode_name, andanswers. -
Extract and decompose queries: For each DNS query, split the FQDN into subdomain labels and parent domain. Skip queries to known safe domains and internal zones.
-
Compute Shannon entropy: Calculate the information entropy of each subdomain label. Legitimate subdomains typically have entropy below 3.5, while encoded/encrypted data produces entropy above 4.0.
-
Detect long labels: Flag DNS labels exceeding 52 characters (approaching the 63-character maximum). Long labels are a strong indicator of data tunneling.
-
Count unique subdomains per domain: Track how many distinct subdomains each parent domain receives. Domains with more than 50 unique subdomains within the log window are suspicious.
-
Identify query volume anomalies: Calculate queries-per-minute per source IP per domain. Exfiltration tools generate sustained high-volume query streams that differ from normal browsing.
-
Score and rank domains: Combine entropy, label length, uniqueness count, and query volume into a composite risk score. Rank domains by score and output the top suspicious domains.
-
Generate detection report: Produce a JSON report with flagged domains, their evidence indicators, originating source IPs, and recommended response actions.
Expected Output
{
"analysis_summary": {
"total_queries_analyzed": 145832,
"unique_domains": 3421,
"flagged_domains": 3,
"entropy_threshold": 3.5
},
"flagged_domains": [
{
"domain": "data.evil-c2.com",
"unique_subdomains": 892,
"avg_entropy": 4.72,
"max_label_length": 61,
"source_ips": ["10.0.1.45"],
"risk_score": 9.4,
"indicators": ["high_entropy", "long_labels", "high_subdomain_count"]
}
]
}
Frequently asked questions about Detecting Exfiltration Over DNS
Similar skills
Asset Criticality Scoring for Vulns
Prioritize vulnerabilities based on asset criticality.
Performing Alert Triage with Elastic SIEM
Streamline alert triage processes in Elastic Security.
Active Directory Vulnerability Assessment
Secure your Active Directory with comprehensive assessments.
Active Directory Investigation
Streamline your Active Directory compromise investigations.
Parsing Artifacts with Eric Zimmerman Tools
Efficiently parse Windows forensic artifacts for analysis.
Operationalizing MISP Threat Feeds
Enhance threat detection with curated MISP feeds.
