Skip to content

ECH in Practice – C2 Behind a CDN

In my previous post about ECH I wrote that ECH encrypts the SNI, so the firewall sees only the CDN name and URL filtering stops working for sites behind it. That was the theory. Let’s move to the practical side now and see how ECH looks in practice.

My infrastructure is simple. I have a basic command and control server, reachable under api.sys-app.pl, hidden behind Cloudflare. An agent on the client talks to that server. From the network it’s just HTTPS to a site behind Cloudflare.

Without ECH

First the baseline, plain SSL/TLS, no ECH.

In the video the agent talks to the C2 server and on the firewall, in URL filtering, we see communication to api.sys-app.pl. The firewall categorized it as command and control. This is what we want to see – the real destination, categorized correctly.

With ECH

Now I enable ECH. Same scenario, the agent talks to the same C2 server, this time with ECH.

The communication on the firewall is now only to a Cloudflare name – cloudflare-ech.com. The real destination is gone. api.sys-app.pl is nowhere in the logs, and the command and control category doesn’t match anything anymore. The agent works exactly the same, only the firewall is blind.

Blocking the DNS record

In the previous post I wrote that to stop ECH, the HTTPS record needs to be blocked. So I block SVCB, HTTPS and ANY record types on the firewall.

In the video ECH can’t establish. The client can’t fetch the ECH config from DNS, so there is a fallback to plain SSL/TLS. Communication to api.sys-app.pl is visible again on the firewall.

DoH

But there is still DoH. If the client uses DNS over HTTPS, the DNS query is encrypted, the firewall doesn’t see it, and the ECH config can be fetched again. So DoH has to be blocked too.

With DoH blocked, the client can’t fetch the config over encrypted DNS either, and again we have fallback to plain SSL/TLS. The real destination is visible again.

Visibility

One more thing. Some network security solutions give visibility into ECH itself. On Palo Alto Networks we get a threat log, type vulnerability, “TLS Encrypted Client Hello Extension Detection”. So even before blocking, we can see ECH is present in our traffic.

Summary

Same point as before. Having the right network security solution is one thing. Using it, and hardening it so it can’t be bypassed, is the other one.

Join the conversation

Your email address will not be published. Required fields are marked *