Utilize SAN extension matching during SSL/TLS peer verification #482
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.
Even when specifying appropriate
CN_match
context settings it's not always possible to correctly verify peersusing the existing PHP encryption wrappers. Consider a scenario in which we connect to a party whose
certificate utilizes the Subject Alternative Name (SAN) X.509 extension. A real-world example is
github.com
whose common name (CN) isgithub.jparrowsec.cn
but whose certificate lists SAN entries of bothgithub.jparrowsec.cn
andwww.github.com
. An RFC 2818-compliant implementation will verify either name as correct:At this time PHP's encryption wrappers do not verify peer names against a cert's SAN list. As a result
the peer verification routine fails when attempting to verify the provided certificate with a
CN_match
field equal to"github.com"
.Note that this patch has no BC implications and should be safe to merge with 5.4 and 5.5 branches.