fix(tls): require a verified leaf key for CertificateVerify#10
Open
alanhoff wants to merge 1 commit into
Open
Conversation
Fail closed when certificate verification is enabled but the server Certificate message is empty or the extracted leaf public key does not fit the verification buffer, and add regression tests for the empty-list, oversized-key, and missing-leaf-key paths. Co-authored-by: Codex <noreply@openai.com>
There was a problem hiding this comment.
Pull request overview
This PR hardens the TLS 1.3 client authentication path by ensuring CertificateVerify signature validation cannot be skipped when certificate verification is enabled, closing a vulnerability where an empty certificate list or oversized leaf key could bypass verification.
Changes:
- Fail closed during
Certificateprocessing when verification is enabled but the server sends an empty certificate list. - Store (and require) a verified leaf public key for
CertificateVerify; reject empty/oversized extracted leaf keys and error if the key is missing atCertificateVerify. - Add regression tests covering empty certificate list, oversized leaf key, and missing-leaf-key during
CertificateVerify.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
CertificateVerifyto have a stored leaf verification key instead of silently skipping signature validationVulnerability
With certificate verification enabled, the client currently stores the leaf public key only when it happens to fit the fixed 600-byte verification buffer. If the server sends an empty certificate list, or sends a leaf certificate whose extracted public key is larger than that buffer,
leaf_pub_key_lenstays zero and the laterCertificateVerifystep is skipped entirely.Concrete examples:
certificate_listand still continue intoCertificateVerify, because the client never raises an error before the signature check gateleaf_pub_key_lenat zero, which previously disabled signature verification the same wayskip_cert_verifyisfalseValidation
zig build testzig buildzig build fuzzgh issue list --repo endel/quic-zig --search "CertificateVerify empty certificate list oversized key tls13" --limit 20References