openssl
openssl copied to clipboard
ECH-draft-13c: s_server ctx switch (switch to inner) bug
Fix here (but I don't know how to create a PR across repos): https://github.com/Neimhin/openssl/pull/4/files
In s_server
we should switch to ctx2 when ECH is successful and when the inner SNI matches the host of the cert in ctx2. I believe the logic currently switches context whenever ECH is successful and an inner SNI is provided (regardless of whether the inner SNI matches the cert for ctx2).
This if
condition in [1] is, I think, always true.
I haven't yet run any code to test this, let me know if you want me to do a demo of this bug.
The comment preceding the servername callback function says to use X509_check_host
[2], which actually checks whether a hostname matches the CN of the cert (but perhaps does not verify it?). It seems to me it would be okay to not verify the hostname since the server owns the cert.
[1] https://github.com/sftcd/openssl/blob/61451686e836f20c50b92d4ed4fa10ac7d38a0de/apps/s_server.c#L682
[2] https://github.com/sftcd/openssl/blob/61451686e836f20c50b92d4ed4fa10ac7d38a0de/apps/s_server.c#L522