The combination of supporting RFC 6125 legacy fall back to ' Subject CommonName' for hostname matching by TLS clients and RFC 5280 path validation when 'Subject Alternative Name' is missing or has no domain name can in combination create a bypass possibility of domain name constraints.
Instead the public_key function public_key:pkix_verify_hostname/3 should adhere to RFC 9525 that is TLS hostname check should fail if no 'Subject Alternative Name' (SAN) extension is present in the certificate.
That is, previous fallback behavior of checking 'Subject CommonName' when 'Subject Alternative Name' is missing or has no domain name is disallowed.
Also according to RFC 5280 Subject Alternative Name 'MAY' adhere to certificate name constraints extension while the subject name 'MUST' adhere to it (Sse RFC 2119 for interpretation of 'MAY' and 'MUST').
'public_key' will verify that both adheres to the constraint, although this was treated as one error which was not clearly documented and could perhaps result in someone using a 'verify_fun' to accept this error rendering both errors optional, when only the 'MAY' error can be acceptable to ignore.
Now two different errors will be generated to avoid this possible misconfiguration.
Impact
This impacts the TLS clients using Erlang/OTP 'ssl' application, as well as possible other TLS client implementations relying on the 'public_key' function. The worst case scenario is if an attacker can control a DNS-constrained sub-CA key (legitimate delegation or compromise) and is in a position to intercept network traffic allowing a Man in the Middle Attack to forge a certificate issued for a different domain.
The severity of this CVE can be mitigated if the system is not running on a public network or possible alternative validation
technics are also applied.
Workarounds
The 'ssl' 'verify_fun' option can be used ensure that the path validation will fail if the end entity certificate is missing the SAN-extension or has no domain name.
Do not use a 'verify_fun' that accepts the 'name_not_permitted' error
Affected/Unaffected Versions
A version larger than or equal to one of the listed patched versions is unaffected; otherwise, a version that satisfies an expression listed under affected versions is affected, and if it does not, it is unaffected.
In the case of this vulnerability, ssl application part of OTP versions prior to OTP 20.0 does not implement the hostname check, and hence should not be used for that reason, unless it is implemented using a custom verify_fun.
The combination of supporting RFC 6125 legacy fall back to ' Subject CommonName' for hostname matching by TLS clients and RFC 5280 path validation when 'Subject Alternative Name' is missing or has no domain name can in combination create a bypass possibility of domain name constraints.
Instead the public_key function public_key:pkix_verify_hostname/3 should adhere to RFC 9525 that is TLS hostname check should fail if no 'Subject Alternative Name' (SAN) extension is present in the certificate.
That is, previous fallback behavior of checking 'Subject CommonName' when 'Subject Alternative Name' is missing or has no domain name is disallowed.
Also according to RFC 5280 Subject Alternative Name 'MAY' adhere to certificate name constraints extension while the subject name 'MUST' adhere to it (Sse RFC 2119 for interpretation of 'MAY' and 'MUST').
'public_key' will verify that both adheres to the constraint, although this was treated as one error which was not clearly documented and could perhaps result in someone using a 'verify_fun' to accept this error rendering both errors optional, when only the 'MAY' error can be acceptable to ignore.
Now two different errors will be generated to avoid this possible misconfiguration.
Impact
This impacts the TLS clients using Erlang/OTP 'ssl' application, as well as possible other TLS client implementations relying on the 'public_key' function. The worst case scenario is if an attacker can control a DNS-constrained sub-CA key (legitimate delegation or compromise) and is in a position to intercept network traffic allowing a Man in the Middle Attack to forge a certificate issued for a different domain.
The severity of this CVE can be mitigated if the system is not running on a public network or possible alternative validation
technics are also applied.
Workarounds
The 'ssl' 'verify_fun' option can be used ensure that the path validation will fail if the end entity certificate is missing the SAN-extension or has no domain name.
Do not use a 'verify_fun' that accepts the 'name_not_permitted' error
Affected/Unaffected Versions
A version larger than or equal to one of the listed patched versions is unaffected; otherwise, a version that satisfies an expression listed under affected versions is affected, and if it does not, it is unaffected.
In the case of this vulnerability, ssl application part of OTP versions prior to OTP 20.0 does not implement the hostname check, and hence should not be used for that reason, unless it is implemented using a custom verify_fun.