DNS tunnelling is hiding messages or stolen data inside the lookups computers make to find websites.
This guide is for students, newcomers to IT and anyone who has seen the term in a security alert or news story. You do not need to run a network to care: if your organisation uses the internet, its computers make these lookups all day, and an attacker may try to hide among them.
In short
- Every computer asks the internet's address book, called DNS, where to find websites.
- Attackers can hide small pieces of data inside those questions, and orders inside the answers.
- It is used to steer infected computers and to sneak data out, because DNS is allowed almost everywhere.
- Defenders filter lookups, keep DNS records and look for long, random names sent to one domain again and again.
What you will learn
- Explain DNS tunnelling in one sentence.
- Spot the signs of a possible tunnel in a list of lookups.
- Check whether your organisation filters and records its DNS traffic.
- Ask the right first questions when an alert mentions DNS tunnelling.
- Internet address book (DNS)
- the system that turns names like example.com into the number addresses computers use to connect.
- Address question (DNS lookup)
- one request from a computer asking where a name lives.
- Sneaking data out (exfiltration)
- moving information out of an organisation without permission.
What is DNS tunnelling?
Think of posting a letter with a secret note written in tiny letters inside the address. The post office reads the address, so it must deliver the letter, and the note travels with it.
DNS tunnelling works the same way. Before a computer visits a website, it asks the Domain Name System (DNS) where that name lives. This question is called a DNS lookup. In a tunnel, the computer does not really want a website. It packs a small piece of data into the name it asks about.
The attacker owns the domain at the end of that name. So the question is passed along until it reaches the attacker's own server, which reads the hidden data. The answer can carry a hidden message back.[2]
Attackers use it in two main ways. They use it to send orders to infected computers, which is called command and control. They also use it to sneak data out of a network.[1][2]
Where the comparison stops working: a letter carries a lot of words. A single DNS lookup holds only a little data, so a tunnel needs many lookups to move a file. That is one reason defenders can spot it.[2]
Why does it matter?
DNS is used by almost every network, so its traffic is easy to mistake for normal activity. It is also often allowed before other network checks are complete.[1] If nobody looks at DNS, data can leave without anyone noticing.
If you are new to IT or security work
What could happen: an alert mentions odd DNS traffic and you dismiss it as "just lookups".
Check this: learn what normal lookups look like on your network, so odd ones stand out.
If you run a small business
What could happen: customer records leave your network a little at a time, hidden in lookups.
Check this: ask your IT supplier whether your internet traffic uses a DNS service that blocks known bad names.
If you build or run apps
What could happen: passwords and keys used by your apps are copied out through DNS, then used elsewhere.
Check this: keep app keys in a locked store, not in files any infected machine could read.
What does it look like?
Many organisations keep a record of the DNS lookups their computers make. Here is a made-up extract from such a record.
Example only. All values are made up.
time computer name looked up 09:14 laptop-07 www.example.com (1) 09:15 laptop-07 mail.example.com 02:31 laptop-07 q0000fakefake0000aabb.data.example.invalid (2) 02:31 laptop-07 q0001fakefake0000ccdd.data.example.invalid 02:31 laptop-07 q0002fakefake0000eeff.data.example.invalid (3) 02:32 laptop-07 ... 1,800 more lookups to data.example.invalid (4)
- A normal lookup: a short, readable name during the working day.
- A long, random-looking part at the start of the name. In a real file, this line would contain a small piece of stolen data in this part.
- The same domain again and again, with a new random part each time.
- Very many lookups to one domain in a short time, in the middle of the night.
Why this is risky: each lookup looks harmless on its own, but together they may be carrying data out of the network.
The safer way: send all lookups through one approved DNS service that blocks known bad names. Keep the records, and alert on patterns like this one.
How does it work?
Here is the idea in plain steps. This shows what defenders need to understand, not how to build a tunnel.
- The attacker sets up a domain. They register a name and run the server that answers questions about it.[2]
- Malware hides data in a name. Harmful software on an infected computer turns data into a string of letters and numbers. It puts that string at the front of a name under the attacker's domain.[2]
- The lookup is passed along. The company's DNS service does not know the name. It passes the question on, as it would for any website, until it reaches the attacker's server.[2]
- The answer carries orders back. The attacker's server can hide instructions in its reply. Big files are split across many lookups and replies.[2]
- Defenders break the chain. A filtering DNS service, called protective DNS, refuses to look up names known to be harmful. The UK's National Cyber Security Centre says this also cuts off infected devices trying to reach bad servers.[3] In the US, a similar service protects federal agency networks.[4] Making computers use only approved DNS servers also helps.[1]

How do defenders spot a tunnel? They look for a few signs together. Names may be long and random-looking. One computer may send a very large number of lookups to one domain. Unusual record types, such as text records, may appear far more than normal.[2] Lookups made by scripts and tools, rather than web browsers, can also be a clue.[1]

Some legitimate services also send data through DNS, and some security tools make long lookups too. So an alert is a reason to look closer, not proof of an attack. A US government guide on running DNS safely, updated in March 2026, explains how to protect DNS as one layer of defence.[5]
A worked example
Kaia Zamora looks after the computers at Linden Lane Accountants, a firm of twelve people. The firm pays a security supplier to watch its alerts. Last year Kaia moved the office to a filtering DNS service and turned on its records.
On Tuesday morning, Vida Fairweather from the supplier calls her. "One of your laptops made about 1,800 lookups to the same unknown domain overnight," Vida says. "Each name has a long random part at the front. It looks like it could be a DNS tunnel."
Kaia checks the record. The laptop belongs to a junior accountant. The lookups began at 2am, when nobody was working. The names all end in the same domain, which none of the firm's software uses.
They act in a set order. First, Kaia takes the laptop off the network, so it cannot send any more lookups. Vida adds the domain to the block list for the whole office. Then Kaia resets the accountant's password from a different computer, along with any keys and passwords saved on the laptop.
Next, they ask what may have left. The supplier's tools show which files the laptop opened before the lookups began. Two client spreadsheets were among them. Kaia tells the partners, who take advice on whether they must report it.
The laptop is wiped and rebuilt. A week later Kaia checks the DNS records again. In the records available to her, the domain has not appeared since the block.
Kaia adds one rule for the future. Every office computer must use the filtering DNS service, and nothing may bypass it.
Myths and mistakes
| What people think | What is true |
|---|---|
| DNS is just an address book, so it is harmless. | Attackers can hide commands and data inside DNS lookups and replies.[1] |
| A firewall that blocks odd websites will catch it. | The tunnel uses normal DNS, which most firewalls allow. Filtering at the DNS service and watching the records matter more. |
| Every long, strange name is an attack. | Some normal services make odd lookups too. Look for several signs together before acting. |
| Blocking one bad domain ends the problem. | The attacker can switch to a new domain. The infected computer still needs cleaning, and any passwords on it need changing. |
| Only big companies are targeted. | Any network that allows DNS can be used this way, whatever its size. |
What can I do this week?
- Ask whether your organisation uses a protective DNS service that blocks known bad names.
- Find out if DNS lookups are recorded, and for how long the records are kept.
- Ask whether computers are forced to use the approved DNS service, or can choose their own.
- Learn who receives DNS alerts, and who acts on them out of hours.
Checklist
- All our computers use one approved DNS service.
- That service blocks names known to be harmful.
- Computers cannot quietly switch to a different DNS service.
- We keep records of DNS lookups for a set period.
- Someone is named to review DNS alerts.
- Alerts look for long, random names and very high lookup counts to one domain.
- Our response plan says to isolate the computer and change its passwords first.
Common questions
Is DNS tunnelling illegal?
Using it to break into systems or steal data is a crime in many countries. The trick itself also has some lawful uses. What matters is permission. On a network you do not own, ask before testing anything.
How much data can a DNS tunnel move?
Only a little per lookup. So a tunnel needs many lookups to move even a small file, which makes it slow. That is why a big pile of lookups to one domain is a useful warning sign.
Does encrypted DNS stop DNS tunnelling?
No. Encrypted DNS hides lookups from people watching the network, which helps privacy. It can also make tunnels harder to spot if computers use an unapproved encrypted service. That is why organisations try to keep all lookups going through their own approved DNS service.
Is DNS tunnelling the same as a VPN?
Not quite. A VPN is an approved, private connection that carries all kinds of traffic. A DNS tunnel squeezes data into address lookups, usually to avoid being noticed. In security news, the term usually means an attacker's hidden channel.
What should I do if I see an alert about it?
Follow your organisation's process and tell the person who handles security. Usually the computer is cut off from the network first, then checked. Do not delete files or switch it off unless you are told to, because that can destroy useful evidence.
Where next?
Ready for the detail? Read the practitioner guide: DNS Tunnelling Detection. It goes further into the query signals, resolver and endpoint logging, protective DNS and how to triage a suspected tunnel.
Also useful:
- Protocol Tunnelling Guide
- Command and Control for Beginners
- Data Exfiltration for Beginners
- Encrypted DNS for Beginners
Related NHI Mgmt Group resources: DNS Security for Beginners, DNS Logging and Detection Guide and Non-Human Identities for Beginners.
Key terms
- Domain Name System
- The naming service that turns website names into the number addresses computers use.
- DNS tunnelling
- Using DNS lookups and replies to carry hidden data for steering malware or stealing data.
- DNS exfiltration
- Stealing data by packing it into DNS lookups so it blends in with normal traffic.
- Resolver
- The service that receives a lookup and returns the matching address.
- Protective DNS
- A DNS service that refuses to look up names known to be harmful.
- Command and control channel
- The link an attacker uses to send orders to infected computers and get results back.
Sources and further reading
- Application Layer Protocol: DNS (T1071.004). MITRE ATT&CK. https://attack.mitre.org/techniques/T1071/004/, accessed 28 Nov 2026.
- What Is DNS Tunneling? Palo Alto Networks Cyberpedia (vendor explainer). https://www.paloaltonetworks.com/cyberpedia/what-is-dns-tunneling, accessed 28 Nov 2026.
- Protective DNS (PDNS). National Cyber Security Centre (NCSC). https://www.ncsc.gov.uk/information/pdns, accessed 28 Nov 2026.
- Protective Domain Name System Resolver. Cybersecurity and Infrastructure Security Agency (CISA). https://www.cisa.gov/resources-tools/services/protective-domain-name-system-resolver, accessed 28 Nov 2026.
- SP 800-81 Rev. 3, Secure Domain Name System (DNS) Deployment Guide. NIST, March 2026. https://csrc.nist.gov/pubs/sp/800/81/r3/final, accessed 28 Nov 2026.