The short version
- DNS exfiltration hides data in queries that almost every network lets through, and that most DLP tools never read.
- A closed port 53 proves little if nobody watches what the internal resolver forwards.
- In order: resolution, encrypted DNS, filtering, detection tested at low rates, response chain.
Most DNS exfiltration tests check the wrong control. Teams prove that outbound port 53 is shut at the firewall and stop there, while the traffic that matters leaves through the internal resolver, which forwards whatever it is asked; the only thing that can catch it is detection tuned for slow, low-volume queries.
DNS exfiltration means encoding data into the names you ask DNS to resolve, usually as subdomains of a domain the attacker controls, with the response available as a return channel. Your job is to find out whether your resolvers, your egress filtering and your SOC notice. Below are the controls to review, with no attack recipe.
Why DNS remains a blind spot in data leak prevention
Every machine needs DNS, so nobody questions it, and we rarely see it inspected with the care given to web traffic or email. One more query among thousands goes unnoticed.
Most DLP products on the market analyse files, attachments or HTTP flows. They do not read the content of a domain name you request. DNS was never part of your DLP’s job, which is why this kind of gap only comes to light through testing (see our guide to data exfiltration testing).
MITRE ATT&CK places this behaviour in the Exfiltration tactic, under technique T1048 (Exfiltration Over Alternative Protocol); the use of DNS as an application-layer channel also appears under T1071.004, and protocol tunnelling under T1572. To place DNS among the other techniques, see the Exfiltration tactic (TA0010) explained for defenders.
Three questions to ask before any test
- Who is allowed to resolve to the Internet? If every workstation can query any external DNS server directly, your other controls become secondary.
- Where are the logs? Without resolver query logs in your SIEM, there is nothing to investigate after the fact. On Windows Server DNS, that is the Microsoft-Windows-DNSServer/Analytical log, off by default; elsewhere, the resolver’s query log or Zeek’s dns.log. They give you the client IP, not the process: for that, you need Sysmon Event ID 22 on the endpoint.
- Is encrypted DNS under control? DNS over HTTPS (DoH, RFC 8484, on port 443) and DNS over TLS (DoT, RFC 7858, on port 853), enabled by Firefox, Chrome or an application, can silently bypass your corporate resolver.
Missing an answer to any of the three? Start there: every line of the checklist below assumes you have it.
Checklist of controls to validate
1. Resolution architecture
- Your workstations and servers use only the authorised internal resolvers.
- Your firewall blocks outbound port 53 (UDP and TCP) for anything that is not an authorised resolver.
- You block port 853 (DoT), or allow it only to a closed list.
- Public DoH services are blocked at the proxy by hostname (dns.google, cloudflare-dns.com, dns.quad9.net) and at the firewall by IP for clients going direct on 443 (Cloudflare’s 1.1.1.1, Google’s 8.8.8.8, Quad9’s 9.9.9.9). Browser policies disable unmanaged DoH (DnsOverHttpsMode for Chrome and Edge, DNSOverHTTPS for Firefox), and your resolver returns NXDOMAIN for use-application-dns.net, the canary domain that turns off Firefox’s default DoH.
- Your sensitive segments (databases, production) have no unnecessary external resolution.
2. Filtering and reputation
- Your resolver applies reputation-based filtering (newly registered domains, high-risk categories).
- Domains registered less than 30 days ago are blocked or placed under observation.
- An RPZ-type mechanism (response policy zones) is in place and kept up to date.
All of this sits within your wider egress filtering.
3. Behavioural detection
- Alert on the number of unique subdomains queried under one parent domain, per host per hour. Do the sums against your own test: at 2 queries a minute, a replay produces 120 unique subdomains an hour, so a threshold set in the hundreds will never see it. Exclude services that legitimately encode lookups in DNS, such as antivirus reputation checks.
- Alert on long subdomains (under RFC 1035, a DNS label can be up to 63 characters and a full name up to 253) or high-entropy subdomains, a sign of encoding.
- Alert on an unusual proportion of uncommon record types (TXT, NULL) from a user workstation.
- Correlation of workstation, user and time, to tell a legitimate service apart from isolated behaviour.
4. Response chain
- The alert reaches your SOC, with a consistent priority level.
- Your analysts have a procedure to isolate the workstation and block the domain.
- You measure the time between the event and the action, in minutes.
Table: control, common gap, expected evidence
| Control | Common gap | Evidence to obtain |
|---|---|---|
| Blocking direct DNS | Rule in place but exception too broad (an entire subnet allowed) | A query to an external resolver from a standard workstation is rejected and logged |
| Controlling DoH | Policy applied to a single browser | No unmanaged encrypted resolution from common browsers and applications |
| Reputation filtering | List not updated, or “monitor” mode never switched to blocking | A newly registered test domain is blocked, not just flagged |
| Anomaly detection | Thresholds set to avoid noise, and therefore too high | A low-rate replay triggers an alert |
| Forwarding to the SIEM | DNS logs not collected, or sampled | The test event can be found in the SIEM with workstation and user |
Scenario: a DNS test that passes for the wrong reason
Consider a council that has blocked outbound port 53 and deployed a filtering resolver. On the firewall console, the DNS channel shows as closed. The team runs a replay with synthetic data from a finance workstation, at a low rate (2 or 3 queries a minute), to a test domain agreed in advance.
Result: no alert. The internal resolver forwarded the queries, exactly as it is configured to. Reputation filtering saw nothing, because the test domain was not categorised. And the entropy rule was there, with a threshold built for large volumes.
Diagram · blocked directly, relayed internally
Illustrative example, made-up figures: 40 queries attempted, 40 transmitted through the internal resolver, 40 collected by the test domain’s server. In the logs, all 40 appear in the resolver’s query log against the finance workstation’s IP, and none raised a SIEM alert. The relay is open and detection missed that rate. It is the same mechanism as DLP false negatives: the rule exists, but the test never crosses its threshold.
Next step
DNS is one of the 8 channels we test
A 30-minute guided demo on pre-built results shows a campaign across the 8 channels, DNS queries included, then the report and its detail; you install nothing and we get no access to your environment. For a first result in your own network, the POC (quick, usually free) replays a standard scenario with synthetic data from a representative machine, through your real egress controls. The paid pilot extends the measurement to a limited part of your production, with a campaign you can replay on request.
How to test DNS exfiltration without using any real business data
Three rules for a DNS test run from the defender’s side:
- Synthetic data only. Decoys in a realistic format (fake customer numbers, fake IBANs) are enough to put your rules to the test. See testing exfiltration in production with synthetic data.
- A controlled destination domain, declared in advance to your network teams and to the SOC, depending on how blind you want the test to be.
- Several rates and several segments. A single test from the admin’s workstation says nothing about a salesperson’s laptop at home or an application server, which may not use the same resolver. Run it from a representative machine on each egress path, and from each VLAN or subnet where routing or policy differs.
Then run it again. DNS configuration drifts: a new resolver, a browser update that turns DoH back on, an emergency exception nobody removed. Re-run after each change and compare dated results. A check you can do yourself from a standard Windows machine: Resolve-DnsName example.com -Server 8.8.8.8 should fail, and the firewall should log the attempt. The limit: a fixed-rate replay to a declared domain tests your thresholds, not an attacker who varies rate, record types and domains.
FAQ
Does a traditional DLP detect DNS exfiltration?
Rarely. Most DLP tools analyse content (files, messages, web flows), not the domain names being resolved. Detection relies instead on your resolver, DNS filtering and the SIEM.
Is blocking outbound port 53 enough?
No. It closes direct DNS, but the internal resolver still forwards to the Internet, and DoH travels over 443 like any website. Detection has to sit on the resolver and the endpoint, with thresholds checked at low rates.
Does encrypted DNS make control impossible?
Not if it is managed. Disable unmanaged DoH through browser policy, block well-known public DoH resolvers and route your workstations through your own resolver. The remaining blind spot is the application you have not inventoried that ships with its own DoH.
Which DNS exfiltration signals should you monitor in resolver logs?
Four to start with: many unique subdomains under one parent domain; long (up to 63 characters per label under RFC 1035) or high-entropy subdomains; an unusual share of TXT or NULL records from a user workstation; domains registered less than 30 days ago. Tie each query to the host, then to the process, and check with a replay at 2 or 3 queries a minute that your thresholds fire.

