Join our Newsletter — 33% off our NHI Course
Home› Guides› DNS Tunnelling for Beginners: How Data Hides Inside…
Guide Attack Techniques & Malware

DNS Tunnelling for Beginners: How Data Hides Inside Address Lookups

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 28 November 2026 12 min read
On this page

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.

Next: How DNS Works for Beginners

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.

Next: Web and DNS Filtering for Beginners

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.

Next: Secrets Management for Beginners

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)
  1. A normal lookup: a short, readable name during the working day.
  2. 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.
  3. The same domain again and again, with a new random part each time.
  4. 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.

  1. The attacker sets up a domain. They register a name and run the server that answers questions about it.[2]
  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]
  3. 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]
  4. 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]
  5. 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]
Diagram titled How a hidden message travels by DNS. Four boxes joined by arrows. Box 1, Infected laptop: hides a small piece of data in the name it looks up. Box 2, Company DNS service: does not know the name so passes the lookup on, as normal. Box 3, Attacker's name server: owns that domain so receives the lookup and reads the data. Box 4, Reply comes back: the answer can carry orders back to the laptop. A green bar along the bottom says defenders can break the chain: filter lookups, watch for odd names, use only approved DNS.
Figure 1. How a hidden message travels by DNS, and where defenders can step in.

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]

Side by side diagram titled Normal lookups or a possible tunnel. Left panel in green, labelled Looks normal: short, readable names; many different websites; mostly in working hours; a few lookups per site. Right panel in navy, labelled Worth a closer look: long, random-looking names; one unknown domain, again and again; carries on through the night; hundreds or thousands of lookups. A note underneath says one sign alone is not proof, because some normal software also makes odd lookups.
Figure 2. Signs that a set of lookups may be a tunnel. Look for several signs together.

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 thinkWhat 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:

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

  1. Application Layer Protocol: DNS (T1071.004). MITRE ATT&CK. https://attack.mitre.org/techniques/T1071/004/, accessed 28 Nov 2026.
  2. What Is DNS Tunneling? Palo Alto Networks Cyberpedia (vendor explainer). https://www.paloaltonetworks.com/cyberpedia/what-is-dns-tunneling, accessed 28 Nov 2026.
  3. Protective DNS (PDNS). National Cyber Security Centre (NCSC). https://www.ncsc.gov.uk/information/pdns, accessed 28 Nov 2026.
  4. 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.
  5. 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.

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.