In short
DNS tunnelling hides other traffic inside DNS queries and responses. Data is encoded into subdomains sent to a domain the attacker controls, and replies come back in DNS records. Malware uses it for command and control and data theft. Force all DNS through a protective resolver, block other outbound DNS and DNS over HTTPS, and analyse query patterns.
Get a quote for DNS tunnelling protection
Tell us roughly how many users or sites you have and we will reply by email with options and a quote.
What DNS tunnelling is
DNS tunnelling (also spelled DNS tunneling) is a technique that carries non-DNS traffic inside DNS messages. It works because of how DNS is designed: when a device looks up a name, its resolver passes the question along until it reaches the authoritative server for that domain. If an attacker owns the domain, they own that server, so anything written into the name being looked up reaches them, and anything they put in the answer comes back.
A tunnel has two ends:
- A client on the inside: a piece of malware, or a tunnelling tool someone has installed, that encodes outgoing data into the labels of a domain name, such as a long string of letters and numbers in front of the attacker's domain.
- A server on the outside: the authoritative name server for the attacker's domain, which decodes each query and sends data back in the response, usually in TXT, CNAME, MX or NULL records.
The result is a slow but working two-way channel that passes through firewalls, proxies and captive portals that allow DNS but nothing else. It is used for DNS exfiltration of stolen data and for command and control, where an infected device asks for instructions and receives them in DNS answers. It is one of the DNS attacks that a plain resolver will happily forward.
A simple example
Imagine malware on a laptop that wants to tell its operator it is running, and receive a command back. Using the reserved example domain attacker.example:
- The malware encodes a short message, such as the machine's name, into text that is valid in a domain name, for example 7a3f9c1e2b.attacker.example.
- It asks the laptop's normal resolver to look that name up, as it would any other.
- The resolver does not know the name, so it asks the authoritative server for attacker.example, which belongs to the attacker.
- The attacker's server decodes 7a3f9c1e2b, records that the laptop is online, and replies with a TXT record containing an encoded instruction.
- The malware decodes the reply and acts on it, then repeats the cycle with new lookups.
Nothing in this exchange breaks the DNS standards. Each lookup on its own looks harmless; the giveaway is the pattern of many of them.
Why other controls miss it
DNS tunnelling is popular with attackers because it slips between the controls most organisations already have:
- Firewalls allow outbound DNS from internal DNS servers, and often from every device, because nothing works without it. A tunnel through your own DNS server looks like ordinary forwarded lookups.
- Web proxies and secure web gateways inspect web traffic, not DNS lookups, unless they are part of a platform that also handles DNS.
- Email security does not see it, because no email is involved.
- Endpoint protection may not flag a process that only makes DNS lookups, especially if the tunnelling code lives inside a legitimate-looking program.
That leaves the resolver as the one place every lookup passes through, if you make sure it does. It is also why tunnelling tools are often used to get round networks that block everything except DNS, such as some guest Wi-Fi portals.
Is DNS tunnelling protection the right fit for you?
We will check it against your systems and requirements and recommend the right option.
Legitimate and malicious uses
Not every DNS tunnel is an attack. DNS has been used to carry data for legitimate reasons, and some security and monitoring products encode lookups or status information in DNS queries to their own domains. Open-source tunnelling tools also exist and are used for research, testing and, less legitimately, to get round paid Wi-Fi portals.
On a business network, though, the question is simple: is there a good reason for this device to send a stream of encoded data to an unknown domain? Usually there is not. Treat unexpected tunnelling as suspicious until you can explain it, and add genuine, known services to an allow list rather than tolerating the pattern in general.
How DNS tunnelling is detected
Detection relies on the fact that tunnelled DNS looks different from normal lookups, even if each query is valid. The common signals are:
| Signal | What it looks like | Why it matters |
|---|---|---|
| Long or random-looking subdomains | Labels near the 63-character limit, full of letters and digits with no words | Encoded data packed into the name |
| High entropy | Character distribution close to random | Normal hostnames use words and repeated patterns |
| Many unique subdomains under one domain | Thousands of names under one parent, each queried once | Each lookup carries a new chunk of data, so caching does not help |
| Unusual record types | Heavy use of TXT, NULL or CNAME lookups from a workstation | These records can carry larger payloads back |
| Volume and regularity | Steady lookups to one domain, including outside working hours | Beaconing to a controller or a long transfer |
| Young or unknown domains | Recently registered domains with no reputation | Attackers register fresh domains for each campaign |
Rules based on length and volume catch crude tunnels; better services combine several signals with machine learning. Cisco says its Secure Access DNS Defense adds AI-based detection of DNS tunnelling and domain generation algorithm (DGA) domains, one of the differences covered in DNS Defense vs Umbrella. Network detection and response (NDR) tools can also flag unusual DNS behaviour from traffic data.
Not sure which option fits? Ask us
Tell us what you need and we will recommend the right option for your organisation, with a quote.
How to prevent DNS tunnelling
Detection only works if the lookups pass through something that can see them. The most important controls are about making sure they do:
- Send every lookup to a protective resolver. Point networks and internal DNS servers at a protective DNS service. Lookups for domains the service knows are malicious, or flags as tunnelling, are blocked rather than forwarded to the attacker's server, so the tunnel cannot form through your resolver.
- Block outbound DNS that skips your resolver. Malware can send DNS straight to the attacker's server on port 53, or to a public resolver. The NCSC advises blocking outbound DNS on ports 53 and 853 unless it goes through your resolver.
- Control DNS over HTTPS. Tunnelling tools can use public DoH services on port 443 to hide from network rules. Disable DoH or point it at your protective resolver through device policy, and block known DoH services where your provider offers a category for them. See should you block DNS over HTTPS?
- Cover devices off site with a DNS roaming client, so the same controls apply on home broadband.
- Analyse and alert. Send DNS logs to your SIEM and alert on the signals above, or choose a service that detects tunnelling for you.
- Block newly seen or unknown domains where appropriate, starting in monitor-only mode to see what would be affected.
What DNS security can and cannot do here
A protective resolver is the natural place to stop DNS tunnelling, because it sees every lookup before it leaves your control. But be realistic about its limits:
- A tunnel to a domain that is not yet known as malicious is only stopped if the service detects the pattern, not just the reputation.
- A device that reaches the internet without using your resolver, through a personal VPN or hard-coded DNS, is invisible unless firewall rules and device policy close those routes.
- Very slow, low-volume tunnels are harder to tell apart from normal traffic.
That is why we recommend combining protective DNS with egress control and endpoint protection, and testing the result. Our DNS security test guide includes checks for the bypass routes.
How we can help
We can review where DNS leaves your network today, close the routes that let tunnels bypass your resolver, and recommend a DNS security service with the detection you need. The options we supply include Cisco Secure Access DNS Defense, Cisco Umbrella and the alternatives on our DNS security solutions page. Scope and pricing are confirmed at quote; contact us to start.
How Forever Systems helps with DNS security
We are an independent UK IT and cyber security provider and a Cisco Partner. We supply Cisco Umbrella and Cisco Secure Access DNS Defense, and a range of other DNS filtering options, so we can recommend what fits rather than one answer for everyone.
- Start with what you have: we look at your firewall, endpoint protection and Microsoft 365 licences first, as some already include DNS or web filtering
- Choosing a service: Cisco DNS-layer security, DNS filtering bundled with endpoint protection, or a protective DNS service from the public sector, compared in plain English
- Set-up and roll-out: network forwarding, roaming clients for laptops off site, policies, block pages and controls to stop encrypted DNS bypassing the filter
- Migration help, including planning a move from Umbrella DNS packages to Cisco Secure Access DNS Defense
- Ongoing help: policy changes, reporting reviews, licence management and renewals, agreed at quote
We work with businesses, schools, charities and public sector organisations.
Frequently asked questions
What is DNS tunnelling?
DNS tunnelling is a technique that hides other traffic inside DNS queries and responses. Data is encoded into the subdomain of a domain the attacker controls, and replies come back in DNS records, creating a covert two-way channel through networks that allow DNS.
How is DNS tunnelling detected?
By looking for patterns that normal lookups do not show: long, random-looking subdomains, many unique names under one domain, heavy use of TXT or NULL records, steady query volumes to one domain and young domains with no reputation. Some DNS security services detect this automatically.
Is DNS tunnelling always malicious?
No. Some legitimate products use DNS to carry small amounts of data, and tunnelling tools are used for research and testing. On a business network, unexpected tunnelling should be treated as suspicious, with known, genuine services added to an allow list.
Can DNS security block DNS tunnelling?
Yes, if the lookups pass through it. A protective resolver will not forward lookups for known malicious domains, and services with tunnelling detection can block the pattern itself. Firewall rules and device policy must stop devices using other resolvers or DNS over HTTPS.
Is it spelled DNS tunnelling or DNS tunneling?
Both are used. Tunnelling with a double L is the British spelling and tunneling is the American one; they mean the same thing.
Does a VPN stop DNS tunnelling?
No. A VPN can carry tunnelled lookups just as easily as normal ones. What matters is that DNS from the device ends up at a protective resolver that can block and detect tunnelling, whether or not a VPN is in use.
Still have a question about DNS tunnelling protection?
Ask us and a member of our team will reply by email.
