DNS tunneling is a technique that encapsulates data within DNS queries and responses to transfer information that would otherwise use another communication protocol.
In a typical DNS lookup, a client requests information about a domain, and a DNS resolver helps return the appropriate record. With DNS tunneling, an attacker encodes commands or other data into DNS messages and configures an attacker-controlled domain and authoritative DNS server to receive or return that information.
DNS tunneling can support legitimate activities, such as authorized security testing, but it is also used maliciously for data exfiltration, malware communication, and unauthorized remote access.
Add the following section after “What Is DNS Tunneling?” and before “How Does DNS Tunneling Work?” in the DNS Tunneling glossary.
DNS tunneling emerged from the ability to encode non-DNS data within DNS queries and responses, using the protocol’s normal role in domain name resolution to carry information between systems. Because DNS is essential to most network operations, organizations have historically allowed DNS traffic through network boundaries, creating opportunities for covert communication.
Over time, attackers began using DNS tunneling for more than basic connectivity tests and research. It became a technique for establishing command-and-control (C2) channels, transferring data out of compromised environments, and communicating with malware while attempting to evade traditional network security controls.
As security monitoring evolved, defenders developed methods to identify suspicious DNS activity by examining query patterns, domain characteristics, request frequency, response sizes, and unusual traffic volumes. Modern detection approaches increasingly combine DNS analytics with threat intelligence, endpoint telemetry, and network monitoring to distinguish legitimate DNS activity from potential tunneling.
Today, DNS tunneling remains a security concern because it can exploit permitted DNS traffic to support covert communication and data exfiltration. Effective defense requires visibility into DNS activity, controlled DNS resolution, and correlation with other security signals rather than relying solely on traditional firewall rules.
A DNS tunneling attack generally follows these steps:
Because individual DNS messages carry limited amounts of data, attackers may generate many queries to maintain communication or transfer larger payloads.
DNS tunneling exploits the widespread use of DNS and gaps in how organizations monitor or restrict DNS traffic.
DNS tunneling is not inherently undetectable. DNS inspection, endpoint monitoring, and controlled resolution can reveal suspicious behavior.
Attackers commonly use DNS tunneling for the following purposes:
These activities can expose sensitive data, prolong an intrusion, and increase the impact of a security incident.
DNS tunneling attacks can be categorized by how attackers use the DNS channel and what they intend to accomplish. Common types include command-and-control communication, data exfiltration, network reconnaissance, network restriction bypass, and malware delivery.
These categories describe the purpose of the tunnel, rather than separate DNS protocols. A single attack may combine several types, such as using DNS for command-and-control communication before exfiltrating sensitive data
Security teams should investigate the following indicators:
No single indicator confirms an attack. Analysts should correlate DNS behavior with endpoint telemetry, domain reputation, and normal network activity.
Organizations can combine DNS monitoring, endpoint telemetry, and network security analytics to identify suspicious communication.
DNS over HTTPS (DoH) and DNS over TLS (DoT) encrypt DNS traffic between clients and resolvers. These protocols are not inherently malicious, but they can reduce visibility for monitoring systems that lack appropriate telemetry or inspection capabilities.
Organizations should combine DNS security controls, endpoint protection, and network restrictions.
DNS tunneling differs from other DNS-based attacks in its primary purpose and technique.
These attacks may overlap in a broader intrusion, but they require different detection and mitigation strategies.
A successful DNS tunneling attack can create several organizational risks:
Q1. How does DNS tunneling work?
DNS tunneling works by encoding data into DNS queries and responses to create a communication channel. An attacker may use this technique to communicate with malware, send commands to compromised devices, or exfiltrate sensitive information through DNS traffic. The technique can evade detection when DNS traffic is not adequately monitored.
Q2. Is DNS tunneling legal?
DNS tunneling is not inherently illegal. Its legality depends on the purpose, authorization, jurisdiction, and applicable laws. Security professionals may use it for authorized penetration testing, research, or specialized networking. However, using DNS tunneling to steal data, access systems without permission, or support other cybercrimes may violate applicable laws.
Q3. Who is 9.9.9.9 DNS?
9.9.9.9 is the primary IPv4 address of Quad9, a free public DNS resolver that blocks access to known malicious domains. Operated by the Quad9 Foundation, the service provides DNS resolution with security-focused filtering. Although Quad9 helps protect users from malicious domains, using it does not automatically prevent DNS tunneling through other resolvers or compromised infrastructure.
Q4. How can organizations prevent DNS tunneling attacks?
Organizations can reduce the risk of DNS tunneling by enforcing the use of approved DNS resolvers, blocking unauthorized external DNS traffic, filtering malicious domains, and monitoring anomalous DNS queries and responses. Endpoint protection, DNS security controls, and SIEM or network detection and response (NDR) integrations can help identify suspicious activity and support incident response.
Q5. Can DNS tunneling bypass firewalls?
DNS tunneling can evade some firewall controls when DNS traffic is permitted without adequate inspection. Attackers may hide data within DNS queries and responses that appear legitimate at a basic inspection level. However, DNS tunneling does not automatically bypass every firewall. DNS-aware filtering, behavioral analysis, and restrictions on unauthorized DNS traffic can help detect and block malicious tunnels.
Q6. How does DNS tunneling enable data exfiltration?
DNS tunneling enables data exfiltration by encoding information into DNS query names or other DNS message fields and sending it to a domain controlled by an attacker. The attacker's DNS infrastructure receives the encoded information, which can then be reconstructed. Monitoring unusually long queries, high query volumes, and suspicious domain patterns can help identify potential exfiltration attempts.
Q7. What tools can detect DNS tunneling?
DNS security gateways, SIEM platforms, network detection and response (NDR) tools, endpoint detection and response (EDR) products, and specialized DNS analytics can help detect tunneling. These tools analyze indicators such as unusually long domain names, high query entropy, abnormal query frequency, and suspicious DNS response patterns. Detection effectiveness depends on traffic visibility, behavioral baselines, and integration with other security telemetry.
Q8. What is the difference between DNS tunneling and DNS over HTTPS (DoH)?
DNS tunneling encodes arbitrary data within DNS messages to establish a communication channel, which may be abused for covert communication or data theft. DNS over HTTPS (DoH) encrypts DNS queries between a client and a resolver to protect DNS traffic from interception. DoH is a legitimate protocol, but unauthorized or unmanaged DoH usage can reduce DNS visibility and complicate security monitoring.
Q9. Can DNS tunneling be used for command-and-control attacks?
Yes. Attackers can use DNS tunneling to establish command-and-control (C2) channels with compromised systems. DNS queries can carry encoded commands or status information, while DNS responses can deliver instructions or other data. This technique may allow malware to communicate with attacker-controlled infrastructure when conventional communication channels are blocked or monitored more closely.
Q10. What is the difference between DNS tunneling and DNS spoofing?
DNS tunneling encodes data within DNS messages to create a communication channel for transferring information. DNS spoofing involves forging DNS responses or manipulating DNS information to misdirect users or systems to incorrect destinations. DNS tunneling is commonly associated with covert communication and data exfiltration, while DNS spoofing is often used to redirect traffic or facilitate further attacks.
Security research, threat intelligence, vulnerability updates, product news, and expert insights, delivered directly to your inbox. Stay informed. Stay secure.