-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected matching rule of .
appears in the hostname verification func
#8021
Comments
Th verification is based on verifying the Server Name Indication extension (that will fall back to the Host argument of connect) with appropriate certificate extension (that fallbacks to the common name). From description of SNI (Server Name Indication) RFC 6066: "HostName" contains the fully qualified DNS hostname of the server, So prefix should be ok! I tried you example on current OTP release (OTP-26) and (OTP-22.0) the result is:
|
Hi there, Thanks for your reply.
Following your reply, do you think the the
BTW, based on my understanding, the RFC 6066 (TLS Extensions) is designed for TLS, which is an application of PKI and PKIX. The more direct reference should be RFC 5280 (X.509 PKI) and RFC 6125(PKIX).
And RFC 5280 Section 7.1:
There should be no ignoring the prefix "." rule. In summary, in my personal view, |
Oh sorry, now I see you are complaining
returns true not that
does not return true. It is true that public_key should follow PKIX spec. I work a lot with TLS so that is why its my default perspective. I will have to look into this an come back to you. |
@x509-name-testing Yes I think it is a bug, and #8023 should solve it. |
…to maint * ingela/public_key/verify_hostname/GH-8021/OTP-18935: public_key: Fix hotsname comparison bug
Describe the bug
The prefix
.
(0x2e) is ignored in matchingCommonName (CN)
when usingpublic_key:pkix_verify_hostname
. E.g., the[CN]='..a'(0x2e2e61)
can match the[input]='a'(0x61)
. According to the rules in Stringprep(RFC3454, RFC4518) and PKIX(RFC 5280, RFC 6125), there is no rule about ignoring dot (.) at the prefix of string. It would be a name confusion if two strings are falsely matched in the hostname verification task. So we want to inquire if this is a bug. Looking forward to your views.To Reproduce
Example code for calling
OTP
's API for hostname verification.Example test case of X.509 certificate.
Examples of input strings:
a
,.a
,..a
, etc.Example of execution:
Expected behavior
It's the same as the description.
Affected versions
Testing environment: Erl 22. Not sure about other versions.
Additional context
Note that this behavior appears in matching
CN
. So, the certificate in the test case does not have the SAN part in certificate extensions. The matching CN as hostname rule is in the RFC 6125.From the functionality of
CN
in a certificate, there is no rule that the name string and input string should be fully qualified domain names (FQDN). Such strings like..a
should be acceptable to be stored in an X.509 certificate.The text was updated successfully, but these errors were encountered: