3 ms·
> This could also cause some quite unexpected behavior if your applications/infrastructure sits behind a common reverse proxy where all hosts share a *.host.tld
by tialaramex 4y ago
> This could also cause some quite unexpected behavior if your applications/infrastructure sits behind a common reverse proxy where all hosts share a *.host.tld certificate pointing to the same reverse proxy. Imagine static.host.tld serving you the login page, which also tries to make a request to api.host.tld which shares the same certificate and IP but with the given host name would have been proxied to a different backend server.
If your static.host.tld cheerfully claims to be api.host.tld and you gave it a certificate testifying to this claim, then it's really your fault when it can't serve API queries right?
Outfits like Cloudflare handle the mapping properly, even if they have arranged a single certificate for this.example, that.example and the-other.example, they care whether a particular TLS session says it's for this.example or that.example and the transactions will accordingly go to the correct place. This Mozilla behaviour doesn't cause any problems.
This is something a crappy bulk host probably gets wrong using Apache httpd since Apache doesn't make even the bare minimum effort to actually implement this correctly by default (When a TLS client says "Hi I want to talk to api.host.example" and there is no such host configured, Apache just figures the default host can handle it even though the standard explicitly says that's wrong...). Fortunately the crappy bulk host is almost certainly just mapping everything through a bunch of VirtualHost rules and you probably can't exploit it in the way you describe these days, although they should probably really use an HTTP server from somebody competent.
- xg15 4y ago> they care whether a particular TLS session says it's for this.example or that.example and the transactions will accordingly go to the correct place. This Mozilla behaviour doesn't cause any problems. Indeed they do - via the SNI header, which is set once per TLS connection, not once per HTTP request. I would think initializing a connection for one domain and then reusing it for a different domain could absolutely cause problems.
- voidwtf 4y agoI think your missing the part of the bug report where Firefox is REUSING the existing TLS connection, which was established with a completely different SNI. If I have a load balancer handling all these connections, and I routed a connection through to static-backend-1 then Firefox “cheerfully” decided to reuse this connection for api.host.tld, how is my load balancer which has already handed off the connection to static-backend-1 going to do anything about that?
- tialaramex 4y agoMozilla are doing this for HTTP/2 which transports the entire URI, not like HTTP/1.0 where people just figure hey, I needn't send the server's name. So, the request for api.host.tld says "api.host.tld" on it. If your static server receives this request, but isn't able to service api.host.tld requests the HTTP/2 specification provides an HTTP error code to return 421, saying, oops, I can't help you with that - and the specification tells clients that in this case they might try asking via another route.