Skip to content

Regression: certificate host validation to strict if SAN present #875

@databus23

Description

@databus23

I did this

> curl https://$COMMON_NAME.
curl: (51) SSL: no alternative certificate subject name matches target host name '$COMMON_NAME'

Server certificate contains this:

....
Subject: ..., CN=$COMMON_NAME
...
X509v3 Subject Alternative Name:
                email:whatever@whatever.corp
...

I expected the following

no problem fetching the url

curl/libcurl version

curl 7.49.1 (x86_64-buildroot-linux-gnu) libcurl/7.49.1 OpenSSL/1.0.2h zlib/1.2.8 libssh2/1.7.0
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: IPv6 Largefile NTLM SSL libz TLS-SRP UnixSockets

Problem

In recent versions of curl the CN is ignored when any SAN is present in the certificate regardless of the SAN's type. I think this commit 5f5b626 is responsible for the change in behaviour. matched used to be tristate (no match yet, mismatch, match) and was changed to a boolean. With this change the validation now fails even if the SAN contains no usable entries (e.g. email)

If I read RFC6125 Section 6.4.4 the old behavior is at least allowed.

Was this change intentional? We are running a large internal coporate CA for years now which always imprints the requester as an email SAN in each certificate. Newer versions of curl don't work with our certificates anymore which only contain the hostname in the CN.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions