-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUGFIX] Set SNI on each redirect to avoid handshake failures / incorrect server name #306
Conversation
Merge master into fork
Merge back into master
Sync master
…specting --server-name and --no-sni
@Rich5 my first patch was bad. This version should fully fix your issues. Can you please test it when you have a moment? It's working for me on your sample hosts and does not break @dadrian, @elliot-censys, @zakird I think this patch is important as it may impact a non-negligible amount of HTTPS endpoints. Would you take a look at it if you have time? It's a small patch- I included comments that you can remove if you like. The only thing that a mistake in this patch could impact is SNI-related functionality- specifically I needed to make a minor change to function parameters for the function returned by The gist (behaviorally) can be seen using the example @Rich5 provided in #300:
For this endpoint, the behavior before the patch looked like this:
This patch just updates the SNI server name on every request in a redirect chain (unless The important point here is that the old behavior causes servers that have mandatory SNI to either fail negotiation entirely or return a fallback certificate and fallback virtual host configuration This specific case happened to be Cloudflare, which obviously makes up a big chunk of HTTPS on the web and is only getting bigger. I believe Cloudflare customers need to explicitly opt-in to SNI- they definitely need to opt-in to an SNI-only configuration- so it may not be too much of a problem now, but it's going to get bigger over time as they are pushing SNI pretty hard. They'are also pushing ESNI but I believe this will just be available opportunistically alongside SNI because hardly any browsers or client libraries support it. While we're here- I want to point out two other behaviors I noticed, both with and without this change
Thanks, I appreciate your patience and help with everything- I can imagine that features/bugfixes aside, just "keeping the lights on" for zcrypto, zmap and zgrab2 probably takes up a lot of your time BTW- If anyone would like to take a look at #302 that would be great too. It's a much simpler change :) |
I encountered no issues when testing this PR in my use cases 👍 |
…rect server name (#306) * Set SNI explicitly, in case it's a redirect (fix for #300) * Fix the SNI issue correctly, using the host portion of addr, while respecting --server-name and --no-sni * Clean up double error logging pointed out by dadrien * Comply with RFC4366, do not set SNI server name for IP address Co-authored-by: Adam Greene <[email protected]> zmap/zgrab2#306
This is a fix for issue #300, where the SNI server name was only set once, at the start of an HTTP scan. This caused incorrect SNI server name values when not using
--no-sni
or--server-name
. The example case is in #300Details follow, the initial commit was a botched patch but the latest commit fixes it. It was a little more involved than I thought it would be, though still a pretty small change