Explainedback-iconCybersecurity 101back-iconWhat is DNS tunneling?

What is DNS tunneling?

DNS tunneling is a cyberattack technique that exploits the Domain Name System (DNS) protocol to covertly transmit data between a compromised device and an attacker-controlled server, often bypassing traditional security controls.

Attackers encode malicious traffic within DNS queries and responses, which typically appear legitimate to firewalls and security tools. Because DNS is essential for normal internet operations and often allowed through network defenses, it becomes an attractive channel for stealthy communication.

How DNS tunneling works

It abuses the fact that DNS requests can carry arbitrary data. Instead of resolving domain names, attackers embed encoded information (such as command-and-control instructions or stolen data) into DNS queries.

A typical flow looks like this:

  1. Malware infects an endpoint.
  2. The malware encodes data into subdomain queries.
  3. These queries are sent to an attacker-controlled DNS server.
  4. The server decodes the data and may send back instructions in DNS responses.

This method enables:

  • Data exfiltration (stealing sensitive information)
  • Command-and-control (C2) communication
  • Firewall evasion, since DNS traffic is rarely blocked

DNS tunneling vs normal DNS traffic

Feature Normal DNS Traffic DNS Tunneling Traffic
Purpose Resolve domain names Covert data transmission
Data content Human-readable domain queries Encoded/encrypted payloads
Traffic pattern Predictable and low volume High volume, repetitive, irregular
Security visibility Easily monitored Often bypasses traditional tools
Risk level Low High (used in cyberattacks)

Why DNS tunneling is dangerous

Domain Name System tunneling poses a significant risk because it operates under the radar. Most organizations allow DNS traffic without deep inspection, creating a blind spot in security architecture.
It enables attackers to:

  • Maintain persistent access without detection
  • Exfiltrate sensitive corporate data
  • Circumvent endpoint and network security controls

Additionally, traditional security tools may not inspect DNS payloads deeply enough to identify anomalies.

How to detect and prevent DNS tunneling

Effective defense requires visibility, analysis, and endpoint control:

  • Monitor DNS query patterns for anomalies (e.g., long or random-looking domains)
  • Use DNS filtering and threat intelligence feeds
  • Inspect DNS traffic for encoded payloads
  • Restrict unauthorized applications from making DNS requests
  • Implement endpoint security policies

FAQs

What is DNS tunneling used for?
Attackers primarily use it for data exfiltration and command-and-control communication, especially in environments with strict firewall rules.

Is Domain Name System tunneling illegal?
Yes, when used maliciously. It is considered a cyberattack technique used to bypass security controls and steal data.

Can firewalls detect DNS tunneling?
Traditional firewalls often fail to detect it because DNS traffic is typically allowed. Advanced monitoring and DNS inspection tools are required.

How can you identify DNS tunneling activity?
Look for unusually long domain names, high volumes of DNS queries, and irregular or repetitive request patterns.