Detect DNS in CrowdStrike LogScale
Adversaries may communicate using the Domain Name System (DNS) application layer protocol to avoid detection/network filtering by blending in with existing traffic. Commands to the remote system, and often the results of those commands, will be embedded within the protocol traffic between the client and server. The DNS protocol serves an administrative function in computer networking and thus may be very common in environments. DNS traffic may also be allowed even before network authentication is completed. Often known as DNS tunneling, adversaries may abuse DNS to communicate with systems under their control within a victim network while also mimicking normal, expected traffic. DNS beaconing may be used to send commands to remote systems via DNS queries. The commands may be embedded into different DNS records, for example, TXT or A records.
MITRE ATT&CK
- Tactic
- Command and Control
- Technique
- T1071 Application Layer Protocol
- Sub-technique
- T1071.004 DNS
- Canonical reference
- https://attack.mitre.org/techniques/T1071/004/
LogScale Detection Query
#event_simpleName = "DnsRequest"
| DomainName != ""
| RequestType = /TXT|NULL|CNAME|MX|A|AAAA/i
| domain_length := length(DomainName)
| subdomain_parts := count(splitString(DomainName, "."))
| filter { domain_length > 50 or subdomain_parts > 5 }
| regex("(?:[^.]+[.])*(?P<TopDomain>[^.]+[.][^.]+)$", field=DomainName, strict=false)
| groupBy(
[LocalAddressIP4, ComputerName, TopDomain],
function=[
count(as=QueryCount),
count(field=DomainName, distinct=true, as=UniqueSubdomains),
avg(field=domain_length, as=AvgDomainLength),
max(field=domain_length, as=MaxDomainLength),
collect(field=RequestType, limit=10, as=QueryTypes)
]
)
| filter { QueryCount > 20 and UniqueSubdomains > 10 and AvgDomainLength > 40 }
| TunnelConfidence := if(
UniqueSubdomains > 100 and AvgDomainLength > 60, "high",
if(UniqueSubdomains > 50 and AvgDomainLength > 50, "high", "medium")
)
| sort(field=QueryCount, order=desc, limit=200) Detects DNS tunneling (T1071.004) using CrowdStrike Falcon endpoint telemetry in LogScale (CQL). Leverages DnsRequest events captured by the Falcon sensor to identify hosts making high volumes of long, unique subdomain DNS queries. Groups by local IP, hostname, and apex domain, flagging anomalous beaconing patterns consistent with DNS C2 frameworks such as dnscat2, iodine, or Cobalt Strike DNS malleable profiles. Operates over Falcon Data Replicator (FDR) event data streamed into LogScale.
Data Sources
Required Tables
False Positives & Tuning
- CrowdStrike Falcon's own sensor generates DNS queries to cloud backend endpoints containing encoded device identifiers — filter known CrowdStrike infrastructure FQDNs (e.g., ts01-b.cloudsink.net, lfodown01-b.cloudsink.net) by excluding their apex domains from results
- Developer workstations running local Kubernetes clusters (minikube, kind, Docker Desktop) generate high volumes of unique internal DNS queries from service discovery on loopback or bridge interfaces, appearing as long-subdomain bursts
- Windows Defender SmartScreen and Windows Update telemetry services periodically resolve long encoded domain names for routing decisions, generating false positives from managed corporate endpoints during business hours
Other platforms for T1071.004
Testing Methodology
Validate this detection against 3 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 1DNS TXT Record Tunneling Simulation
Expected signal: DNS query logs showing 20 TXT record queries to unique subdomains under c2test.localhost with base32-encoded subdomain prefixes. Sysmon Event ID 22 (if available) showing dig process making DNS queries.
- Test 2DNS Beaconing via nslookup
Expected signal: Sysmon Event ID 22: DNS Query for each nslookup execution with QueryName containing COMPUTERNAME and random values under beacon.localhost. Sysmon Event ID 1: nslookup.exe process creation. 10 queries at 5-second intervals.
- Test 3High-Volume DNS Query Burst
Expected signal: DNS query logs showing 100 A record queries to unique 30-character random subdomains under exfil.localhost in rapid succession. Total estimated data capacity: ~3KB encoded in subdomain labels.
References (7)
- https://attack.mitre.org/techniques/T1071/004/
- https://www.paloaltonetworks.com/cyberpedia/what-is-dns-tunneling
- https://medium.com/@galolbardes/learn-how-easy-is-to-bypass-firewalls-using-dns-tunneling-and-also-how-to-block-it-3ed652f4a000
- https://unit42.paloaltonetworks.com/unit42-oilrig-uses-updated-bondupdater-target-middle-eastern-government/
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1071.004/T1071.004.md
- https://github.com/iagox86/dnscat2
- https://github.com/yarrick/iodine
Unlock Pro Content
Get the full detection package for T1071.004 including response playbook, investigation guide, and atomic red team tests.