From 0f6a97db34963d177c611b951dc057f05ca80a8f Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Fri, 26 Aug 2016 15:36:16 +0200 Subject: [PATCH] Related: CVE-2016-5420 - fix incorrect use of a previously loaded certificate from file --- 0001-curl-7.51.0-cert-reuse.patch | 45 +++++++++++++++++++++++++++++++ curl.spec | 11 +++++++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 0001-curl-7.51.0-cert-reuse.patch diff --git a/0001-curl-7.51.0-cert-reuse.patch b/0001-curl-7.51.0-cert-reuse.patch new file mode 100644 index 0000000..fff6c7b --- /dev/null +++ b/0001-curl-7.51.0-cert-reuse.patch @@ -0,0 +1,45 @@ +From ec122e23098aad8b6e3d97070cca5858b72558e2 Mon Sep 17 00:00:00 2001 +From: Kamil Dudka +Date: Mon, 22 Aug 2016 10:24:35 +0200 +Subject: [PATCH] nss: refuse previously loaded certificate from file + +... when we are not asked to use a certificate from file + +Upstream-commit: 7700fcba64bf5806de28f6c1c7da3b4f0b38567d +Signed-off-by: Kamil Dudka +--- + lib/vtls/nss.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c +index ad33f25..e467360 100644 +--- a/lib/vtls/nss.c ++++ b/lib/vtls/nss.c +@@ -1004,10 +1004,10 @@ static SECStatus SelectClientCert(void *arg, PRFileDesc *sock, + struct ssl_connect_data *connssl = (struct ssl_connect_data *)arg; + struct Curl_easy *data = connssl->data; + const char *nickname = connssl->client_nickname; ++ static const char pem_slotname[] = "PEM Token #1"; + + if(connssl->obj_clicert) { + /* use the cert/key provided by PEM reader */ +- static const char pem_slotname[] = "PEM Token #1"; + SECItem cert_der = { 0, NULL, 0 }; + void *proto_win = SSL_RevealPinArg(sock); + struct CERTCertificateStr *cert; +@@ -1069,6 +1069,12 @@ static SECStatus SelectClientCert(void *arg, PRFileDesc *sock, + if(NULL == nickname) + nickname = "[unknown]"; + ++ if(!strncmp(nickname, pem_slotname, sizeof(pem_slotname) - 1U)) { ++ failf(data, "NSS: refusing previously loaded certificate from file: %s", ++ nickname); ++ return SECFailure; ++ } ++ + if(NULL == *pRetKey) { + failf(data, "NSS: private key not found for certificate: %s", nickname); + return SECFailure; +-- +2.7.4 + diff --git a/curl.spec b/curl.spec index 77ad046..a669a97 100644 --- a/curl.spec +++ b/curl.spec @@ -1,11 +1,15 @@ Summary: A utility for getting files from remote servers (FTP, HTTP, and others) Name: curl Version: 7.50.1 -Release: 1%{?dist} +Release: 2%{?dist} License: MIT Group: Applications/Internet Source: http://curl.haxx.se/download/%{name}-%{version}.tar.lzma +# fix incorrect use of a previously loaded certificate from file +# (related to CVE-2016-5420) +Patch1: 0001-curl-7.51.0-cert-reuse.patch + # patch making libcurl multilib ready Patch101: 0101-curl-7.32.0-multilib.patch @@ -128,6 +132,7 @@ documentation of the library, too. %setup -q # upstream patches +%patch1 -p1 # Fedora patches %patch101 -p1 @@ -232,6 +237,10 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/aclocal/libcurl.m4 %changelog +* Fri Aug 26 2016 Kamil Dudka 7.50.1-2 +- fix incorrect use of a previously loaded certificate from file + (related to CVE-2016-5420) + * Wed Aug 03 2016 Kamil Dudka 7.50.1-1 - new upstream release (fixes CVE-2016-5419, CVE-2016-5420, and CVE-2016-5421)