Use this when data or command-and-control may be hidden in DNS queries.
DNS Tunneling
DNS tunneling hides data or command-and-control traffic inside DNS queries and responses, such as long encoded subdomains. Detect it by unusually long names, high query volumes and rare TXT or NULL records.
1. DNS tunnelling hides data or C2 in DNS queries (TXT/NULL, long labels).
2. Detect by volume, entropy, query types.
3. Block direct outbound DNS.
4. Protective DNS services detect it.
5. Investigate hosts.
data → encoded in DNS queries → attacker domain
Context & applicabilityCommon mistakes · platform/version boundaries
- Endpoints allowed to query external DNS directly (UDP/TCP 53, DoH, DoT).
- Logging only blocked queries, not all queries.
- Ignoring TXT and NULL record volume.
- Allow-listing CDNs and cloud domains that attackers also use for tunnels.
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Detection Verify boundary
- Long, high-entropy subdomains (
a9f3k...x.evil.com) and many unique names under one domain. - High query volume or TXT/NULL record queries from one host.
- Queries directly to external resolvers bypassing the internal one.
Tools: DNS analytics in the SIEM, Zeek dns.log, Infoblox/Cisco Umbrella detection. Block direct outbound DNS so all queries pass through monitored resolvers.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Long, random subdomains are a sign.
- High query volume to one domain is a sign.
- TXT and NULL records carry data.
- DNS logs: long/high-entropy subdomains, high volume to one domain — tunnelling signs
zeek dns.log analysis— queries- Protective DNS alerts — detection
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
DNS tunnelling hides data or command-and-control traffic inside DNS queries and responses, typically by encoding data in long subdomains of an attacker-controlled domain. Because DNS is allowed almost everywhere, it can bypass firewalls that block other outbound traffic.
Detection signals:
| Signal | Why |
|---|---|
| Long, high-entropy subdomains | Encoded data |
| High query volume to one domain | Data transfer |
| Unusual record types (TXT, NULL) at volume | Payload transport |
| Many unique subdomains per domain | Each query carries new data |
Prevention: force all clients to use internal resolvers (block outbound UDP/TCP 53 and known DoH endpoints elsewhere), use protective DNS with tunnelling detection, and log queries for analysis.
Signals
- Long, high-entropy subdomains (
a9f3k2...x.tunnel.evil.com). - Many unique subdomains under one domain.
- Unusual record types (TXT, NULL) in large volumes.
- Steady query rate from one host at odd hours.
Tools: iodine and dnscat2 create tunnels; Zeek dns.log, Suricata rules and protective DNS services detect them. Block by forcing all DNS through internal resolvers.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in DNS Security → DNS Tunneling. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.rfc-editor.org/rfc/rfc4033 · confidence 94%