fix: enforce pathlen constraint in X509 API verify path#10651
Open
afldl wants to merge 1 commit into
Open
Conversation
|
Can one of the admins verify this patch? |
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
wolfSSL_X509_verify_cert()passesCERT_TYPEtoParseCertRelative(), but the pathlen enforcement guard inasn.cskips the check whentype == CERT_TYPE:This means the standalone X.509 verification API (
wolfSSL_X509_verify_cert()) never enforcesBasicConstraints.pathlen, allowing unlimited intermediate CAs.The TLS handshake path is NOT affected — it already uses
CHAIN_CERT_TYPE.Fix
Change
ssl_certman.cto useCHAIN_CERT_TYPE, consistent with the TLS path. One-line change:Reproduction
Create a 3-tier chain: Root → Intermediate (pathlen:0) → Sub-CA → Leaf. The Sub-CA violates the intermediate's
pathlen:0constraint.PoC available in the linked issue with full C source + pre-built DER certificates.
Testing
CHAIN_CERT_TYPEand works correctly — no regression expectedwolfSSL_X509_verify_cert()/wolfSSL_CertManagerVerifyBuffer()standalone API path changes behaviorCredit
Discovered through differential fuzzing of 6 X.509 implementations (PathDiff project).