[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 201/205: TLS: Fix switching off SSL session id when
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 201/205: TLS: Fix switching off SSL session id when client cert is used |
Date: |
Thu, 20 Apr 2017 16:22:21 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to annotated tag gnurl-7.54.0
in repository gnurl.
commit 33cfcfd9f0378625d3bddbd2c8ac5aad4b646f26
Author: Jay Satiro <address@hidden>
AuthorDate: Wed Mar 22 01:59:49 2017 -0400
TLS: Fix switching off SSL session id when client cert is used
Move the sessionid flag to ssl_primary_config so that ssl and proxy_ssl
will each have their own sessionid flag.
Regression since HTTPS-Proxy support was added in cb4e2be. Prior to that
this issue had been fixed in 247d890, CVE-2016-5419.
Bug: https://github.com/curl/curl/issues/1341
Reported-by: address@hidden
The new incarnation of this bug is called CVE-2017-7468 and is documented
here: https://curl.haxx.se/docs/adv_20170419.html
---
lib/url.c | 5 +++--
lib/urldata.h | 2 +-
lib/vtls/axtls.c | 4 ++--
lib/vtls/cyassl.c | 4 ++--
lib/vtls/darwinssl.c | 2 +-
lib/vtls/gtls.c | 4 ++--
lib/vtls/mbedtls.c | 4 ++--
lib/vtls/nss.c | 2 +-
lib/vtls/openssl.c | 4 ++--
lib/vtls/polarssl.c | 4 ++--
lib/vtls/schannel.c | 4 ++--
lib/vtls/vtls.c | 9 ++++++---
12 files changed, 26 insertions(+), 22 deletions(-)
diff --git a/lib/url.c b/lib/url.c
index 4609f4fda..caa28f5d4 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -546,7 +546,7 @@ CURLcode Curl_init_userdefined(struct UserDefined *set)
#endif
set->ssh_auth_types = CURLSSH_AUTH_DEFAULT; /* defaults to any auth
type */
- set->general_ssl.sessionid = TRUE; /* session ID caching enabled by
+ set->ssl.primary.sessionid = TRUE; /* session ID caching enabled by
default */
set->proxy_ssl = set->ssl;
@@ -2499,8 +2499,9 @@ CURLcode Curl_setopt(struct Curl_easy *data, CURLoption
option,
break;
case CURLOPT_SSL_SESSIONID_CACHE:
- data->set.general_ssl.sessionid = (0 != va_arg(param, long)) ?
+ data->set.ssl.primary.sessionid = (0 != va_arg(param, long)) ?
TRUE : FALSE;
+ data->set.proxy_ssl.primary.sessionid = data->set.ssl.primary.sessionid;
break;
#ifdef USE_LIBSSH2
diff --git a/lib/urldata.h b/lib/urldata.h
index bd7d25d2f..3c94553a1 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -360,6 +360,7 @@ struct ssl_primary_config {
char *random_file; /* path to file containing "random" data */
char *egdsocket; /* path to file containing the EGD daemon socket */
char *cipher_list; /* list of ciphers to use */
+ bool sessionid; /* cache session IDs or not */
};
struct ssl_config_data {
@@ -389,7 +390,6 @@ struct ssl_config_data {
};
struct ssl_general_config {
- bool sessionid; /* cache session IDs or not */
size_t max_ssl_sessions; /* SSL session id cache size */
};
diff --git a/lib/vtls/axtls.c b/lib/vtls/axtls.c
index af01fe314..f0e376640 100644
--- a/lib/vtls/axtls.c
+++ b/lib/vtls/axtls.c
@@ -262,7 +262,7 @@ static CURLcode connect_prep(struct connectdata *conn, int
sockindex)
* 2) setting up callbacks. these seem gnutls specific
*/
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
const uint8_t *ssl_sessionid;
size_t ssl_idsize;
@@ -392,7 +392,7 @@ static CURLcode connect_finish(struct connectdata *conn,
int sockindex)
conn->send[sockindex] = axtls_send;
/* Put our freshly minted SSL session in cache */
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
const uint8_t *ssl_sessionid = ssl_get_session_id(ssl);
size_t ssl_idsize = ssl_get_session_id_size(ssl);
Curl_ssl_sessionid_lock(conn);
diff --git a/lib/vtls/cyassl.c b/lib/vtls/cyassl.c
index 2dfd79dce..5f51ad5f9 100644
--- a/lib/vtls/cyassl.c
+++ b/lib/vtls/cyassl.c
@@ -398,7 +398,7 @@ cyassl_connect_step1(struct connectdata *conn,
#endif /* HAVE_ALPN */
/* Check if there's a cached ID we can/should use here! */
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
void *ssl_sessionid = NULL;
Curl_ssl_sessionid_lock(conn);
@@ -618,7 +618,7 @@ cyassl_connect_step3(struct connectdata *conn,
DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
bool incache;
SSL_SESSION *our_ssl_sessionid;
void *old_ssl_sessionid = NULL;
diff --git a/lib/vtls/darwinssl.c b/lib/vtls/darwinssl.c
index f8697cc79..5533dfe2f 100644
--- a/lib/vtls/darwinssl.c
+++ b/lib/vtls/darwinssl.c
@@ -1644,7 +1644,7 @@ static CURLcode darwinssl_connect_step1(struct
connectdata *conn,
#endif /* CURL_BUILD_MAC_10_9 || CURL_BUILD_IOS_7 */
/* Check if there's a cached ID we can/should use here! */
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
char *ssl_sessionid;
size_t ssl_sessionid_len;
diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c
index 51a5aa85b..0230778e2 100644
--- a/lib/vtls/gtls.c
+++ b/lib/vtls/gtls.c
@@ -873,7 +873,7 @@ gtls_connect_step1(struct connectdata *conn,
/* This might be a reconnect, so we check for a session ID in the cache
to speed up things */
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
void *ssl_sessionid;
size_t ssl_idsize;
@@ -1404,7 +1404,7 @@ gtls_connect_step3(struct connectdata *conn,
conn->recv[sockindex] = gtls_recv;
conn->send[sockindex] = gtls_send;
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
/* we always unconditionally get the session id here, as even if we
already got it from the cache and asked to use it in the connection, it
might've been rejected and then a new one is in use now and we need to
diff --git a/lib/vtls/mbedtls.c b/lib/vtls/mbedtls.c
index edf30dbd9..3ffa95752 100644
--- a/lib/vtls/mbedtls.c
+++ b/lib/vtls/mbedtls.c
@@ -430,7 +430,7 @@ mbed_connect_step1(struct connectdata *conn,
#endif
/* Check if there's a cached ID we can/should use here! */
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
void *old_session = NULL;
Curl_ssl_sessionid_lock(conn);
@@ -684,7 +684,7 @@ mbed_connect_step3(struct connectdata *conn,
DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
int ret;
mbedtls_ssl_session *our_ssl_sessionid;
void *old_ssl_sessionid = NULL;
diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c
index 1d7047a3d..489851131 100644
--- a/lib/vtls/nss.c
+++ b/lib/vtls/nss.c
@@ -1720,7 +1720,7 @@ static CURLcode nss_setup_connect(struct connectdata
*conn, int sockindex)
goto error;
/* do not use SSL cache if disabled or we are not going to verify peer */
- ssl_no_cache = (data->set.general_ssl.sessionid
+ ssl_no_cache = (SSL_SET_OPTION(primary.sessionid)
&& SSL_CONN_CONFIG(verifypeer)) ? PR_FALSE : PR_TRUE;
if(SSL_OptionSet(model, SSL_NO_CACHE, ssl_no_cache) != SECSuccess)
goto error;
diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c
index ee0761576..58a014a4d 100644
--- a/lib/vtls/openssl.c
+++ b/lib/vtls/openssl.c
@@ -2235,7 +2235,7 @@ static CURLcode ossl_connect_step1(struct connectdata
*conn, int sockindex)
#endif
/* Check if there's a cached ID we can/should use here! */
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
void *ssl_sessionid = NULL;
Curl_ssl_sessionid_lock(conn);
@@ -2965,7 +2965,7 @@ static CURLcode ossl_connect_step3(struct connectdata
*conn, int sockindex)
DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
bool incache;
SSL_SESSION *our_ssl_sessionid;
void *old_ssl_sessionid = NULL;
diff --git a/lib/vtls/polarssl.c b/lib/vtls/polarssl.c
index e6ad525ea..669091cb5 100644
--- a/lib/vtls/polarssl.c
+++ b/lib/vtls/polarssl.c
@@ -375,7 +375,7 @@ polarssl_connect_step1(struct connectdata *conn,
ssl_set_ciphersuites(&connssl->ssl, ssl_list_ciphersuites());
/* Check if there's a cached ID we can/should use here! */
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
void *old_session = NULL;
Curl_ssl_sessionid_lock(conn);
@@ -603,7 +603,7 @@ polarssl_connect_step3(struct connectdata *conn,
DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
int ret;
ssl_session *our_ssl_sessionid;
void *old_ssl_sessionid = NULL;
diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c
index e0fb2d5f6..c9b513230 100644
--- a/lib/vtls/schannel.c
+++ b/lib/vtls/schannel.c
@@ -188,7 +188,7 @@ schannel_connect_step1(struct connectdata *conn, int
sockindex)
connssl->cred = NULL;
/* check for an existing re-usable credential handle */
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
Curl_ssl_sessionid_lock(conn);
if(!Curl_ssl_getsessionid(conn, (void **)&old_cred, NULL, sockindex)) {
connssl->cred = old_cred;
@@ -757,7 +757,7 @@ schannel_connect_step3(struct connectdata *conn, int
sockindex)
#endif
/* save the current session data for possible re-use */
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
bool incache;
struct curl_schannel_cred *old_cred = NULL;
diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c
index c6935b5e6..d5d0971c4 100644
--- a/lib/vtls/vtls.c
+++ b/lib/vtls/vtls.c
@@ -122,6 +122,9 @@ Curl_clone_primary_ssl_config(struct ssl_primary_config
*source,
CLONE_STRING(egdsocket);
CLONE_STRING(random_file);
CLONE_STRING(clientcert);
+
+ /* Disable dest sessionid cache if a client cert is used, CVE-2016-5419. */
+ dest->sessionid = (dest->clientcert ? false : source->sessionid);
return TRUE;
}
@@ -308,9 +311,9 @@ bool Curl_ssl_getsessionid(struct connectdata *conn,
int port = isProxy ? (int)conn->port : conn->remote_port;
*ssl_sessionid = NULL;
- DEBUGASSERT(data->set.general_ssl.sessionid);
+ DEBUGASSERT(SSL_SET_OPTION(primary.sessionid));
- if(!data->set.general_ssl.sessionid)
+ if(!SSL_SET_OPTION(primary.sessionid))
/* session ID re-use is disabled */
return TRUE;
@@ -412,7 +415,7 @@ CURLcode Curl_ssl_addsessionid(struct connectdata *conn,
&conn->proxy_ssl_config :
&conn->ssl_config;
- DEBUGASSERT(data->set.general_ssl.sessionid);
+ DEBUGASSERT(SSL_SET_OPTION(primary.sessionid));
clone_host = strdup(isProxy ? conn->http_proxy.host.name : conn->host.name);
if(!clone_host)
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 133/205: gcc7: fix ‘*’ in boolean context, suggest ‘&&’ instead [-Wint-in-bool-context], (continued)
- [GNUnet-SVN] [gnurl] 133/205: gcc7: fix ‘*’ in boolean context, suggest ‘&&’ instead [-Wint-in-bool-context], gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 148/205: include: curl/system.h is a run-time version of curlbuild.h, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 160/205: tool_operate: move filetime code to its own function, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 170/205: sspi: print out InitializeSecurityContext() error message, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 180/205: RELEASE-NOTES: synced with f9d1e9a27f7e1, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 162/205: Revert "configure: prefer 'long long' to int64_t for curl_off_t", gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 166/205: system.h: set sizeof long to 4 on "default 32 bit" systems, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 195/205: configure.ac: ignore CR after version numbers, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 176/205: CURLINFO_SCHEME.3: fix variable type, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 193/205: unit1303: fix compiler warning, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 201/205: TLS: Fix switching off SSL session id when client cert is used,
gnunet <=
- [GNUnet-SVN] [gnurl] 154/205: url: don't free postponed data on connection reuse, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 69/205: http_proxy: Ignore TE and CL in CONNECT 2xx responses, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 202/205: nss: fix MinGW compiler warnings, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 159/205: configure: prefer 'long long' to int64_t for curl_off_t, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 197/205: code: fix typos and style in comments, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 149/205: docs: minor typo in write-out.d, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 181/205: nss: load CA certificates even with --insecure, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 186/205: Curl_expire_latest: ignore already expired timers, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 155/205: curl_sasl: declare mechtable static, gnunet, 2017/04/20
- [GNUnet-SVN] [gnurl] 150/205: easy: silence compiler warning, gnunet, 2017/04/20