c260e0
From 1b6dc2b543446401fd38795f1ccf2b93633f01c0 Mon Sep 17 00:00:00 2001
c260e0
From: Daniel Stenberg <daniel@haxx.se>
c260e0
Date: Sun, 31 Jul 2016 00:51:48 +0200
c260e0
Subject: [PATCH 1/2] TLS: only reuse connections with the same client cert
c260e0
c260e0
CVE-2016-5420
c260e0
Bug: https://curl.haxx.se/docs/adv_20160803B.html
c260e0
c260e0
Upstream-commit: 11ec5ad4352bba384404c56e77c7fab9382fd22d
c260e0
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
c260e0
---
c260e0
 lib/sslgen.c | 1 +
c260e0
 1 file changed, 1 insertion(+)
c260e0
c260e0
diff --git a/lib/sslgen.c b/lib/sslgen.c
c260e0
index 3036bb2..79cbb6f 100644
c260e0
--- a/lib/sslgen.c
c260e0
+++ b/lib/sslgen.c
c260e0
@@ -90,6 +90,7 @@ Curl_ssl_config_matches(struct ssl_config_data* data,
c260e0
      (data->verifyhost == needle->verifyhost) &&
c260e0
      safe_strequal(data->CApath, needle->CApath) &&
c260e0
      safe_strequal(data->CAfile, needle->CAfile) &&
c260e0
+     safe_strequal(data->clientcert, needle->clientcert) &&
c260e0
      safe_strequal(data->random_file, needle->random_file) &&
c260e0
      safe_strequal(data->egdsocket, needle->egdsocket) &&
c260e0
      safe_strequal(data->cipher_list, needle->cipher_list))
c260e0
-- 
c260e0
2.5.5
c260e0
c260e0
c260e0
From 1a7116f8607868b26355c512e5844a9b85f16daf Mon Sep 17 00:00:00 2001
c260e0
From: Kamil Dudka <kdudka@redhat.com>
c260e0
Date: Mon, 22 Aug 2016 10:24:35 +0200
c260e0
Subject: [PATCH 2/2] nss: refuse previously loaded certificate from file
c260e0
c260e0
... when we are not asked to use a certificate from file
c260e0
c260e0
Upstream-commit: 7700fcba64bf5806de28f6c1c7da3b4f0b38567d
c260e0
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
c260e0
---
c260e0
 lib/nss.c | 8 +++++++-
c260e0
 1 file changed, 7 insertions(+), 1 deletion(-)
c260e0
c260e0
diff --git a/lib/nss.c b/lib/nss.c
c260e0
index 1f02988..7b4fe57 100644
c260e0
--- a/lib/nss.c
c260e0
+++ b/lib/nss.c
c260e0
@@ -760,10 +760,10 @@ static SECStatus SelectClientCert(void *arg, PRFileDesc *sock,
c260e0
   struct ssl_connect_data *connssl = (struct ssl_connect_data *)arg;
c260e0
   struct SessionHandle *data = connssl->data;
c260e0
   const char *nickname = connssl->client_nickname;
c260e0
+  static const char pem_slotname[] = "PEM Token #1";
c260e0
 
c260e0
   if(connssl->obj_clicert) {
c260e0
     /* use the cert/key provided by PEM reader */
c260e0
-    static const char pem_slotname[] = "PEM Token #1";
c260e0
     SECItem cert_der = { 0, NULL, 0 };
c260e0
     void *proto_win = SSL_RevealPinArg(sock);
c260e0
     struct CERTCertificateStr *cert;
c260e0
@@ -825,6 +825,12 @@ static SECStatus SelectClientCert(void *arg, PRFileDesc *sock,
c260e0
   if(NULL == nickname)
c260e0
     nickname = "[unknown]";
c260e0
 
c260e0
+  if(!strncmp(nickname, pem_slotname, sizeof(pem_slotname) - 1U)) {
c260e0
+    failf(data, "NSS: refusing previously loaded certificate from file: %s",
c260e0
+          nickname);
c260e0
+    return SECFailure;
c260e0
+  }
c260e0
+
c260e0
   if(NULL == *pRetKey) {
c260e0
     failf(data, "NSS: private key not found for certificate: %s", nickname);
c260e0
     return SECFailure;
c260e0
-- 
c260e0
2.7.4
c260e0