summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJay Satiro <raysatiro@yahoo.com>2021-02-27 16:27:31 -0500
committerJay Satiro <raysatiro@yahoo.com>2021-04-22 16:53:37 -0400
commit54e747501626b81149b1b44949119d365db82004 (patch)
tree6c89f73c8eb7bbb96877a83e27b3b3916d5534e7 /src
parente4ba999646ed7a974813ecf8405651d300554eba (diff)
downloadcurl-54e747501626b81149b1b44949119d365db82004.tar.gz
schannel: Disable auto credentials; add an option to enable it
- Disable auto credentials by default. This is a breaking change for clients that are using it, wittingly or not. - New libcurl ssl option value CURLSSLOPT_AUTO_CLIENT_CERT tells libcurl to automatically locate and use a client certificate for authentication, when requested by the server. - New curl tool options --ssl-auto-client-cert and --proxy-ssl-auto-client-cert map to CURLSSLOPT_AUTO_CLIENT_CERT. This option is only supported for Schannel (the native Windows SSL library). Prior to this change Schannel would, with no notification to the client, attempt to locate a client certificate and send it to the server, when requested by the server. Since the server can request any certificate that supports client authentication in the OS certificate store it could be a privacy violation and unexpected. Fixes https://github.com/curl/curl/issues/2262 Reported-by: Jeroen Ooms Assisted-by: Wes Hinsley Assisted-by: Rich FitzJohn Ref: https://curl.se/mail/lib-2021-02/0066.html Reported-by: Morten Minde Neergaard Closes https://github.com/curl/curl/pull/6673
Diffstat (limited to 'src')
-rw-r--r--src/tool_cfgable.h3
-rw-r--r--src/tool_getparam.c13
-rw-r--r--src/tool_help.c6
-rw-r--r--src/tool_operate.c21
-rw-r--r--src/tool_setopt.c1
-rw-r--r--src/tool_setopt.h1
6 files changed, 39 insertions, 6 deletions
diff --git a/src/tool_cfgable.h b/src/tool_cfgable.h
index 95c66d081..c7c8dfea5 100644
--- a/src/tool_cfgable.h
+++ b/src/tool_cfgable.h
@@ -267,6 +267,9 @@ struct OperationConfig {
revocation list errors */
bool native_ca_store; /* use the native os ca store */
+ bool ssl_auto_client_cert; /* automatically locate and use a client
+ certificate for authentication (Schannel) */
+ bool proxy_ssl_auto_client_cert; /* proxy version of ssl_auto_client_cert */
bool use_metalink; /* process given URLs as metalink XML file */
struct metalinkfile *metalinkfile_list; /* point to the first node */
diff --git a/src/tool_getparam.c b/src/tool_getparam.c
index ad89ea312..d616b255c 100644
--- a/src/tool_getparam.c
+++ b/src/tool_getparam.c
@@ -247,7 +247,8 @@ static const struct LongShort aliases[]= {
{"El", "tlspassword", ARG_STRING},
{"Em", "tlsauthtype", ARG_STRING},
{"En", "ssl-allow-beast", ARG_BOOL},
- /* Eo */
+ {"Eo", "ssl-auto-client-cert", ARG_BOOL},
+ {"EO", "proxy-ssl-auto-client-cert", ARG_BOOL},
{"Ep", "pinnedpubkey", ARG_STRING},
{"EP", "proxy-pinnedpubkey", ARG_STRING},
{"Eq", "cert-status", ARG_BOOL},
@@ -1651,6 +1652,16 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
config->ssl_allow_beast = toggle;
break;
+ case 'o': /* --ssl-auto-client-cert */
+ if(curlinfo->features & CURL_VERSION_SSL)
+ config->ssl_auto_client_cert = toggle;
+ break;
+
+ case 'O': /* --proxy-ssl-auto-client-cert */
+ if(curlinfo->features & CURL_VERSION_SSL)
+ config->proxy_ssl_auto_client_cert = toggle;
+ break;
+
case 'p': /* Pinned public key DER file */
GetStr(&config->pinnedpubkey, nextarg);
break;
diff --git a/src/tool_help.c b/src/tool_help.c
index 32893547d..78c441e77 100644
--- a/src/tool_help.c
+++ b/src/tool_help.c
@@ -598,6 +598,9 @@ static const struct helptxt helptext[] = {
{" --proxy-ssl-allow-beast",
"Allow security flaw for interop for HTTPS proxy",
CURLHELP_PROXY | CURLHELP_TLS},
+ {" --proxy-ssl-auto-client-cert",
+ "Use auto client certificate for proxy (Schannel)",
+ CURLHELP_PROXY | CURLHELP_TLS},
{" --proxy-tls13-ciphers <ciphersuite list>",
"TLS 1.3 proxy cipher suites",
CURLHELP_PROXY | CURLHELP_TLS},
@@ -727,6 +730,9 @@ static const struct helptxt helptext[] = {
{" --ssl-allow-beast",
"Allow security flaw to improve interop",
CURLHELP_TLS},
+ {" --ssl-auto-client-cert",
+ "Use auto client certificate (Schannel)",
+ CURLHELP_TLS},
{" --ssl-no-revoke",
"Disable cert revocation checks (Schannel)",
CURLHELP_TLS},
diff --git a/src/tool_operate.c b/src/tool_operate.c
index 5e7a9fa87..cd6131692 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -1720,20 +1720,31 @@ static CURLcode single_transfer(struct GlobalConfig *global,
{
long mask =
- (config->ssl_allow_beast ? CURLSSLOPT_ALLOW_BEAST : 0) |
+ (config->ssl_allow_beast ?
+ CURLSSLOPT_ALLOW_BEAST : 0) |
+ (config->ssl_no_revoke ?
+ CURLSSLOPT_NO_REVOKE : 0) |
(config->ssl_revoke_best_effort ?
CURLSSLOPT_REVOKE_BEST_EFFORT : 0) |
(config->native_ca_store ?
CURLSSLOPT_NATIVE_CA : 0) |
- (config->ssl_no_revoke ? CURLSSLOPT_NO_REVOKE : 0);
+ (config->ssl_auto_client_cert ?
+ CURLSSLOPT_AUTO_CLIENT_CERT : 0);
if(mask)
my_setopt_bitmask(curl, CURLOPT_SSL_OPTIONS, mask);
}
- if(config->proxy_ssl_allow_beast)
- my_setopt(curl, CURLOPT_PROXY_SSL_OPTIONS,
- (long)CURLSSLOPT_ALLOW_BEAST);
+ {
+ long mask =
+ (config->proxy_ssl_allow_beast ?
+ CURLSSLOPT_ALLOW_BEAST : 0) |
+ (config->proxy_ssl_auto_client_cert ?
+ CURLSSLOPT_AUTO_CLIENT_CERT : 0);
+
+ if(mask)
+ my_setopt_bitmask(curl, CURLOPT_PROXY_SSL_OPTIONS, mask);
+ }
}
if(config->path_as_is)
diff --git a/src/tool_setopt.c b/src/tool_setopt.c
index 196affc04..673f6b35d 100644
--- a/src/tool_setopt.c
+++ b/src/tool_setopt.c
@@ -133,6 +133,7 @@ const struct NameValueUnsigned setopt_nv_CURLSSLOPT[] = {
NV(CURLSSLOPT_NO_PARTIALCHAIN),
NV(CURLSSLOPT_REVOKE_BEST_EFFORT),
NV(CURLSSLOPT_NATIVE_CA),
+ NV(CURLSSLOPT_AUTO_CLIENT_CERT),
NVEND,
};
diff --git a/src/tool_setopt.h b/src/tool_setopt.h
index a54e34639..a2711fb00 100644
--- a/src/tool_setopt.h
+++ b/src/tool_setopt.h
@@ -76,6 +76,7 @@ extern const struct NameValueUnsigned setopt_nv_CURLHSTS[];
#define setopt_nv_CURLOPT_FTP_SSL_CCC setopt_nv_CURLFTPSSL_CCC
#define setopt_nv_CURLOPT_USE_SSL setopt_nv_CURLUSESSL
#define setopt_nv_CURLOPT_SSL_OPTIONS setopt_nv_CURLSSLOPT
+#define setopt_nv_CURLOPT_PROXY_SSL_OPTIONS setopt_nv_CURLSSLOPT
#define setopt_nv_CURLOPT_NETRC setopt_nv_CURL_NETRC
#define setopt_nv_CURLOPT_PROTOCOLS setopt_nv_CURLPROTO
#define setopt_nv_CURLOPT_REDIR_PROTOCOLS setopt_nv_CURLPROTO