[CONC-413] C/C may not compare IP address to Subject Alternative Name fields for server certificate verification Created: 2019-05-22  Updated: 2022-07-01

Status: Open
Project: MariaDB Connector/C
Component/s: None
Affects Version/s: 3.0.8, 3.1.0
Fix Version/s: 3.3

Type: Bug Priority: Major
Reporter: Geoff Montee (Inactive) Assignee: Georg Richter
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-19560 Client may not compare IP address to ... Closed
relates to CONC-250 SSL hostname verification for Subject... Closed
relates to MDEV-10594 SSL hostname verification fails for S... Closed
relates to MDEV-18131 MariaDB does not verify IP addresses ... Closed

 Description   

Support for server certificate verification against subjectAltName (SAN) fields was added in the following Jira issues:

This seems to be supported with OpenSSL, Schannel, and GnuTLS.

However, I noticed that C/C does not necessarily check the server's IP address against the subjectAltName (SAN) fields in the certificate. It only checks mysql->host, which can be a host name or an IP address. If the user specifies the server's host as a host name, then I don't believe that C/C will verify the certificate using the server's IP address.

With OpenSSL, it just checks mysql->host:

https://github.com/MariaDB/mariadb-connector-c/blob/b50871611764d282874ad095d6c021163d1fe354/libmariadb/secure/openssl.c#L814

And with Schannel, it also just checks mysql->host:

https://github.com/MariaDB/mariadb-connector-c/blob/b50871611764d282874ad095d6c021163d1fe354/libmariadb/secure/schannel.c#L440

https://github.com/MariaDB/mariadb-connector-c/blob/b50871611764d282874ad095d6c021163d1fe354/libmariadb/secure/schannel.c#L501

And with GnuTLS, it also just checks mysql->host:

https://github.com/MariaDB/mariadb-connector-c/blob/b50871611764d282874ad095d6c021163d1fe354/libmariadb/secure/gnutls.c#L1427

https://github.com/MariaDB/mariadb-connector-c/blob/b50871611764d282874ad095d6c021163d1fe354/libmariadb/secure/gnutls.c#L1474

I see that the IP address is resolved from the host name here:

https://github.com/MariaDB/mariadb-connector-c/blob/b50871611764d282874ad095d6c021163d1fe354/plugins/pvio/pvio_socket.c#L848

Can this IP address be saved somewhere, so that it can be used for the server certificate verification step?


Generated at Thu Feb 08 03:05:08 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.