Repository navigation
tls: reject invalid ServerKeyExchange signature in TLS client - #5248
Open
musthaf-bughunter wants to merge 1 commit into
Open
musthaf-bughunter wants to merge 1 commit into
musthaf-bughunter wants to merge 1 commit into
Conversation
TLSServerKeyExchange.post_dissection only logged a failed signature check, and TLSClientAutomaton continued the handshake. Store the result in the session and abort with a decrypt_error alert, as is already done for the TLS 1.3 CertificateVerify. AI-Assisted: yes (Claude Opus 5.5)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
TLSServerKeyExchange.post_dissectiononly logs a failed (EC)DHE parameter signature check (handshake.py#L1105-L1109), andTLSClientAutomaton.HANDLED_SERVERKEYEXCHANGEdoes nothing with it (automaton_cli.py#L475-L477). Withverify_server=True/cafile, a TLS <= 1.2 client checks the forwarded certificate chain and hostname, then accepts key exchange parameters signed by any key, so a MitM that only has the server certificate can complete the handshake.Repro (
srv.pemissued byca.pemforscapy.test,evil_key.peman unrelated RSA key):The result is now stored in the session (
server_kx_sig_valid) and the client aborts with adecrypt_erroralert, the same way as the TLS 1.3CertificateVerifycheck (server_cert_verify_valid). Anonymous key exchanges are not affected. A test using a server key that doesn't match its certificate is added totlsclientserver.uts.