DNS Security: Protecting Domain Name Resolution
DNS over HTTPS: Encrypted DNS Resolution
Read aloud is unavailable in this browser.
The Privacy Gap in Traditional DNS
Every website you visit begins with a DNS query—a plaintext request transmitted over UDP port 53 that reveals exactly which domains you're accessing. Your ISP sees every query. Network operators at cafes, hotels, and airports see every query. Governments conducting surveillance see every query. Even with HTTPS encrypting your actual web traffic, DNS queries create a detailed log of your internet activity.
DNS over HTTPS (DoH) fundamentally changes this dynamic by wrapping DNS queries inside encrypted HTTPS connections. To network observers, DoH traffic is indistinguishable from regular HTTPS web traffic—just another connection to a server on port 443. This provides genuine privacy for DNS resolution while also bypassing network-level DNS manipulation and censorship.
By the end of this page, you will understand: (1) Why DNS privacy matters in the modern internet, (2) How DoH encapsulates DNS queries within HTTPS, (3) The wire format and message encoding for DoH, (4) Resolver discovery and configuration mechanisms, (5) Performance implications including connection reuse and latency, (6) The controversy around centralization and enterprise control, and (7) How DoH interacts with DNSSEC for complete security.
The Case for DNS Encryption
To understand why DoH exists, we must first understand the privacy and security implications of unencrypted DNS. Traditional DNS (RFC 1035) was designed for a cooperative, academic network where privacy was not a concern. Today's internet reality is fundamentally different.
What traditional DNS exposes:
- Every domain you query — Including domains you don't ultimately visit (typos, blocked sites, failed lookups)
- Query timing patterns — When you're active online, which hours you browse, activity patterns
- Application behavior — Many apps leak information through distinctive DNS query patterns
- Location correlation — DNS queries from your IP address tie activity to your physical location
- Cross-device profiling — All devices on a network share the same resolver, enabling household profiling
| Observer | Access Method | Typical Use | Privacy Impact |
|---|---|---|---|
| ISP | Operates resolver; sees all queries | Analytics, advertising, compliance | Complete browsing history visible |
| Network Operator | Packet inspection on local network | Security monitoring, content filtering | All local users' queries exposed |
| On-path Attacker | ARP spoofing, WiFi eavesdropping | Surveillance, credential theft preparation | Targeted observation of individuals |
| Government/LEO | Taps at ISP, IXP, or international links | Surveillance, censorship enforcement | Mass population monitoring |
| DNS Provider | Receives queries as resolver operator | Threat intelligence, product improvement | Centralized query database |
Beyond privacy—integrity concerns:
Unencrypted DNS also enables manipulation:
- ISP redirection — Some ISPs redirect failed DNS lookups to ad-filled "helper" pages
- Captive portal injection — Networks intercept DNS to force portal login flows
- Censorship implementation — Governments mandate ISP DNS lying to block access to sites
- Malware C2 blocking — Enterprise networks may block known malware domains at DNS level
- Ad injection — Malicious networks redirect DNS to inject advertisements
While some manipulation is benign or even desired (enterprise security), the mechanism enables both legitimate uses and abuse. DoH shifts control from network operators to users.
Encrypting DNS alone doesn't fully hide site visits. The TLS handshake's Server Name Indication (SNI) field remains visible (in TLS 1.2 and unencrypted SNI in TLS 1.3). Encrypted Client Hello (ECH) is an emerging standard to address this. Complete browsing privacy requires: encrypted DNS (DoH/DoT) + Encrypted Client Hello + HTTPS content encryption.
DoH Protocol Architecture
DNS over HTTPS (RFC 8484) encapsulates DNS messages within HTTPS requests and responses. Unlike traditional DNS which uses its own UDP/TCP-based transport, DoH leverages the existing web infrastructure—TLS encryption, HTTP/2 multiplexing, and standard web server technology.
Core design principles:
- Use standard HTTPS — DoH uses regular HTTPS on port 443, making it indistinguishable from web traffic
- Preserve DNS wire format — The actual DNS query/response uses the standard binary format from RFC 1035
- Support HTTP semantics — Both GET (cacheable) and POST (for larger queries) methods work
- Leverage HTTP/2 — Connection multiplexing enables multiple queries over one connection
- Enable caching — Proper HTTP cache headers allow intermediary caching of responses
URI Template and Content Types:
DoH servers expose an endpoint (typically /dns-query) that accepts DNS queries. The RFC specifies:
- Content-Type:
application/dns-message— The body contains raw DNS wire format - Accept header: Client indicates it wants
application/dns-messageresponses - URI Template: Servers advertise their endpoint via URI template (e.g.,
https://dns.example.com/dns-query{?dns})
GET vs POST methods:
- GET: Query encoded as base64url in
dnsparameter; cacheable by HTTP intermediaries; limited by URL length - POST: Query in request body; works for any query size; typically not cached; used for most implementations
HTTP/2 advantages:
DoH strongly benefits from HTTP/2 features:
- Multiplexing — Multiple DNS queries share one TLS connection without head-of-line blocking
- Header compression (HPACK) — Reduces overhead for repeated queries to same resolver
- Server push (potential) — Resolver could push anticipated records (rarely implemented)
- Connection reuse — Amortizes TLS handshake cost across many queries
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
# DoH GET Request (query encoded in URL)# Query: www.example.com A record# Base64url encoding of DNS wire format query GET /dns-query?dns=AAABAAABAAAAAAAAA3d3dwdleGFtcGxlA2NvbQAAAQAB HTTP/2Host: dns.cloudflare.comAccept: application/dns-message # ResponseHTTP/2 200 OKContent-Type: application/dns-messageCache-Control: max-age=300Content-Length: 64 [Binary DNS response - 64 bytes] --- # DoH POST Request (query in body) POST /dns-query HTTP/2Host: dns.googleContent-Type: application/dns-messageAccept: application/dns-messageContent-Length: 41 [Binary DNS query - 41 bytes] # Response (same format as GET)HTTP/2 200 OKContent-Type: application/dns-messageCache-Control: max-age=86400 [Binary DNS response] --- # DNS Wire Format (hex dump of query)# Transaction ID: 0xABCD# Flags: 0x0100 (standard query, recursion desired)# Questions: 1# Query: www.example.com IN A ABCD 0100 0001 0000 0000 00000377 7777 0765 7861 6D70 6C65 0363 6F6D 000001 0001 # \x03www\x07example\x03com\x00 = www.example.com# \x00\x01 = Type A# \x00\x01 = Class INDoH GET requests use base64url encoding (RFC 4648 §5)—standard base64 with '+' replaced by '-', '/' replaced by '_', and padding removed. This makes DNS queries URL-safe without requiring percent-encoding. Example: standard base64 'A+B/C==' becomes base64url 'A-B_C'.
Resolver Discovery and Configuration
One of DoH's practical challenges is resolver discovery—how does a client know which DoH server to use? Traditional DNS resolvers are discovered automatically via DHCP. DoH requires explicit configuration or discovery mechanisms.
Current configuration methods:
- Manual configuration — User explicitly enters DoH resolver URL in browser/OS settings
- Browser defaults — Firefox, Chrome use built-in DoH resolver lists (often Cloudflare, Google, NextDNS)
- OS integration — Windows 11, macOS, iOS have system-level DoH support
- DDR (Discovery of Designated Resolvers) — RFC 9462 automatic upgrade mechanism
The DDR protocol:
Discovery of Designated Resolvers enables automatic DoH/DoT upgrade. Clients query a special DNS record type (SVCB/HTTPS) to discover encrypted resolver endpoints:
- Client connects to DHCP-provided resolver via traditional DNS
- Client queries
_dns.resolver.arpaSVCB record - If present, record contains DoH/DoT endpoint information
- Client verifies TLS certificate matches expected resolver identity
- Client upgrades to encrypted resolver automatically
| Provider | Endpoint URL | Features | Privacy Policy |
|---|---|---|---|
| Cloudflare | https://cloudflare-dns.com/dns-query | 1.1.1.1, malware/adult filtering options | No logging of IP; 24-hour query logs deleted |
https://dns.google/dns-query | 8.8.8.8, EDNS Client Subnet support | Anonymized logs; some data retained | |
| Quad9 | https://dns.quad9.net/dns-query | 9.9.9.9, threat blocking, no EDNS-CS | No IP logging; Swiss jurisdiction |
| NextDNS | https://dns.nextdns.io/ | Customizable filtering, analytics | User-controlled logging policy |
| AdGuard | https://dns.adguard.com/dns-query | Ad/tracker blocking built-in | Optional logging; various policies |
| Mullvad | https://dns.mullvad.net/dns-query | VPN provider, ad blocking | No logging; Sweden jurisdiction |
Browser behavior and fallback:
Modern browsers implement DoH with careful fallback behavior:
Firefox:
- Uses DoH by default in some regions (US initially)
- Falls back to traditional DNS if DoH fails
- Detects captive portals and enterprise networks, disables DoH
- Checks for canary domain to detect network-level DoH blocking
Chrome/Edge:
- Upgrades to DoH if current resolver has known DoH endpoint
- Doesn't change resolver choice, only transport encryption
- Prefers system DNS resolver if configured
Safari/iOS:
- System-level DoH configuration in iOS 14+/macOS 11+
- Apps can specify per-app DoH requirements
- Enterprise MDM can control/disable DoH
1234567891011121314151617181920212223242526272829303132333435
; Discovery of Designated Resolvers (DDR); RFC 9462 - Automatic encrypted resolver upgrade ; Step 1: Query special discovery name via traditional DNS; Client queries _dns.resolver.arpa for SVCB records $ dig _dns.resolver.arpa SVCB @192.168.1.1 ; Response contains encrypted resolver information:_dns.resolver.arpa. 7200 IN SVCB 1 dns.example.net. ( alpn=h2,h3 dohpath=/dns-query{?dns} ipv4hint=203.0.113.1 ipv6hint=2001:db8::1) ; Interpretation:; - Priority 1 (most preferred); - Target: dns.example.net; - Supports HTTP/2 (h2) and HTTP/3 (h3); - DoH path: /dns-query{?dns}; - IP hints for connection establishment ; Step 2: Client connects to https://dns.example.net/dns-query; Step 3: Verifies TLS certificate for dns.example.net; Step 4: Uses DoH for subsequent queries ; Alternative: DNS over TLS (DoT) discovery_dns.resolver.arpa. 7200 IN SVCB 2 dns.example.net. ( alpn=dot port=853 ipv4hint=203.0.113.1) ; This enables upgrade to DoT on port 853Browsers detect enterprise networks to avoid breaking internal DNS resolution. Firefox checks for a canary domain (use-application-dns.net); if it resolves to a specific IP, DoH is disabled. This allows enterprises to opt out of DoH network-wide. Chrome respects system DNS configuration and doesn't change resolver, only transport.
Performance Characteristics
A common concern with DoH is performance overhead—TLS handshakes and HTTP framing add latency compared to raw UDP. However, real-world performance is more nuanced, and DoH can actually improve resolution times in some scenarios.
Latency components:
Traditional DNS (UDP):
- Single RTT for query + response
- No encryption overhead
- No connection state to maintain
- Total: ~1 RTT per query
DoH (initial connection):
- TCP handshake: 1 RTT
- TLS 1.3 handshake: 1 RTT
- HTTP/2 SETTINGS exchange: 0 RTT (piggybacked)
- DNS query/response: 1 RTT
- Total: ~3 RTT for first query
DoH (subsequent queries, same connection):
- Connection already established
- DNS query/response: 1 RTT
- HTTP/2 multiplexing avoids head-of-line blocking
- Total: ~1 RTT per query
| Factor | Impact | Mitigation Strategy |
|---|---|---|
| TLS Handshake | +2 RTT for initial connection | Connection pooling; TLS session resumption; 0-RTT |
| HTTP Framing | ~20-50 bytes overhead per query | HTTP/2 HPACK compression reduces overhead |
| Connection Reuse | Amortizes setup cost across queries | Keep-alive connections; browser connection pooling |
| Geographic Distance | DoH resolvers may be farther than local ISP DNS | CDN-hosted resolvers; anycast deployment |
| TCP vs UDP | TCP requires connection state; more robust | Persistent connections eliminate per-query overhead |
| HTTP/3 (QUIC) | 0-RTT connection restoration; better loss handling | Emerging deployment; reduces initial latency |
When DoH is faster:
Surprisingly, DoH can outperform traditional DNS in several scenarios:
-
Unreliable networks — TCP's reliability prevents the need for application-layer retries common with UDP DNS
-
Multiple queries — HTTP/2 multiplexing sends many queries simultaneously; traditional DNS serializes queries
-
Well-connected resolvers — Cloudflare/Google have extensive PoP networks; your ISP's resolver may be farther
-
TLS 1.3 session resumption — Pre-shared keys enable 1-RTT connections (0-RTT with early data)
-
Connection warming — Browsers proactively establish DoH connections during idle time
Performance optimization strategies:
- Connection persistence — Keep DoH connections alive; avoid repeated TLS handshakes
- HTTP/2 multiplexing — Bundle multiple queries on single connection
- TLS session tickets — Enable fast session resumption for new connections
- HTTP/3 adoption — QUIC's 0-RTT significantly reduces cold-start latency
- Local caching — Respect DNS TTLs; avoid redundant queries
- •Initial connection requires 3 RTT
- •More complex protocol stack
- •TCP head-of-line blocking possible (HTTP/2 only)
- •TLS computation overhead (minimal on modern CPUs)
- •Larger response sizes due to HTTP framing
- •Connection reuse amortizes handshake cost
- •HTTP/2 multiplexing parallelizes queries
- •Reliable transport reduces retries
- •Session resumption enables fast reconnection
- •HTTP/3 solves TCP HoL blocking with QUIC
Use curl --doh-url https://dns.cloudflare.com/dns-query https://example.com to test DoH integration. Browser DevTools show DNS resolution timing in the Network panel. For detailed benchmarking, DNSPerf.com tracks resolver performance globally.
The Centralization Controversy
DoH has been controversial within the internet governance community. While proponents emphasize privacy benefits, critics raise concerns about DNS centralization and the shifting power dynamics in internet infrastructure.
The centralization argument:
Traditional DNS resolution is distributed by design—thousands of ISPs operate resolvers, and users typically use their ISP's resolver automatically. DoH, by enabling easy resolver switching and requiring explicit configuration, tends to concentrate queries on a few large providers:
- Cloudflare (1.1.1.1) — Firefox default, wide adoption
- Google (8.8.8.8) — Chrome integration, Android default
- Quad9, NextDNS, AdGuard — Smaller but growing share
This concentration creates new points of control, surveillance potential, and single points of failure.
| Aspect | Distributed (ISP) Model | Centralized (DoH Provider) Model |
|---|---|---|
| Privacy from ISP | ISP sees all queries | ISP sees only that you use DoH |
| Privacy from Resolver | ISP sees all queries | DoH provider sees all queries |
| Censorship Resistance | ISP can easily block/manipulate | Harder to block (looks like HTTPS) |
| Failure Impact | Local outage affects local users | Provider outage affects global users |
| Regulatory Jurisdiction | Local law applies to local ISP | Provider jurisdiction may differ from user |
| Enterprise Control | Network admin controls resolver | Users can bypass enterprise DNS |
| Logging/Analytics | Distributed across many ISPs | Concentrated in few providers |
Enterprise and network operator concerns:
Network administrators have expressed significant concerns about DoH bypassing their visibility and control:
-
Security monitoring — Enterprise security often relies on DNS logging to detect malware, C2 communication, and data exfiltration. DoH bypasses these controls.
-
Content filtering — Schools, libraries, and workplaces use DNS for content filtering. DoH allows users to circumvent these policies.
-
Split-horizon DNS — Enterprises often have internal DNS zones (e.g., intranet.company.com) that external DoH resolvers cannot resolve.
-
Incident response — DNS logs are crucial forensic evidence. DoH to external resolvers eliminates this visibility.
-
Regulatory compliance — Some industries require logging of all internet activity; DoH complicates compliance.
The balanced perspective:
Both sides have legitimate concerns:
- Users have genuine privacy interests that ISPs have historically violated
- Network operators have genuine security needs that DoH can undermine
- Centralization risks are real but may be mitigated by more DoH provider diversity
- Technical solutions (like DDR) can preserve operator control while enabling encryption
DoH represents a fundamental shift in who controls DNS resolution—from network operators (ISPs, enterprises) to endpoint users and their chosen software vendors. Whether this is positive depends on your trust model: do you trust your ISP or your browser vendor more? Neither answer is universally correct.
DoH and DNSSEC: Complete DNS Security
DoH and DNSSEC are complementary technologies that together address different DNS security needs. Understanding their relationship is essential for implementing comprehensive DNS security.
What each provides:
| Security Property | DNSSEC | DoH |
|---|---|---|
| Authenticity | ✅ Cryptographic proof of record origin | ❌ Trusts resolver's response |
| Integrity | ✅ Detects any record modification | ⚠️ Only between client and resolver |
| Confidentiality | ❌ Queries and responses in plaintext | ✅ All content encrypted |
| Availability | ❌ Can be blocked at network level | ⚠️ Harder to block (port 443) |
The complete security model:
To achieve full DNS security, combine both technologies:
- DoH encrypts the path to the resolver — Your ISP cannot see or modify your DNS queries
- DNSSEC validates the response authenticity — Even if the DoH resolver lies, DNSSEC validation detects it
- Trust is minimized — You don't need to trust either network operators OR the DoH resolver
Implementation considerations:
Where should DNSSEC validation happen?
-
At the resolver (common): The DoH resolver performs DNSSEC validation and returns an "AD" (Authenticated Data) flag if verified. Client trusts this flag.
-
At the client (more secure): Client performs its own DNSSEC validation after receiving response. Doesn't trust resolver's AD flag. Requires DNSSEC-validating stub resolver.
DoH resolvers and DNSSEC:
Most major DoH providers perform DNSSEC validation:
- Cloudflare: Returns AD flag; SERVFAIL for BOGUS responses
- Google: Validates by default; provides DNSSEC status in responses
- Quad9: Strong DNSSEC stance; returns SERVFAIL for validation failures
123456789101112131415161718192021222324252627282930313233
// DoH JSON response format (RFC 8484 alternative)// Includes DNSSEC validation status // Request: https://dns.google/resolve?name=example.com&type=A&do=true { "Status": 0, // NOERROR "TC": false, // Not truncated "RD": true, // Recursion desired "RA": true, // Recursion available "AD": true, // ✓ Authenticated Data (DNSSEC validated) "CD": false, // Checking Disabled not set "Question": [ { "name": "example.com", "type": 1 } ], "Answer": [ { "name": "example.com", "type": 1, "TTL": 3600, "data": "93.184.216.34" } ], "Comment": "Response from 199.43.135.53"} // Key fields for DNSSEC:// AD=true: Response was DNSSEC-validated by resolver// CD=true: Client requested DNSSEC checking disabled// Status=2 (SERVFAIL): Often indicates DNSSEC validation failureFor maximum security: Use DoH with a trusted resolver that performs DNSSEC validation. If you don't fully trust your DoH provider, run a local DNSSEC-validating resolver (like Unbound) that uses DoH upstream. This gives you encrypted transport AND independent validation.
Implementation and Deployment
Deploying DoH ranges from simple browser configuration to enterprise-scale infrastructure. Understanding deployment options helps choose the right approach for your needs.
Client-side deployment options:
- •Browser Settings — Firefox: Settings → Privacy & Security → Enable DNS over HTTPS. Chrome: chrome://settings/security → Use secure DNS. Edge: Similar to Chrome.
- •Operating System — Windows 11: Settings → Network → DNS → Encrypted DNS. macOS/iOS: Configuration Profile or Settings → DNS. Android 9+: Private DNS setting (DoT only; some apps support DoH).
- •Local Resolver — Install dnscrypt-proxy, cloudflared, or Unbound locally. Point system DNS to 127.0.0.1. Resolver handles DoH upstream. Provides central control for all applications.
- •Router Level — Some routers support DoH/DoT upstream. Provides network-wide encryption. Examples: OpenWrt with DoH packages, consumer routers with DoH options.
- •VPN Integration — Many VPNs include DoH/DoT resolution. All traffic including DNS goes through VPN. Provides complete privacy when VPN is active.
123456789101112131415161718192021222324252627282930313233
# Local DoH resolver using cloudflared# Proxies local DNS to Cloudflare DoH # Installation (Linux)$ wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64$ sudo mv cloudflared-linux-amd64 /usr/local/bin/cloudflared$ sudo chmod +x /usr/local/bin/cloudflared # Run as DNS proxy$ cloudflared proxy-dns --port 5053 --upstream https://cloudflare-dns.com/dns-query # Configure system to use local resolver$ echo "nameserver 127.0.0.1" | sudo tee /etc/resolv.conf --- # Alternative: curl for DoH testing# Query example.com A record via DoH $ curl -H 'accept: application/dns-json' 'https://cloudflare-dns.com/dns-query?name=example.com&type=A' # Response:# {"Status":0,"TC":false,"RD":true,"RA":true,"AD":true,# "CD":false,"Question":[{"name":"example.com","type":1}],# "Answer":[{"name":"example.com","type":1,"TTL":3600,"data":"93.184.216.34"}]} --- # Windows 11 DoH via PowerShellAdd-DnsClientDohServerAddress -ServerAddress 1.1.1.1 -DohTemplate https://cloudflare-dns.com/dns-query -AutoUpgrade $TrueServer-side / Enterprise deployment:
Organizations may want to deploy their own DoH servers to maintain control while providing encryption:
-
Internal DoH resolver — Run a DoH-enabled resolver (dnsdist, CoreDNS, nginx with dns-over-https module) internally. Clients configured to use internal DoH endpoint.
-
Split DNS with DoH — Internal resolver handles internal zones; forwards external queries to upstream DoH resolver.
-
DoH with logging — Deploy DoH internally but maintain DNS logging for security/compliance. Encryption protects from external observers, not internal.
-
DDR publishing — Publish SVCB records for resolver.arpa to enable automatic client upgrade to your DoH/DoT server.
Blocking DoH (network perspective):
Some networks legitimately need to prevent DoH bypass:
- Block known DoH resolver IPs (continuously updated lists available)
- Deep packet inspection to detect DoH patterns (difficult, resource-intensive)
- Deploy enterprise canary domains that browsers respect
- Policy enforcement via MDM/GPO to disable browser DoH
- Certificate inspection (controversial; requires MITM proxy)
Blocking DoH is fundamentally difficult. DoH uses the same port and protocol as regular HTTPS. Without TLS inspection (which breaks end-to-end encryption), distinguishing DoH from web traffic requires IP-level blocking. As DoH providers expand their anycast networks and CDN deployments, IP blocking becomes impractical.
KEEP LEARNING
There’s more to understand.
You’re reading the introduction. Create a free account to read the complete lesson, save notes and keep track of your progress.