Response playbooks, investigation guides, and Atomic Red Team tests are Pro-only. Upgrade to unlock the full detection package for THREAT-DNSTunneling-Exfiltration.
Upgrade to ProDetect Data Exfiltration via DNS Tunneling Tools in Google Chronicle
Adversaries who cannot or will not exfiltrate over HTTP/S turn to DNS tunneling — encoding stolen data into the subdomain labels of outbound DNS queries and relying on an adversary-controlled authoritative nameserver to reassemble it. Because DNS is almost never blocked at the perimeter and is rarely inspected payload-by-payload, tools such as iodine, dnscat2, dns2tcp, DNSExfiltrator, and Cobalt Strike's DNS beacon can move stolen files, credential dumps, and keystrokes out of even tightly firewalled networks a few dozen bytes at a time. OilRig/APT34 has repeatedly used custom DNS tunneling malware (Helminth, DNSpionage) against Middle Eastern targets, and DNS-based exfiltration is a standard feature of numerous commodity C2 frameworks. The technique is distinct from generic 'Exfiltration Over C2 Channel' (T1041) because the DNS tunnel is frequently a dedicated side-channel independent of the primary C2 protocol, and from the base T1048.003 record because tunneling tools have identifiable protocol fingerprints (query volume, label entropy, label-length skew) beyond simple unencrypted-protocol abuse.
MITRE ATT&CK
- Tactic
- Exfiltration
YARA-L Detection Query
rule dns_tunneling_exfiltration {
meta:
author = "df00tech"
description = "Detects DNS tunneling exfiltration via long-label query volume and label cardinality"
severity = "HIGH"
mitre_attack_tactic = "Exfiltration"
mitre_attack_technique = "T1048.003"
reference = "https://attack.mitre.org/techniques/T1048/003/"
events:
$e.metadata.event_type = "NETWORK_DNS"
$e.network.dns.questions.name = $qname
re.regex($qname, `^[A-Za-z0-9+/_=-]{20,}\.`)
$apex = re.capture($qname, `\.([A-Za-z0-9-]+\.[A-Za-z0-9-]+)$`)
$hostname = $e.principal.hostname
match:
$hostname, $apex over 1h
outcome:
$query_count = count($qname)
$unique_labels = count_distinct($qname)
condition:
$e and $query_count >= 50 and $unique_labels >= 40
} Chronicle YARA-L 2.0 rule matching NETWORK_DNS UDM events with long first labels, bucketed by hostname and apex domain over a 1-hour window using YARA-L's match/outcome aggregation. Flags groups with 50+ long-label queries and near-1:1 unique-label cardinality — the same volume and cardinality fingerprints used in the kql/spl scoring model, since Chronicle's DNS UDM event does not reliably expose record type for endpoint-sourced DNS telemetry either.
Data Sources
Required Tables
False Positives & Tuning
- CDN/cloud edge hostnames with legitimately long, high-entropy subdomain labels
- DNS-based service discovery or load-balancing systems issuing high query volumes
Other platforms for THREAT-DNSTunneling-Exfiltration
Testing Methodology
Validate this detection against 2 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Simulated DNS Tunneling via Base32-Encoded Subdomain Query Burst
Expected signal: Sysmon Event ID 22 (DNS Query): 40 events with QueryName first-labels of 25-30 characters (Base64-derived), resolving against the internal test apex domain, initiated by powershell.exe. The queries will fail to resolve (no authoritative server configured) but the query attempt itself generates the required telemetry.
- Test 2High-Frequency Long-Label DNS Query Burst via nslookup
Expected signal: Sysmon Event ID 22: 25 DNS query events for nslookup.exe with 28-character random alphanumeric first labels at ~2-second intervals against the same test apex domain. Windows DNS Client operational log may also capture the resolution attempts.
References (7)
- https://attack.mitre.org/techniques/T1048/003/
- https://attack.mitre.org/techniques/T1041/
- https://www.us-cert.gov/ncas/alerts/TA18-106A
- https://github.com/yarrick/iodine
- https://github.com/iagox86/dnscat2
- https://www.mandiant.com/resources/blog/dnspionage-brings-new-tools
- https://github.com/SigmaHQ/sigma/tree/master/rules/network/dns
Unlock playbooks & atomic tests with Pro
Get the full detection package for THREAT-DNSTunneling-Exfiltration — response playbook and atomic red team tests, plus investigation guidance and hunting queries.
df00tech Pro — £29/user/month
Related Detections
Tactic Hub
Detection Variants (2)
Different telemetry and tradecraft for the same technique — pick the one that matches the data you collect.
- THREAT-DNSTunnel-ExfilDNS Tunneling for Covert Data ExfiltrationUse for network-side DNS visibility — Zeek/Infoblox resolver logs and pcap; catches tunneling from hosts with no endpoint agent.
- THREAT-Exfiltration-ICMPTunnelData Exfiltration via ICMP TunnelingUse when the carrier is ICMP rather than DNS — pairs ping/tunneler process flags with firewall, NetFlow or Zeek ICMP records, which EDR network telemetry does not log.