audk/CryptoPkg/Library/TlsLib
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
..
InternalTlsLib.h CryptoPkg: Replace BSD License with BSD+Patent License 2019-04-09 09:10:22 -07:00
TlsConfig.c CryptoPkg/TlsLib: TlsSetVerifyHost: parse IP address literals as such (CVE-2019-14553) 2019-11-02 12:08:05 +01:00
TlsInit.c CryptoPkg: Replace BSD License with BSD+Patent License 2019-04-09 09:10:22 -07:00
TlsLib.inf CryptoPkg: Replace BSD License with BSD+Patent License 2019-04-09 09:10:22 -07:00
TlsLib.uni CryptoPkg: Replace BSD License with BSD+Patent License 2019-04-09 09:10:22 -07:00
TlsProcess.c CryptoPkg: Replace BSD License with BSD+Patent License 2019-04-09 09:10:22 -07:00