audk/CryptoPkg/Library
Laszlo Ersek 1e72b1fb2e CryptoPkg/TlsLib: TlsSetVerifyHost: parse IP address literals as such (CVE-2019-14553)
Using the inet_pton() function that we imported in the previous patches,
recognize if "HostName" is an IP address literal, and then parse it into
binary representation. Passing the latter to OpenSSL for server
certificate validation is important, per RFC-2818
<https://tools.ietf.org/html/rfc2818#section-3.1>:

> In some cases, the URI is specified as an IP address rather than a
> hostname. In this case, the iPAddress subjectAltName must be present in
> the certificate and must exactly match the IP in the URI.

Note: we cannot use X509_VERIFY_PARAM_set1_ip_asc() because in the OpenSSL
version that is currently consumed by edk2, said function depends on
sscanf() for parsing IPv4 literals. In
"CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c", we only provide an
empty -- always failing -- stub for sscanf(), however.

Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Sivaraman Nainar <sivaramann@amiindia.co.in>
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=960
CVE: CVE-2019-14553
Suggested-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
2019-11-02 12:08:05 +01:00
..
BaseCryptLib CryptoPkg/Crt: import "inet_pton.c" (CVE-2019-14553) 2019-11-02 12:07:59 +01:00
BaseCryptLibNull CryptoPkg: Add Null instance of the BaseCryptLib class 2019-10-23 18:37:19 -07:00
Include CryptoPkg/Crt: import "inet_pton.c" (CVE-2019-14553) 2019-11-02 12:07:59 +01:00
IntrinsicLib CryptoPkg IntrinsicLib: Make _fltused always be used 2019-10-24 09:41:34 +08:00
OpensslLib CryptoPkg/OpensslLib: Update process_files.pl to generate .h files 2019-10-30 10:38:03 +08:00
TlsLib CryptoPkg/TlsLib: TlsSetVerifyHost: parse IP address literals as such (CVE-2019-14553) 2019-11-02 12:08:05 +01:00
TlsLibNull CryptoPkg: Add Null instance of the TlsLib class 2019-10-23 14:42:28 -07:00