9Fix: DNS RPZ + query rate limiting + anomaly detection
Tunneling detected
DNS RPZ needed
Rate limit DNS
CyberFurl · live DNS lookup ready
Quick summary
Read time
5 min read
Steps to implement
4 steps
Why it matters
DNS tunneling encodes data inside DNS queries to bypass firewalls — used for C2 traffic and exfiltration.
What is DNS tunneling?
DNS tunneling is a technique that encodes data of other programs or protocols within DNS queries and responses to sneak it past firewalls and security controls.
DNS tunneling is essentially smuggling data. Instead of using DNS for its intended purpose—resolving human-readable hostnames to IP addresses—an attacker uses it as a covert communication channel. They pack payloads inside the DNS query itself, sending it out to the internet where their custom authoritative nameserver unwraps it.
If you are already working through , this topic gives you the missing layer between the raw signal and the decision you have to make.
DNS is attractive to attackers because it is almost always permitted. Firewalls that block outbound SSH, FTP, and non-standard HTTP traffic will invariably allow outbound DNS traffic on port 53. If they didn't, the network couldn't function.
Furthermore, high volumes of DNS queries are entirely normal for a busy enterprise. This "noise" allows attackers to blend in, turning a trusted infrastructure protocol into a reliable, unmonitored exit node.
How DNS tunneling works technically
The mechanism relies on the hierarchical nature of DNS routing.
The attacker registers a domain, say evil.com, and sets up a custom authoritative nameserver that they control.
Malware on an infected machine inside a corporate network wants to send a stolen password (password123).
The malware encodes the data (often using base64 or hex) and prepends it as a subdomain to the attacker's domain: cGFzc3dvcmQxMjM.evil.com.
The malware issues a standard DNS lookup for that hostname.
The corporate recursive resolver sees the request, doesn't know the answer, and forwards it to the internet, eventually reaching the attacker's nameserver for evil.com.
The attacker's nameserver receives the query, logs the subdomain (cGFzc3dvcmQxMjM), and decodes it back to password123.
The attacker can then send commands back to the malware encoded in TXT or CNAME records within the DNS response.
Real encoded query example with decoded payload
In practice, a DNS tunneling attempt looks highly irregular on the wire. A standard query looks like this:
DNS Record / Config
Query: mail.google.com. IN A
A tunneling query often utilizes TXT records to return larger payloads, and the query itself looks like gibberish:
In this example, the subdomain ZWFzdGVyZWdn.c2VjcmV0ZGF0YQ is base64 encoded. If we decode it:
ZWFzdGVyZWdn -> easteregg
c2VjcmV0ZGF0YQ -> secretdata
The attacker has successfully exfiltrated the phrase "easteregg secretdata" over the DNS protocol.
Common DNS tunneling tools
Attackers don't write this from scratch; they use established toolkits:
iodine: Allows tunneling IPv4 data through a DNS server. Useful for creating full VPNs over DNS.
dnscat2: Specifically designed to create an encrypted Command-and-Control (C2) channel over DNS.
DNSExfiltrator: Built for moving large amounts of data out of heavily restricted environments.
What attackers use it for
DNS tunneling serves three primary malicious functions:
C2 Channels: Malware beaconing out to an attacker to receive new instructions or payload drops.
Data Exfiltration: Slowly leaking sensitive data (credit cards, source code) out of the network via thousands of small queries.
Firewall Bypass: Evading captive portals (like hotel Wi-Fi) or enterprise egress filters to gain unrestricted internet access.
Important
DNS tunneling was used in the SolarWinds SUNBURST malware campaign. The attackers used a sophisticated Domain Generation Algorithm (DGA) to encode victim data into subdomains and exfiltrate it via DNS queries, remaining undetected for months.
Detection indicators
Detecting DNS tunneling requires behavioral analysis rather than simple signature matching. Look for:
Query Length Anomalies: Most legitimate hostnames are under 15 characters. Tunneling queries frequently approach the 253-character protocol limit.
High TXT Query Volume: TXT records can hold large amounts of data (up to 255 characters per string). A massive spike in TXT queries is a strong indicator of C2 communication.
Entropy Analysis: Legitimate domains (api.weather.com) have low entropy. Base64 encoded strings (x8z9qL2p.evil.com) have high entropy.
Unique Subdomain Count: If a single second-level domain (like evil.com) receives thousands of queries for completely unique subdomains in a short period, it is likely a tunnel.
Defenses
Relying on a single control is insufficient. A defense-in-depth strategy is required:
DNS RPZ (Response Policy Zones): Use threat intelligence feeds to block resolution of known malicious C2 domains at the recursive resolver level.
Query Rate Limiting: Throttle the number of queries a single internal IP can make to a specific external domain.
DNS Firewalling: Implement dedicated DNS security appliances that perform real-time entropy and behavioral analysis.
DNS Monitoring: Log all DNS queries and analyze them offline in a SIEM to detect slow-and-low exfiltration attempts.
Legitimate uses that look similar
Not all strange DNS traffic is malicious. Defenders must tune their tools to ignore:
DNS-over-HTTPS (DoH) Clients: While not tunneling in the traditional sense, DoH encrypts DNS traffic, preventing local inspection and hiding potential tunneling activity from network defenders.
Some VPN Implementations: Certain legitimate VPN products use DNS tunneling to bypass captive portals for road warriors.
Anti-Spam Services: Technologies like DNSBL (DNS Blocklists) send IP addresses encoded as subdomains to query reputation lists, mimicking exfiltration behavior.
Tools to check your Dns Tunneling
Use the CyberFurl public security report when you want to see the live signal on a real domain, and then step back to the See the DNS posture feature page when you need the wider workflow around posture, monitoring, or remediation. That combination is usually much more useful than reading the standard in isolation.
CF
How CyberFurl Helps
Automated monitoring. Zero manual work.
CyberFurl's DNS monitoring layer analyzes query patterns across your domains for anomalies consistent with DNS tunneling — unusually long subdomains, high query volume to a single second-level domain, TXT record abuse, and base64-encoded payloads in subdomain labels. When tunneling indicators are detected, CyberFurl correlates them against known C2 infrastructure and exfiltration tool fingerprints (iodine, dnscat2, DNSExfiltrator) to reduce false positives.
Dns Tunneling can help, but only when the prerequisites and surrounding trust assumptions are also true. The safest answer is to validate the specific path you care about in production, because edge cases around forwarding, intermediaries, browser support, or vendor behavior are often where theory breaks down.
Is DNS tunneling legal?
Sometimes, but the better question is under what conditions it is true. With Dns Tunneling, the answer usually depends on the live configuration, the surrounding protocol behavior, and whether the systems on the other side actually honor the signal the way the documentation suggests.
Does DoH make tunneling worse?
Support depends on the exact receiver, browser, platform, or vendor on the other side. Many ecosystems implement part of Dns Tunneling, but the reliable answer comes from testing the specific product path you care about in production rather than assuming support is universal.
How do I detect on my own resolver?
Start with the live public evidence, not the config file you hope is in production. Once you know what the domain is actually publishing or sending, compare that with the intended posture, make one controlled change, and then validate it again from the outside.
What is Dns Tunneling?
DNS tunneling encodes data inside DNS queries to bypass firewalls — used for C2 traffic and exfiltration. In practice, teams care about Dns Tunneling because it changes a real trust boundary somewhere in the stack and gives them a concrete signal they can validate on the live domain or application.
Does DNS tunneling require a registered domain?
Yes, to reliably route traffic from the victim across the internet back to the attacker's nameserver, the attacker must register a domain and set up custom authoritative nameservers.
Can DNS tunneling be used for legitimate purposes?
Yes, some captive portal login bypasses and certain VPN implementations use DNS tunneling legitimately, but enterprise networks generally treat all DNS tunneling as suspicious.