toolhq.io

All posts
6 min readby Jameel Haider

Encrypted Client Hello: what ECH hides, and when it fails

TLS 1.3 encrypts almost everything about a connection, including the certificate. One thing it leaves visible is the name of the site you are connecting to. Encrypted Client Hello, usually shortened to ECH, closes that gap. It works under specific conditions and quietly does nothing under others.

What leaks in a normal handshake

The first message of a TLS handshake is the ClientHello, and it is sent before any keys exist, so it travels in the clear. Inside it is the SNI field, which carries the hostname so the server can pick the right certificate. SNI: one IP, many certificates covers why that field has to exist.

The result is that anyone on the path, such as a Wi-Fi operator, an ISP or a firewall, can read which hostname you asked for even though the rest of the session is encrypted. That one field is how most network level site blocking and passive monitoring works.

Inner and outer ClientHello

ECH solves this by sending two ClientHello messages, one wrapped inside the other.

  • The outer ClientHello is visible to the network. Its SNI carries a generic public name that is shared by everything behind the same front end.
  • The inner ClientHello carries the real hostname and the other sensitive extensions. It is encrypted under a public key that the server publishes in advance.

The front end decrypts the inner message, reads the real name, and completes the handshake for that site. An observer sees a connection to the shared public name and nothing more specific.

Two limits follow directly from the design:

  • The server still sees everything. ECH hides the hostname from the network, not from the party you are connecting to. The CDN or front end that decrypts the inner ClientHello knows exactly which site you want.
  • A dedicated IP address undoes it. If a site is the only thing on its address, the destination IP identifies it and the encrypted name adds little. The privacy comes from many sites sharing one front end, so that the outer name and the IP could mean any of them.

How the key is published in DNS

The client needs the server's ECH public key before it sends the first packet, so the key cannot come from the handshake itself. It comes from DNS.

The ECH configuration is published in the ech parameter of an HTTPS record for the hostname. HTTPS is a record type from the SVCB family that describes how to reach a service, and it sits alongside the familiar types covered in DNS records explained. Simplified, it looks like this:

shop.example.com.  300  IN  HTTPS  1 . alpn="h2,h3" ech="AEX+DQBB..."

The value of ech is an encoded blob containing the public key, the public name to use in the outer ClientHello, and the supported cipher suites. You can query the record type directly:

dig shop.example.com HTTPS

This dependency has a consequence that is easy to miss. If the client looks up shop.example.com over ordinary plaintext DNS, the hostname has already leaked in the query, and encrypting it a moment later in the handshake achieves nothing. ECH is only useful together with encrypted DNS, meaning DNS over HTTPS or DNS over TLS. Browsers that support ECH generally tie it to their encrypted DNS setting for this reason.

When it fails

ECH is designed to fail soft. In most cases a failure does not produce an error, it produces an ordinary handshake with the hostname visible. That is good for reliability and bad for anyone assuming the name is hidden.

SituationWhat happens
Client cannot fetch the HTTPS recordFalls back to plaintext SNI
ECH key in DNS is staleServer rejects the inner ClientHello and the client retries with the correct config
Network blocks the HTTPS record typeECH is effectively disabled for everyone behind it
Middlebox depends on reading SNIConnections break, or ECH is stripped

Three of these deserve a note.

Stale key. Operators rotate ECH keys, and DNS caches hold old answers for the length of the TTL. When a client encrypts to a key the server no longer holds, the server cannot read the inner ClientHello. It completes the handshake against the outer public name instead and hands back its current configuration, and the client retries with that. The connection succeeds, at the cost of an extra round trip. This is the reason the public name needs a valid certificate of its own.

Blocked record type. A network that wants SNI visibility does not need to attack ECH. Filtering HTTPS record responses, or forcing clients onto a resolver that omits them, is enough to push every client back to plaintext.

Middleboxes. Corporate proxies and filtering appliances that make decisions by reading SNI see only the public name. Some block the connection, some strip ECH, and managed devices often have it turned off by policy. If a site works at home and fails on an office network, this is one candidate.

Turning it on, and checking it

For most sites, ECH is not something you configure on the origin server. It is a setting on the CDN or front end that terminates TLS, plus the HTTPS record in DNS, which the same provider usually publishes for you when it also runs your DNS. The provider manages the keys and their rotation. If your DNS is hosted elsewhere, check that the HTTPS record is actually being served and that its TTL is short enough to survive a key rotation without a long tail of retries.

ECH requires TLS 1.3, so confirm that first. The SSL Checker reports the protocol versions a host negotiates along with the certificate and chain, and TLS 1.2 vs TLS 1.3 explains what changed between them. Then query the HTTPS record and confirm the ech parameter is present.

The practical summary is short. ECH hides the hostname from the network when the site shares a front end, the client supports it, the record is reachable and the DNS lookup is encrypted. If any one of those is missing, the handshake falls back and the name is visible again. Treat it as a privacy improvement for your visitors, not as a guarantee.