Repository navigation
tls: check basicConstraints in CertTree.verify - #5255
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
CertTree chained certificates on issuer/subject matching and signature validity alone, so a CA:FALSE certificate issued by a trusted CA could issue a certificate for any name, and verify() accepted it. Reject chains that go through a certificate that is not a CA, and honor pathLenConstraint. AI-Assisted: yes (Claude Fable 5.1)
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
CertTreechains certificates on issuer/subject matching and signature validity only (cert.py#L1806), andCertTree.verifychecks the validity period and the hostname but neverbasicConstraints(cert.py#L1845-L1884). Any CA:FALSE certificate issued by a trusted CA can sign a certificate for another name, and the result verifies. WithTLSClientAutomaton(verify_server=True)/cafile, a MitM holding a certificate from the trusted CA for its own name passes the chain and hostname checks;CMS_Engine.verify(Kerberos PKINIT) is affected the same way.Repro with the test PKI (
srv_cert.pemis CA:FALSE):verifynow rejects a chain that goes through a certificate withoutcA, and enforcespathLenConstraint(RFC 5280 sect 6.1.4). The trust anchor is not checked, so a non-CA certificate can still be pinned. Tests added tocert.uts.