What I found
In cloudflared 2026.7.3 (3a2b45c2a511fcdd81b68c190938e4ffadbea5dc), a wildcard ingress rule can point several hostnames at one fixed HTTPS/WSS origin with matchSNItoHost: true. For each request, cloudflared replaces DialTLSContext on a shared HTTP transport so a new dial would use the current Host as TLS SNI.
net/http.Transport may instead reuse an idle TLS connection keyed by the fixed origin address. That path does not call the new dial callback and does not include SNI in the pool identity. A later Host B request is written on the connection that was authenticated and SNI-routed for Host A.
The failed invariant: a request that uses dynamic SNI must travel only on a TLS connection authenticated and SNI-routed for that request’s effective Host.
sequenceDiagram
participant Client
participant CF as cloudflared
participant Pool as Shared HTTP transport
participant A as Backend A SNI A
participant B as Backend B SNI B
Client->>CF: Host A
CF->>Pool: DialTLS SNI A
Pool->>A: connection 1
Client->>CF: Host B
CF->>Pool: SetOriginServerName B
Pool->>A: reuse connection 1
Note over B: No Host B handshake
How it fails
Supported topology, all of:
- a fixed HTTPS or WSS origin address
matchSNItoHost: true- no fixed
httpHostHeader - an SNI-selecting origin entry point
- persistent HTTP/1.1 (keep-alive is default)
Path:
- Edge HTTP delivers Host.
proxyHTTPRequestselects the HTTP origin proxy. httpService.RoundTriprewrites the URL to the fixed origin, keeps request Host, callsSetOriginServerName.SetOriginServerNamereplaces the shared transport’sDialTLSContextso the next dial uses this Host asServerName.Transport.RoundTripmay pick an idle conn for the fixed origin scheme/address instead. No new handshake. Host B bytes go to backend A; backend A’s response goes back to the Host B client.
CWE-923. Sequential reuse is enough; no concurrent callback race is required. Certificate verification can stay enabled. This is not “Go Transport is buggy in isolation”: cloudflared mutates per-request identity on a pool that does not key that identity.
flowchart TD
Edge["Edge request with Host"] --> Rewrite["URL to fixed origin, Host retained"]
Rewrite --> SNI["SetOriginServerName on shared transport"]
SNI --> Dial["New dial would use this Host as SNI"]
SNI --> Idle["Idle pool keyed by origin address only"]
Idle --> Cross["Host B written on Host A's TLS conn"]
Dial --> Fresh["Host B would reach backend B"]
Attack shape
- Operator deploys the shared-entry-point config for two hostnames (e.g.
a.example.test,b.example.test). - A remote client requests Host A. cloudflared opens TLS connection 1 with SNI A; the origin routes it to backend A.
- While that conn is idle (default idle timeout 90s), the client sends Host B with sensitive headers or body.
- cloudflared reuses connection 1. Backend A sees Host B’s request. Backend A’s response is returned as Host B’s response.
No config access, edge compromise, connector compromise, or TLS bypass. The reviewed proof sent a Host B marker to backend A on connection 1; forcing a fresh connection sent the same Host B request to backend B on connection 2.
Impact
Host B request paths, headers, authorization material, and bodies can reach backend A. Response integrity is also gone: the Host B client may receive backend A’s output.
vulnerable: Host B request -> backend A
fresh TLS: Host B request -> backend B
Limited to hostnames that share the affected rule and fixed origin transport. The attacker can re-prime the idle conn. Restart or idle timeout clears a pooled socket; it does not fix the pool key.
Not affected (bounded, not a reason the multi-host topology is fine): single hostname, fixed httpHostHeader, reuse disabled, origin that ignores SNI.
Fix
Partition the origin connection pool by effective SNI / Host, or disable keep-alive when matchSNItoHost is on. Updating DialTLSContext is not enough: idle conns never see that callback.
A request for Host B must not be written on a TLS session whose ClientHello SNI was Host A.
What this is not
Not “the operator chose a shared origin, so mixing backends is intended.” matchSNItoHost exists so a shared TLS entry point still selects the matching origin per hostname. Not an insecure TLS setting. Distinct from a concurrent dial-callback race; the sequential idle-reuse path is sufficient.