Support >
  About cybersecurity >
  What Is a DNS Tunneling Attack? How Attackers Steal Data Using DNS Queries

What Is a DNS Tunneling Attack? How Attackers Steal Data Using DNS Queries

Time : 2026-10-07 10:34:50
Edit : DNS.COM

  There is a counterintuitive fact in cybersecurity: the most dangerous attacks often hide in the places you would least suspect. Firewalls typically permit DNS traffic on port 53 because the Internet cannot function without domain name resolution. This "must-allow" nature makes DNS an ideal covert channel for attackers.

  DNS tunneling attacks exploit this channel to disguise stolen data as legitimate domain name queries, allowing the data to be brazenly exfiltrated from your network. Furthermore, many corporate security teams fail to inspect DNS traffic at all, operating under the assumption that "DNS is just for looking up IP addresses—what could possibly go wrong?"

  What exactly does DNS tunneling do?

  To understand DNS tunneling, one must first understand what a standard DNS query looks like.

  A normal DNS query works like this: your computer asks the DNS server, "What is the IP address for example.com?" and the server replies, "93.184.216.34." The query contains only the domain name, and the response contains only the IP address. It is clean, simple, and purposeful.

  DNS tunneling, however, works by encoding the data to be transmitted and embedding it within the "domain name" itself.

  Malicious software running on an infected machine takes stolen file fragments and encodes them—using Base64 or hexadecimal—into a string of characters that looks like gibberish. It then concatenates this string into a subdomain (e.g., `aGVsbG8gd29ybGQ.evil.com`) and sends a query to an attacker-controlled DNS server.

  Upon receiving the query, the attacker's DNS server extracts the encoded data from the subdomain and decodes it. Conversely, when the attacker needs to issue commands, they embed the encoded instructions within the DNS response (typically in a TXT record); the infected machine receives the response, decodes the data, and executes the commands.

  The entire process mimics standard DNS resolution, so firewalls allow the traffic through, and security systems trigger no alerts. In reality, however, a covert, two-way data channel has already been established.

  MITRE’s ATT&CK framework classifies this technique as "Protocol Tunneling." Its documentation on DNS tunneling explicitly notes that attackers "piggyback" user data onto DNS requests; an attacker-controlled DNS server then logs the queries and extracts the encoded information, thereby covertly exploiting the DNS protocol.

  Why choose DNS instead of HTTP or FTP?

  Attackers choose DNS as a channel for data exfiltration for very practical reasons.

  Firewalls allow DNS traffic by default. This is the fundamental reason. Corporate firewalls are typically configured to permit internal hosts to initiate queries on port 53 to external DNS servers. Blocking DNS would paralyze normal internet access. Attackers exploit precisely this "necessary trust."

  DNS traffic is ubiquitous and inconspicuous. An enterprise network generates thousands of DNS queries daily; security teams cannot possibly review each one. Attackers blend malicious queries into this massive volume of legitimate traffic—much like pouring a drop of ink into the ocean.

  TXT records are inherently suited for hiding data. Originally designed to store domain verification text (such as SPF or DKIM records), TXT records support lengthy text content. Attackers use them to carry encrypted data; response packets can be large while appearing to be legitimate domain verification traffic.

  Data capacity is often underestimated. Theoretically, the domain name portion of a DNS query can be quite long; a single TXT record can hold multiple strings, each up to 255 characters in length. By breaking files into small chunks and distributing them across a large number of DNS queries for slow transmission, attackers can achieve a steady, low-profile data transfer.

  What does DNS tunneling look like in the real world?

  DNS tunneling is not merely a theoretical concept. Over the past few years, numerous security vendors have documented actual attack cases. In 2025, Symantec disclosed a backdoor program named "Msupedge," used by attackers to compromise the network of a Taiwanese university by exploiting a PHP vulnerability; the backdoor utilized DNS tunneling to communicate with a command-and-control (C&C) server. It employed a dual-layer stealth strategy: not only did it receive instructions via DNS queries, but it also interpreted the IP addresses resolved by the C&C server as commands themselves.

  In 2026, security vendors detected a new class of DNS tunneling malware designed to steal user accounts, customer data, and business documents from government and corporate internal networks. This malware incorporated evasion optimizations: it controlled query frequency to avoid triggering traffic alerts, randomized encoded characters to lower detection rates based on signature matching, and mimicked the query patterns of legitimate business domains to blend in with routine traffic.

  In October 2025, security researchers uncovered a large-scale DNS-based malicious campaign dubbed "Detour Dog," in which tens of thousands of compromised websites were used to embed structured DNS queries and responses, serving as covert command-and-control channels and payload delivery mechanisms. Infected sites generated malicious TXT record queries to encode victim data and retrieve remote instructions.

  What makes detection so difficult?

  The core challenge in defending against DNS tunneling lies in the blurred boundary between "normal" and "anomalous" activity.

  Legitimate DNS queries can also generate subdomains; for instance, CDNs frequently create addresses such as `d1234567890.cloudfront.net`. Similarly, legitimate TXT record queries exist—SPF verification being a prime example. Normal DNS traffic naturally fluctuates; query volumes rise during periods of high activity.

  Attackers are constantly evolving their evasion techniques. A 2026 academic paper noted that existing detection methods are "inherently incapable of guaranteeing zero data leakage"; when stolen data is exfiltrated across numerous root domains, detection methods relying on statistical characteristics are easily bypassed.

  This means the traditional approach of simply monitoring traffic volume is no longer sufficient. Attackers can manipulate query frequency to make the volume for any single domain appear entirely normal, or distribute data across hundreds of different domains so that the query volume for each individual domain remains negligible.

  How can this be prevented?

  Defense against DNS tunneling must begin with visibility rather than immediate blocking.

  The first step is the comprehensive retention of DNS logs. Many enterprise security operations focus solely on web traffic, neglecting deep DNS auditing. Without logs, it is impossible to determine after the fact when an attack occurred or what data was exfiltrated. Key monitoring metrics include high-frequency TXT queries, excessively long subdomains (exceeding 60 characters), and domains containing high-entropy random characters.

  The second step is to tighten outbound DNS policies. Internal hosts should only be permitted to access trusted DNS servers designated by the enterprise; direct connections from endpoints to unknown public DNS servers must be prohibited. This ensures that DNS traffic is consolidated at a single, monitorable egress point.

  The third step is identifying anomalous payloads. Deploy security devices capable of deep DNS inspection to intercept anomalous payloads containing Base64 or hexadecimal encoding, with a focus on monitoring unconventional data transmission via TXT or NULL records. Verify whether DNS responses return valid IP addresses; if a response contains a non-IP string, it is almost certainly indicative of a problem.

  The fourth step is traffic characteristic analysis. Cato Networks' detection solution analyzes several key characteristics: packet size (large DNS packets are anomalous), record type (unusual use of records such as TXT or NULL), and uniqueness ratio (a high volume of unique subdomains may indicate an attack). Machine learning-based solutions can establish a baseline for normal DNS behavior and trigger alerts when patterns such as "high-frequency short domain queries," "massive resolution activity during non-working hours," or "frequent subdomain changes for a single domain" are detected.

  FAQs

  Q: Are DNS tunneling attacks and DNS amplification attacks the same thing?

  A: No. DNS amplification attacks exploit open DNS resolvers to reflect attack traffic onto a victim, aiming to overwhelm the victim's network. DNS tunneling attacks use DNS queries to establish a covert channel, aiming to stealthily exfiltrate data or enable remote control. One is about causing disruption, while the other is about infiltration.

  Q: Why can DNS traffic be used to steal data? Don't firewalls block it?

  A: Firewalls typically allow DNS queries on port 53 by default because blocking them would render normal internet access impossible. Attackers exploit this "necessary access" trust by encoding data into parts of the domain name, tricking the firewall into believing the traffic is merely standard domain resolution.

  Q: What are some common DNS tunneling tools?

  A: Publicly available tunneling tools include DNSCat2, Iodine, and Cobalt Strike. The Msupedge backdoor discovered by Symantec, for instance, is based on DNSCat2. These tools are widely available online, allowing attackers to use them without requiring advanced technical skills.

DNS Jade
DNS Anna
DNS Amy
DNS NOC
Title
Email Address
Type
Information
Code
Submit