# DoH vs Captive Portal DNS Hijack: IP-Bootstrapped DoH Escaped 360 of 360 Times in a One-Week Test

We asked one question: when the plaintext DNS path is hijacked the way a captive portal hijacks it, does DNS over HTTPS (DoH) still reach the resolver it was pointed at? Over 15 scheduled measurement slots between 2026-11-24T13:16:12Z and 2026-12-01T06:05:09Z, we ran a frozen list of 12 names through four paths: the VM's system resolver, a loopback UDP hijacker that answered every A query with a documentation address, DoH to Cloudflare by IP literal, and DoH to Google by IP literal. The hijacker won on every plaintext lookup (180 of 180). DoH by IP literal escaped it on every lookup (180 of 180 for Cloudflare, 180 of 180 for Google), never returned the sentinel (0 of 360), and cost about the same time as the unhijacked system resolver. Bootstrapping DoH by *hostname* through the hijacker failed by construction (30 of 30 poisoned), which is the other half of the answer.

This is a simulation of the DNS-layer half of a captive portal, not a field study of a real one. The limits section says exactly what that does and does not license you to conclude.

## Lead finding

- **Hijack armed:** 180 of 180 hijacked `dig` answers were the sentinel `203.0.113.10` and nothing else. The hijacker also saw exactly 225 queries across the study (15 per slot: 12 frozen names, 2 DoH hostnames, 1 sanity probe), so nothing else touched it.
- **DoH by IP escaped:** 180 of 180 Cloudflare DoH answers and 180 of 180 Google DoH answers were non-sentinel real addresses, all 360 HTTP responses were status 200, and the sentinel appeared in 0 of 360.
- **Hostname bootstrap did not:** asking the hijacker for `cloudflare-dns.com` and `dns.google` returned the sentinel in 30 of 30 attempts. A DoH client that must resolve its resolver's name through hijacked plaintext DNS has nothing real to connect to.
- **Classification stability:** every one of the 15 slots classified `doh_escapes` for both resolvers. There was no intermittency to chart because the outcome never changed.
- **Cost:** median per-query time was 21 ms for the system resolver, 19 ms for Cloudflare DoH and 21 ms for Google DoH (each DoH query opened a fresh HTTPS connection). The hijacked loopback lookup was 17 ms, which is mostly the cost of launching `dig`.
- **Where answers differed:** DoH answers matched the system resolver exactly for nine of twelve names in every slot. All disagreement sat in three CDN-steered names, and it was a difference between resolvers, not evidence of tampering.

If you want the encrypted-DNS background first, our explainer on [HTTPS, secure DNS and DNS over HTTPS](/blog/https-secure-dns-and-dns-over-https/) covers what DoH hides and what it does not. For leak behavior on proxies, see the earlier [DNS path intermittency diary](/blog/dns-path-intermittency-diary/).

## Why this question matters

A captive portal is the gate you meet on hotel, airport, café and campus Wi-Fi. Until you accept terms or sign in, the network answers for you. Two mechanisms do most of the work: it redirects or intercepts web requests, and it rewrites DNS so that names resolve to the portal instead of the real site. Operating systems detect portals by fetching small probe URLs (we included the well-known probe hostnames for Google, Apple, Mozilla and Microsoft in our frozen list) and checking whether the response is what they expect.

DoH, standardized in [RFC 8484](https://www.rfc-editor.org/rfc/rfc8484.html), moves DNS lookups inside HTTPS to a resolver the client chose. That is good for confidentiality on hostile networks, and it is exactly why it collides with captive portals: if lookups no longer pass through the network's resolver, the network cannot poison them. The standards-based alternative for portals is explicit signaling, not DNS trickery: [RFC 8910](https://www.rfc-editor.org/rfc/rfc8910.html) lets a network advertise its portal API through DHCP or router advertisements.

The practical question this study isolates is narrow and testable: **when system DNS is hijacked, what decides whether DoH still works?** Our hypothesis, written into the protocol before any measurement, was that *how the DoH client finds its resolver* decides it. A resolver addressed by IP literal never needs plaintext DNS. A resolver addressed by hostname does.

## What we froze before measuring

We froze the protocol at `2026-11-24T13:16:10Z`, two seconds before the first measurement. The frozen items were:

- **12 query names, in order, never reordered:** `example.com`, `neverssl.com`, `connectivitycheck.gstatic.com`, `captive.apple.com`, `detectportal.firefox.com`, `www.msftconnecttest.com`, `cloudflare.com`, `dns.google`, `cloudflare-dns.com`, `one.one.one.one`, `wikipedia.org`, `freepolicytools.com`.
- **Four per-name conditions:** `baseline-system-dns`, `captive-hijack-dns`, `doh-ip-cloudflare`, `doh-ip-google`. Plus two per-slot hostname-bootstrap conditions, `doh-hostname-cloudflare` and `doh-hostname-google`.
- **The sentinel:** `203.0.113.10`, an address in TEST-NET-3 (`203.0.113.0/24`), reserved for documentation by [RFC 5737](https://www.rfc-editor.org/rfc/rfc5737.html). We never present a live third-party address as a fake portal.
- **Pre-registered slot codes:** `hijack_armed`, `doh_escapes`, `doh_partial`, `doh_blocked`, `hijack_ineffective`, `baseline_broken` and `inconclusive`, with the rule for each written down in advance.
- **A cap and a lean rule:** at most 12 names and two DoH resolvers, no per-slot use of paid proxies, and a single optional Day 0 proxy contrast.

The first slot (`20261124-immediate`) ran seconds after the freeze. The remaining 14 ran on a twice-daily cadence at about 06:05 and 18:05 UTC. The cadence was amended once, before the end of the study, to run through the final slot `20261201T0600Z`; collection stopped there and no later slot exists. Measured honestly, the 15 slots span 6 days, 16 hours and 49 minutes (about 160.8 hours) from the first measurement to the last, a little short of a literal 168 hours, because the final slot sits at 06:05 UTC on the last day.

## Methods

### Vantage

Every measurement ran on one Cursor Cloud Agent VM in a USA datacenter, using Python 3 with `dig` and the standard library's HTTPS client. We did not rely on any third-party probing service. Rows are redacted for publication: addresses other than the sentinel and the two well-known anycast bootstrap addresses are replaced by a salted SHA-256 prefix, so the evidence can show whether two answers were the same set without publishing the addresses.

### The hijacker

`scripts/captive_dns.py` is a small UDP DNS server bound to `127.0.0.1` on an ephemeral port. It answers every A query with `203.0.113.10`. It never claims to be the network's resolver and nothing in the VM's networking was reconfigured: the "captive" path is the resolver we explicitly query with `dig @127.0.0.1 -p <port>`. Every slot starts the hijacker fresh, sanity-checks it with a lookup of `example.com` that must return the sentinel, and stops it at the end.

### The four per-name conditions

For each of the 12 names, in each slot, sequentially:

1. **Baseline system DNS:** `dig +short +time=3 +tries=2 A <name>` against the VM's default recursive resolver. We require a non-sentinel A record.
2. **Captive hijack:** the same `dig` aimed at the loopback hijacker. We require the sentinel.
3. **DoH by IP, Cloudflare:** an HTTPS GET to `https://1.1.1.1/dns-query?name=<name>&type=A` with `accept: application/dns-json`. See [Cloudflare's DNS JSON documentation](https://developers.cloudflare.com/1.1.1.1/encryption/dns-over-https/make-api-requests/dns-json/).
4. **DoH by IP, Google:** an HTTPS GET to `https://8.8.8.8/resolve?name=<name>&type=A`. See [Google's DoH JSON API](https://developers.google.com/speed/public-dns/docs/doh/json).

The DoH client is Python's `urllib`, which verifies certificates by default and opens a new connection per query. All 360 DoH calls succeeded under that default verification, so both IP-literal endpoints presented certificates that validated for their IP names. Because there is no connection reuse, each DoH time includes TCP and TLS setup, which makes the comparison with a single `dig` datagram conservative for DoH.

### The per-slot hostname bootstrap checks

Once per slot we asked the hijacker for `cloudflare-dns.com` and `dns.google` (the names a hostname-configured DoH client would have to resolve first). We also ran DoH to those hostnames over the VM's normal path with `example.com` as the query, to label the contrast: the system path was not hijacked globally, only the loopback resolver was, so that contrast is expected to succeed and tells us the endpoints were healthy.

### The Day 0 proxy contrast

On Day 0 only, we ran one extra probe: one Cloudflare DoH-by-IP query for `example.com` carried through a ProxySeller HTTP proxy with `curl`. It is a single observation and is reported as an anecdote, not as a rate. Diary slots never touched a proxy.

### What the numbers count

Each slot has 12 names times 4 conditions, so 48 name-level observations. Fifteen slots give 720 name-level observations. Add 30 hijacked hostname digs, 30 system-path hostname DoH calls, 15 hijacker sanity checks and the one proxy probe, and the study contains 796 measurements in total.

## Results

### Slot-level classification

All 15 slots classified `doh_escapes` for Cloudflare and for Google, with the hijack armed in every slot. None of the other codes occurred. We did not need to exclude any slot for a broken baseline. The only uncertainty in the classification is the limit of the simulation itself, covered below.

### Per-name outcomes across the week

| Signal | Count | Out of |
| --- | --- | --- |
| Baseline resolved to a real (non-sentinel) address | 180 | 180 |
| Hijacked lookup returned only the sentinel | 180 | 180 |
| Cloudflare DoH by IP returned a real address | 180 | 180 |
| Google DoH by IP returned a real address | 180 | 180 |
| Sentinel present in any DoH answer | 0 | 360 |
| DoH HTTP responses with status 200 | 360 | 360 |
| Hostname lookups poisoned through the hijacker | 30 | 30 |
| Hostname DoH over the system path that worked | 30 | 30 |

Every name behaved the same way. The four captive-probe hostnames, which are the names a real client would use to discover a portal, resolved to real addresses over both DoH endpoints on every slot, while the same four names resolved to the sentinel through the hijacker.

### Latency

All values are milliseconds per query, 180 observations per condition.

| Condition | Min | Median | Mean | P90 | P95 | Max |
| --- | --- | --- | --- | --- | --- | --- |
| Baseline system DNS (`dig`) | 18 | 21 | 22.6 | 29 | 39 | 51 |
| Captive hijack (loopback `dig`) | 15 | 17 | 17.0 | 19 | 20 | 22 |
| Cloudflare DoH by IP | 13 | 19 | 21.5 | 33 | 38 | 46 |
| Google DoH by IP | 14 | 21 | 22.2 | 30 | 35 | 52 |

Three things stand out. First, DoH by IP did not cost anything noticeable: its median is within two milliseconds of the system resolver, and the tail is of the same order. Second, the hijacked loopback lookup is the tightest distribution, between 15 and 22 ms, which tells us roughly what the `dig` process itself costs on this VM: a floor of about 15 to 17 ms before any network is involved. Third, DoH has the longest and heaviest tail (p90 of 33 ms for Cloudflare versus 29 ms for the baseline), which is what you would expect from opening a TLS connection per query.

The system-path DoH calls to the two resolver hostnames had a median of 24 ms (range 17 to 41), the same ballpark. The hostname lookups through the hijacker took a median of 17 ms (range 16 to 22), the same as any other hijacked lookup: the hijacker is fast at being wrong.

### Time of day and drift

Splitting the 14 diary slots by the 06:05 and 18:05 cadence gave medians of 20 / 16 / 18.5 / 21 ms (baseline / hijack / Cloudflare DoH / Google DoH) in the morning slots and 21 / 17 / 19 / 21 ms in the evening slots. The Day 0 slot was a little slower on DoH (24 ms for Cloudflare, 22.5 ms for Google), which may reflect the first run on a fresh process; we did not test that, and the difference is a few milliseconds. Across all 15 slots the per-slot medians moved inside narrow bands: 19 to 23 ms for the baseline, 16 to 18.5 for the hijack, 16 to 24 for Cloudflare DoH and 18.5 to 24.5 for Google DoH. There was no trend and no slot that stood out.

### Answer fidelity: was DoH returning the same addresses?

The question for a hijack is not just "did DoH answer" but "did it answer with real addresses". We compared answer *sets* (as hashes) between the system resolver and each DoH resolver for every name in every slot.

| Comparison | Identical set | Partial overlap | No overlap |
| --- | --- | --- | --- |
| Cloudflare DoH vs system resolver | 141 | 7 | 32 |
| Google DoH vs system resolver | 136 | 11 | 33 |

The two DoH resolvers shared at least one address with each other in 162 of 180 cases, more than either shared with the system resolver (148 and 147 respectively).

All of the disagreement sits in three names, and none of it involves the sentinel:

- **`captive.apple.com`:** the system resolver returned 13 different answer sets across 15 slots, Cloudflare returned 12 and Google returned 11. A single address overlapped between baseline and Cloudflare in only 1 of 15 slots (4 of 15 for Google). This is a rotating CDN pool.
- **`detectportal.firefox.com`:** baseline and both DoH resolvers never overlapped (0 of 15 for each), but Cloudflare and Google overlapped with each other in 15 of 15. The system resolver was returning one family of addresses, the two public resolvers another.
- **`www.msftconnecttest.com`:** 10 distinct baseline sets, Cloudflare overlapping in 12 of 15 slots and Google in 8 of 15.

The other nine names returned the identical address set through all three paths in every one of the 15 slots, and the answer sets for those names did not change across the week either. A plausible reading is that these three names are steered by resolver location or EDNS client-subnet handling, which differs between resolvers, but we did not test the cause, so we state it as a pattern and not as a finding. What matters for this study is the negative: no DoH answer anywhere was a captive address.

### Name-level latency

Two names stood out. `example.com` is first in the fixed order and had a Cloudflare DoH median of 35 ms (Google 24 ms) against 17 to 20 ms for most other names. That is consistent with first-query connection warm-up in each slot. Because we did not randomize order, we cannot separate position from name. `freepolicytools.com` is last in the order and was the slowest name on every condition that touches the real network (baseline median 36 ms, Cloudflare 29 ms, Google 33 ms) while its hijacked lookup stayed at 16 ms, so the extra time sits in the real lookup path for that name, not in DoH.

### The Day 0 proxy contrast

The single ProxySeller probe returned HTTP 200 and two non-sentinel addresses, the same two address hashes as the direct-path answer for `example.com` in that slot. It took 1,122 ms against a 24 ms median for direct Cloudflare DoH in the same slot, which is about 47 times slower. That is one measurement, through `curl` and a residential proxy hop, and we would not quote the ratio as a rate. We report it for two reasons: it confirms that the DoH-by-IP exchange survives an HTTP proxy hop, and it shows the order of magnitude a proxy hop adds to a latency-sensitive lookup.

## What it means

### Escape is a property of how the resolver is found

The result is the simple one, measured over a week with a zero-failure outcome: **DoH escapes a DNS-layer hijack when the client reaches its resolver without plaintext DNS, and it does not when the client needs plaintext DNS to find the resolver.** That is a mechanism, not a surprise, and the value of the study is the bound around it: 360 of 360 escapes, 0 of 360 contaminated answers, no time-of-day effect, and a latency cost indistinguishable from the baseline at the median.

### Captive-detection probes and the DNS signal

The four captive-probe names in our frozen list all resolved to real addresses over DoH while the hijacker returned the sentinel for them. Clients detect portals by fetching those probe URLs and checking the response. A lookup that escapes the portal's DNS removes one of the two signals a network can use to redirect that fetch; the other signal is interception of the HTTP connection itself, which we did not measure. This is one reason the portal ecosystem is moving toward explicit signaling through [RFC 8910](https://www.rfc-editor.org/rfc/rfc8910.html) instead of treating DNS poisoning as the primary mechanism.

### Hostname-configured DoH is the fragile case

A client configured with a DoH hostname must resolve that hostname before it can open the HTTPS connection. Our hijacker returned the sentinel for both hostnames in 30 of 30 attempts, so a client in that position receives an unreachable documentation address. Whether it falls back to system DNS, retries a built-in bootstrap address, or fails closed is a client decision that we did not measure. The protocol outcome we can report is that plaintext DNS under hijack cannot supply a usable address.

### For people who use public Wi-Fi

If you rely on DoH for privacy on hotel or airport Wi-Fi, the useful operational fact is that an IP-addressed DoH resolver is a way around DNS-level portal tricks. The corollary is that you may also bypass a portal that only works through DNS, and you may need to turn encrypted DNS off briefly to see the sign-in page. For guidance on protecting traffic once you are through the gate, see our [best VPN for travel](/blog/best-vpn-for-travel/) guide and the [DNS leaks prevention guide](/blog/dns-leaks-and-how-to-prevent-them/).

### For people who build or operate networks

DNS poisoning is a blunt instrument against clients that address a resolver by IP. A portal that needs DoH clients to see it has to either use the standard signaling in RFC 8910 or control the egress path in other ways, which is a firewall question and not a DNS question. We did not test any firewall behavior.

## Limits

- **It is a simulation.** We hijacked a resolver we chose to query. No real portal, firewall or walled garden was involved, and no VM networking was altered. A real portal usually also redirects HTTP and may block or reset traffic to arbitrary destinations before sign-in. Our result says nothing about whether TCP 443 to `1.1.1.1` or `8.8.8.8` is reachable on any real network. Escape in our setup required only that outbound HTTPS to those addresses was open, which it was.
- **The result is structurally expected.** A client that connects to an IP literal over HTTPS never asks the hijacker anything, so an escape rate of 100 percent follows from the design. The empirical content is the consistency across a week, the zero contamination, the certificate validation under default settings, the latency and the answer fidelity. The hostname poisoning result is also true by construction, because the hijacker answers every A query with the sentinel. It is a check that the simulation behaved as intended, not a discovery.
- **No browser or operating-system behavior was tested.** We did not test Chrome, Firefox, Safari or Windows DoH fallback logic, canary-domain handling, or captive-portal detection flows. We tested the network primitives they depend on.
- **JSON DoH, not wire-format DoH.** We used the JSON APIs (`application/dns-json`) for both resolvers. RFC 8484 wire format over HTTP/2 or HTTP/3 was not tested, nor was DNS over TLS or QUIC.
- **A records only.** No AAAA, HTTPS/SVCB or TXT lookups, and no IPv6 paths.
- **One vantage.** One USA datacenter VM, one resolver configuration, one week. Other networks may differ.
- **Latency comparisons are approximate.** The `dig` timings include process launch, and each DoH timing includes a fresh TLS handshake over a client that does not reuse connections. They compare "what a collector script saw", not the intrinsic cost of the protocols.
- **Name order was fixed.** We cannot separate the first-name effect from the name itself.
- **Answer-set disagreement was not diagnosed.** We saw it, we localized it to three names, and we did not test why.
- **The proxy contrast is one observation.**
- **Slot coverage.** 15 of 15 planned slots were collected with no gaps, but the span is 160.8 hours, not 168.

## Reproduce it

Everything is in the repository under `research/doh-captive-portal-week/`:

```bash
python3 scripts/collect_slot.py --freeze-only
python3 scripts/collect_slot.py --slot 20261124-immediate
python3 scripts/analyze.py
```

The collector runs the hijacker on a loopback port, so it needs no privileges. The analysis script rebuilds `analysis-summary.json` from the per-slot results.

## Evidence

All redacted slot results, per-slot summaries, the frozen target list, the protocol and the aggregated analysis are published under `/research/doh-captive-portal-week/`, with a ZIP and SHA-256 checksum. Raw egress addresses, hash salts and proxy credentials are never published.

## FAQ

**Does DoH bypass a captive portal?** In our simulation, DoH addressed by IP literal bypassed the DNS-layer hijack in 360 of 360 queries. That does not mean it bypasses a real portal, which may also block or redirect network traffic. It tells you the DNS layer alone is not enough to stop it.

**Why did hostname-based DoH fail?** Because resolving the resolver's own name needs plaintext DNS, and the hijacker answered every such query with the sentinel in 30 of 30 attempts.

**Is the 100 percent escape rate a surprise?** No. It follows from the mechanism. The study's value is measuring cost, consistency and answer fidelity, and showing the outcome did not change over a week.

**Did DoH slow lookups down?** Not at the median. Cloudflare DoH by IP had a 19 ms median and Google a 21 ms median, against 21 ms for the system resolver, with fresh connections for every DoH query. DoH had a heavier tail (p90 of 33 and 30 ms against 29 ms).

**Why did some DoH answers differ from the system resolver?** All differences were in three CDN-steered names. DoH and system answers were identical for the other nine in every slot. We did not test why the three differed.

**Did you test a real portal or a browser?** No. We simulated the DNS half on loopback and measured the underlying network behavior, not browser or operating-system logic.

**Why mention ProxySeller?** It carried the single Day 0 contrast probe. That is the only reason it appears here.

## Affiliate disclosure

This article contains a ProxySeller affiliate link, <https://freepolicytools.com/proxyseller/>, with `rel="nofollow sponsored"`. ProxySeller carried the single Day 0 proxy-contrast probe described above, so it is relevant to the measurements. We may earn a commission if you buy through the link. The commission does not change our methods, results or limits.
