diff options
author | Vijay Anusuri <vanusuri@mvista.com> | 2023-04-27 07:55:55 +0530 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2023-05-03 04:09:42 -1000 |
commit | 87a450e2224aa7cb55432df004f38a1045af619c (patch) | |
tree | adc7de67013a31a90bddb5d120498934f4e7415a | |
parent | d58a0c32395fdf48f144ba7f59820134364f7ea6 (diff) | |
download | poky-87a450e2224aa7cb55432df004f38a1045af619c.tar.gz |
curl: Security fix CVE-2023-27533, CVE-2023-27535 and CVE-2023-27536
Upstream-Status: Backport [https://git.launchpad.net/ubuntu/+source/curl/tree/debian/patches?h=ubuntu/focal-security & https://github.com/curl/curl/commit/538b1e79a6e7b0bb829ab4cecc828d32105d0684 & https://github.com/curl/curl/commit/ed5095ed94281989e103c72e032200b83be37878 & https://github.com/curl/curl/commit/f18af4f874cecab82a9797e8c7541e0990c7a64c & https://github.com/curl/curl/commit/8f4608468b890dce2dad9f91d5607ee7e9c1aba1 & https://github.com/curl/curl/commit/cb49e67303dbafbab1cebf4086e3ec15b7d56ee5]
(From OE-Core rev: 08ffa2437967a642a4c8e35e2158bb369454764a)
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r-- | meta/recipes-support/curl/curl/CVE-2023-27533.patch | 59 | ||||
-rw-r--r-- | meta/recipes-support/curl/curl/CVE-2023-27535-pre1.patch | 236 | ||||
-rw-r--r-- | meta/recipes-support/curl/curl/CVE-2023-27535.patch | 170 | ||||
-rw-r--r-- | meta/recipes-support/curl/curl/CVE-2023-27536.patch | 55 | ||||
-rw-r--r-- | meta/recipes-support/curl/curl_7.69.1.bb | 4 |
5 files changed, 524 insertions, 0 deletions
diff --git a/meta/recipes-support/curl/curl/CVE-2023-27533.patch b/meta/recipes-support/curl/curl/CVE-2023-27533.patch new file mode 100644 index 0000000000..64ba135056 --- /dev/null +++ b/meta/recipes-support/curl/curl/CVE-2023-27533.patch | |||
@@ -0,0 +1,59 @@ | |||
1 | Backport of: | ||
2 | |||
3 | From 538b1e79a6e7b0bb829ab4cecc828d32105d0684 Mon Sep 17 00:00:00 2001 | ||
4 | From: Daniel Stenberg <daniel@haxx.se> | ||
5 | Date: Mon, 6 Mar 2023 12:07:33 +0100 | ||
6 | Subject: [PATCH] telnet: only accept option arguments in ascii | ||
7 | |||
8 | To avoid embedded telnet negotiation commands etc. | ||
9 | |||
10 | Reported-by: Harry Sintonen | ||
11 | Closes #10728 | ||
12 | |||
13 | Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/curl/tree/debian/patches/CVE-2023-27533.patch?h=ubuntu/focal-security | ||
14 | Upstream commit https://github.com/curl/curl/commit/538b1e79a6e7b0bb829ab4cecc828d32105d0684] | ||
15 | CVE: CVE-2023-27533 | ||
16 | Signed-off-by: Vijay Anusuri <vanusuri@mvista.com> | ||
17 | --- | ||
18 | lib/telnet.c | 15 +++++++++++++++ | ||
19 | 1 file changed, 15 insertions(+) | ||
20 | |||
21 | --- a/lib/telnet.c | ||
22 | +++ b/lib/telnet.c | ||
23 | @@ -815,6 +815,17 @@ static void printsub(struct Curl_easy *d | ||
24 | } | ||
25 | } | ||
26 | |||
27 | +static bool str_is_nonascii(const char *str) | ||
28 | +{ | ||
29 | + size_t len = strlen(str); | ||
30 | + while(len--) { | ||
31 | + if(*str & 0x80) | ||
32 | + return TRUE; | ||
33 | + str++; | ||
34 | + } | ||
35 | + return FALSE; | ||
36 | +} | ||
37 | + | ||
38 | static CURLcode check_telnet_options(struct connectdata *conn) | ||
39 | { | ||
40 | struct curl_slist *head; | ||
41 | @@ -829,6 +840,8 @@ static CURLcode check_telnet_options(str | ||
42 | /* Add the user name as an environment variable if it | ||
43 | was given on the command line */ | ||
44 | if(conn->bits.user_passwd) { | ||
45 | + if(str_is_nonascii(data->conn->user)) | ||
46 | + return CURLE_BAD_FUNCTION_ARGUMENT; | ||
47 | msnprintf(option_arg, sizeof(option_arg), "USER,%s", conn->user); | ||
48 | beg = curl_slist_append(tn->telnet_vars, option_arg); | ||
49 | if(!beg) { | ||
50 | @@ -844,6 +857,9 @@ static CURLcode check_telnet_options(str | ||
51 | if(sscanf(head->data, "%127[^= ]%*[ =]%255s", | ||
52 | option_keyword, option_arg) == 2) { | ||
53 | |||
54 | + if(str_is_nonascii(option_arg)) | ||
55 | + continue; | ||
56 | + | ||
57 | /* Terminal type */ | ||
58 | if(strcasecompare(option_keyword, "TTYPE")) { | ||
59 | strncpy(tn->subopt_ttype, option_arg, 31); | ||
diff --git a/meta/recipes-support/curl/curl/CVE-2023-27535-pre1.patch b/meta/recipes-support/curl/curl/CVE-2023-27535-pre1.patch new file mode 100644 index 0000000000..034b72f7e6 --- /dev/null +++ b/meta/recipes-support/curl/curl/CVE-2023-27535-pre1.patch | |||
@@ -0,0 +1,236 @@ | |||
1 | From ed5095ed94281989e103c72e032200b83be37878 Mon Sep 17 00:00:00 2001 | ||
2 | From: Daniel Stenberg <daniel@haxx.se> | ||
3 | Date: Thu, 6 Oct 2022 00:49:10 +0200 | ||
4 | Subject: [PATCH] strcase: add and use Curl_timestrcmp | ||
5 | |||
6 | This is a strcmp() alternative function for comparing "secrets", | ||
7 | designed to take the same time no matter the content to not leak | ||
8 | match/non-match info to observers based on how fast it is. | ||
9 | |||
10 | The time this function takes is only a function of the shortest input | ||
11 | string. | ||
12 | |||
13 | Reported-by: Trail of Bits | ||
14 | |||
15 | Closes #9658 | ||
16 | |||
17 | Upstream-Status: Backport from [https://github.com/curl/curl/commit/ed5095ed94281989e103c72e032200b83be37878 & https://github.com/curl/curl/commit/f18af4f874cecab82a9797e8c7541e0990c7a64c] | ||
18 | Comment: to backport fix for CVE-2023-27535, add function Curl_timestrcmp. | ||
19 | Signed-off-by: Vijay Anusuri <vanusuri@mvista.com> | ||
20 | --- | ||
21 | lib/netrc.c | 6 +++--- | ||
22 | lib/strcase.c | 22 ++++++++++++++++++++++ | ||
23 | lib/strcase.h | 1 + | ||
24 | lib/url.c | 33 +++++++++++++-------------------- | ||
25 | lib/vauth/digest_sspi.c | 4 ++-- | ||
26 | lib/vtls/vtls.c | 21 ++++++++++++++++++++- | ||
27 | 6 files changed, 61 insertions(+), 26 deletions(-) | ||
28 | |||
29 | diff --git a/lib/netrc.c b/lib/netrc.c | ||
30 | index 9323913..fe3fd1e 100644 | ||
31 | --- a/lib/netrc.c | ||
32 | +++ b/lib/netrc.c | ||
33 | @@ -124,9 +124,9 @@ static int parsenetrc(const char *host, | ||
34 | /* we are now parsing sub-keywords concerning "our" host */ | ||
35 | if(state_login) { | ||
36 | if(specific_login) { | ||
37 | - state_our_login = strcasecompare(login, tok); | ||
38 | + state_our_login = !Curl_timestrcmp(login, tok); | ||
39 | } | ||
40 | - else if(!login || strcmp(login, tok)) { | ||
41 | + else if(!login || Curl_timestrcmp(login, tok)) { | ||
42 | if(login_alloc) { | ||
43 | free(login); | ||
44 | login_alloc = FALSE; | ||
45 | @@ -142,7 +142,7 @@ static int parsenetrc(const char *host, | ||
46 | } | ||
47 | else if(state_password) { | ||
48 | if((state_our_login || !specific_login) | ||
49 | - && (!password || strcmp(password, tok))) { | ||
50 | + && (!password || Curl_timestrcmp(password, tok))) { | ||
51 | if(password_alloc) { | ||
52 | free(password); | ||
53 | password_alloc = FALSE; | ||
54 | diff --git a/lib/strcase.c b/lib/strcase.c | ||
55 | index 70bf21c..ec776b3 100644 | ||
56 | --- a/lib/strcase.c | ||
57 | +++ b/lib/strcase.c | ||
58 | @@ -261,6 +261,28 @@ bool Curl_safecmp(char *a, char *b) | ||
59 | return !a && !b; | ||
60 | } | ||
61 | |||
62 | +/* | ||
63 | + * Curl_timestrcmp() returns 0 if the two strings are identical. The time this | ||
64 | + * function spends is a function of the shortest string, not of the contents. | ||
65 | + */ | ||
66 | +int Curl_timestrcmp(const char *a, const char *b) | ||
67 | +{ | ||
68 | + int match = 0; | ||
69 | + int i = 0; | ||
70 | + | ||
71 | + if(a && b) { | ||
72 | + while(1) { | ||
73 | + match |= a[i]^b[i]; | ||
74 | + if(!a[i] || !b[i]) | ||
75 | + break; | ||
76 | + i++; | ||
77 | + } | ||
78 | + } | ||
79 | + else | ||
80 | + return a || b; | ||
81 | + return match; | ||
82 | +} | ||
83 | + | ||
84 | /* --- public functions --- */ | ||
85 | |||
86 | int curl_strequal(const char *first, const char *second) | ||
87 | diff --git a/lib/strcase.h b/lib/strcase.h | ||
88 | index 8929a53..8077108 100644 | ||
89 | --- a/lib/strcase.h | ||
90 | +++ b/lib/strcase.h | ||
91 | @@ -49,5 +49,6 @@ void Curl_strntoupper(char *dest, const char *src, size_t n); | ||
92 | void Curl_strntolower(char *dest, const char *src, size_t n); | ||
93 | |||
94 | bool Curl_safecmp(char *a, char *b); | ||
95 | +int Curl_timestrcmp(const char *first, const char *second); | ||
96 | |||
97 | #endif /* HEADER_CURL_STRCASE_H */ | ||
98 | diff --git a/lib/url.c b/lib/url.c | ||
99 | index 9f14a7b..dfbde3b 100644 | ||
100 | --- a/lib/url.c | ||
101 | +++ b/lib/url.c | ||
102 | @@ -886,19 +886,10 @@ socks_proxy_info_matches(const struct proxy_info* data, | ||
103 | /* the user information is case-sensitive | ||
104 | or at least it is not defined as case-insensitive | ||
105 | see https://tools.ietf.org/html/rfc3986#section-3.2.1 */ | ||
106 | - if((data->user == NULL) != (needle->user == NULL)) | ||
107 | - return FALSE; | ||
108 | - /* curl_strequal does a case insentive comparison, so do not use it here! */ | ||
109 | - if(data->user && | ||
110 | - needle->user && | ||
111 | - strcmp(data->user, needle->user) != 0) | ||
112 | - return FALSE; | ||
113 | - if((data->passwd == NULL) != (needle->passwd == NULL)) | ||
114 | - return FALSE; | ||
115 | + | ||
116 | /* curl_strequal does a case insentive comparison, so do not use it here! */ | ||
117 | - if(data->passwd && | ||
118 | - needle->passwd && | ||
119 | - strcmp(data->passwd, needle->passwd) != 0) | ||
120 | + if(Curl_timestrcmp(data->user, needle->user) || | ||
121 | + Curl_timestrcmp(data->passwd, needle->passwd)) | ||
122 | return FALSE; | ||
123 | return TRUE; | ||
124 | } | ||
125 | @@ -1257,10 +1248,10 @@ ConnectionExists(struct Curl_easy *data, | ||
126 | if(!(needle->handler->flags & PROTOPT_CREDSPERREQUEST)) { | ||
127 | /* This protocol requires credentials per connection, | ||
128 | so verify that we're using the same name and password as well */ | ||
129 | - if(strcmp(needle->user, check->user) || | ||
130 | - strcmp(needle->passwd, check->passwd) || | ||
131 | - !Curl_safecmp(needle->sasl_authzid, check->sasl_authzid) || | ||
132 | - !Curl_safecmp(needle->oauth_bearer, check->oauth_bearer)) { | ||
133 | + if(Curl_timestrcmp(needle->user, check->user) || | ||
134 | + Curl_timestrcmp(needle->passwd, check->passwd) || | ||
135 | + Curl_timestrcmp(needle->sasl_authzid, check->sasl_authzid) || | ||
136 | + Curl_timestrcmp(needle->oauth_bearer, check->oauth_bearer)) { | ||
137 | /* one of them was different */ | ||
138 | continue; | ||
139 | } | ||
140 | @@ -1326,8 +1317,8 @@ ConnectionExists(struct Curl_easy *data, | ||
141 | possible. (Especially we must not reuse the same connection if | ||
142 | partway through a handshake!) */ | ||
143 | if(wantNTLMhttp) { | ||
144 | - if(strcmp(needle->user, check->user) || | ||
145 | - strcmp(needle->passwd, check->passwd)) { | ||
146 | + if(Curl_timestrcmp(needle->user, check->user) || | ||
147 | + Curl_timestrcmp(needle->passwd, check->passwd)) { | ||
148 | |||
149 | /* we prefer a credential match, but this is at least a connection | ||
150 | that can be reused and "upgraded" to NTLM */ | ||
151 | @@ -1348,8 +1339,10 @@ ConnectionExists(struct Curl_easy *data, | ||
152 | if(!check->http_proxy.user || !check->http_proxy.passwd) | ||
153 | continue; | ||
154 | |||
155 | - if(strcmp(needle->http_proxy.user, check->http_proxy.user) || | ||
156 | - strcmp(needle->http_proxy.passwd, check->http_proxy.passwd)) | ||
157 | + if(Curl_timestrcmp(needle->http_proxy.user, | ||
158 | + check->http_proxy.user) || | ||
159 | + Curl_timestrcmp(needle->http_proxy.passwd, | ||
160 | + check->http_proxy.passwd)) | ||
161 | continue; | ||
162 | } | ||
163 | else if(check->proxy_ntlm_state != NTLMSTATE_NONE) { | ||
164 | diff --git a/lib/vauth/digest_sspi.c b/lib/vauth/digest_sspi.c | ||
165 | index a109056..3986386 100644 | ||
166 | --- a/lib/vauth/digest_sspi.c | ||
167 | +++ b/lib/vauth/digest_sspi.c | ||
168 | @@ -450,8 +450,8 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data, | ||
169 | has changed then delete that context. */ | ||
170 | if((userp && !digest->user) || (!userp && digest->user) || | ||
171 | (passwdp && !digest->passwd) || (!passwdp && digest->passwd) || | ||
172 | - (userp && digest->user && strcmp(userp, digest->user)) || | ||
173 | - (passwdp && digest->passwd && strcmp(passwdp, digest->passwd))) { | ||
174 | + (userp && digest->user && Curl_timestrcmp(userp, digest->user)) || | ||
175 | + (passwdp && digest->passwd && Curl_timestrcmp(passwdp, digest->passwd))) { | ||
176 | if(digest->http_context) { | ||
177 | s_pSecFn->DeleteSecurityContext(digest->http_context); | ||
178 | Curl_safefree(digest->http_context); | ||
179 | diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c | ||
180 | index e8cb70f..70a9391 100644 | ||
181 | --- a/lib/vtls/vtls.c | ||
182 | +++ b/lib/vtls/vtls.c | ||
183 | @@ -98,9 +98,15 @@ Curl_ssl_config_matches(struct ssl_primary_config* data, | ||
184 | Curl_safecmp(data->issuercert, needle->issuercert) && | ||
185 | Curl_safecmp(data->clientcert, needle->clientcert) && | ||
186 | Curl_safecmp(data->random_file, needle->random_file) && | ||
187 | - Curl_safecmp(data->egdsocket, needle->egdsocket) && | ||
188 | + Curl_safecmp(data->egdsocket, needle->egdsocket) && | ||
189 | +#ifdef USE_TLS_SRP | ||
190 | + !Curl_timestrcmp(data->username, needle->username) && | ||
191 | + !Curl_timestrcmp(data->password, needle->password) && | ||
192 | + (data->authtype == needle->authtype) && | ||
193 | +#endif | ||
194 | Curl_safe_strcasecompare(data->cipher_list, needle->cipher_list) && | ||
195 | Curl_safe_strcasecompare(data->cipher_list13, needle->cipher_list13) && | ||
196 | + Curl_safe_strcasecompare(data->CRLfile, needle->CRLfile) && | ||
197 | Curl_safe_strcasecompare(data->pinned_key, needle->pinned_key)) | ||
198 | return TRUE; | ||
199 | |||
200 | @@ -117,6 +123,9 @@ Curl_clone_primary_ssl_config(struct ssl_primary_config *source, | ||
201 | dest->verifyhost = source->verifyhost; | ||
202 | dest->verifystatus = source->verifystatus; | ||
203 | dest->sessionid = source->sessionid; | ||
204 | +#ifdef USE_TLS_SRP | ||
205 | + dest->authtype = source->authtype; | ||
206 | +#endif | ||
207 | |||
208 | CLONE_STRING(CApath); | ||
209 | CLONE_STRING(CAfile); | ||
210 | @@ -127,6 +136,11 @@ Curl_clone_primary_ssl_config(struct ssl_primary_config *source, | ||
211 | CLONE_STRING(cipher_list); | ||
212 | CLONE_STRING(cipher_list13); | ||
213 | CLONE_STRING(pinned_key); | ||
214 | + CLONE_STRING(CRLfile); | ||
215 | +#ifdef USE_TLS_SRP | ||
216 | + CLONE_STRING(username); | ||
217 | + CLONE_STRING(password); | ||
218 | +#endif | ||
219 | |||
220 | return TRUE; | ||
221 | } | ||
222 | @@ -142,6 +156,11 @@ void Curl_free_primary_ssl_config(struct ssl_primary_config* sslc) | ||
223 | Curl_safefree(sslc->cipher_list); | ||
224 | Curl_safefree(sslc->cipher_list13); | ||
225 | Curl_safefree(sslc->pinned_key); | ||
226 | + Curl_safefree(sslc->CRLfile); | ||
227 | +#ifdef USE_TLS_SRP | ||
228 | + Curl_safefree(sslc->username); | ||
229 | + Curl_safefree(sslc->password); | ||
230 | +#endif | ||
231 | } | ||
232 | |||
233 | #ifdef USE_SSL | ||
234 | -- | ||
235 | 2.25.1 | ||
236 | |||
diff --git a/meta/recipes-support/curl/curl/CVE-2023-27535.patch b/meta/recipes-support/curl/curl/CVE-2023-27535.patch new file mode 100644 index 0000000000..e38390a57c --- /dev/null +++ b/meta/recipes-support/curl/curl/CVE-2023-27535.patch | |||
@@ -0,0 +1,170 @@ | |||
1 | From 8f4608468b890dce2dad9f91d5607ee7e9c1aba1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Daniel Stenberg <daniel@haxx.se> | ||
3 | Date: Thu, 9 Mar 2023 17:47:06 +0100 | ||
4 | Subject: [PATCH] ftp: add more conditions for connection reuse | ||
5 | |||
6 | Reported-by: Harry Sintonen | ||
7 | Closes #10730 | ||
8 | |||
9 | Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/curl/tree/debian/patches/CVE-2023-27535.patch?h=ubuntu/focal-security | ||
10 | Upstream commit https://github.com/curl/curl/commit/8f4608468b890dce2dad9f91d5607ee7e9c1aba1] | ||
11 | CVE: CVE-2023-27535 | ||
12 | Signed-off-by: Vijay Anusuri <vanusuri@mvista.com> | ||
13 | --- | ||
14 | lib/ftp.c | 30 ++++++++++++++++++++++++++++-- | ||
15 | lib/ftp.h | 5 +++++ | ||
16 | lib/setopt.c | 2 +- | ||
17 | lib/url.c | 16 +++++++++++++++- | ||
18 | lib/urldata.h | 4 ++-- | ||
19 | 5 files changed, 51 insertions(+), 6 deletions(-) | ||
20 | |||
21 | diff --git a/lib/ftp.c b/lib/ftp.c | ||
22 | index 31a34e8..7a82a74 100644 | ||
23 | --- a/lib/ftp.c | ||
24 | +++ b/lib/ftp.c | ||
25 | @@ -4059,6 +4059,10 @@ static CURLcode ftp_disconnect(struct connectdata *conn, bool dead_connection) | ||
26 | } | ||
27 | |||
28 | freedirs(ftpc); | ||
29 | + free(ftpc->account); | ||
30 | + ftpc->account = NULL; | ||
31 | + free(ftpc->alternative_to_user); | ||
32 | + ftpc->alternative_to_user = NULL; | ||
33 | free(ftpc->prevpath); | ||
34 | ftpc->prevpath = NULL; | ||
35 | free(ftpc->server_os); | ||
36 | @@ -4326,11 +4330,31 @@ static CURLcode ftp_setup_connection(struct connectdata *conn) | ||
37 | struct Curl_easy *data = conn->data; | ||
38 | char *type; | ||
39 | struct FTP *ftp; | ||
40 | + struct ftp_conn *ftpc = &conn->proto.ftpc; | ||
41 | |||
42 | - conn->data->req.protop = ftp = calloc(sizeof(struct FTP), 1); | ||
43 | + ftp = calloc(sizeof(struct FTP), 1); | ||
44 | if(NULL == ftp) | ||
45 | return CURLE_OUT_OF_MEMORY; | ||
46 | |||
47 | + /* clone connection related data that is FTP specific */ | ||
48 | + if(data->set.str[STRING_FTP_ACCOUNT]) { | ||
49 | + ftpc->account = strdup(data->set.str[STRING_FTP_ACCOUNT]); | ||
50 | + if(!ftpc->account) { | ||
51 | + free(ftp); | ||
52 | + return CURLE_OUT_OF_MEMORY; | ||
53 | + } | ||
54 | + } | ||
55 | + if(data->set.str[STRING_FTP_ALTERNATIVE_TO_USER]) { | ||
56 | + ftpc->alternative_to_user = | ||
57 | + strdup(data->set.str[STRING_FTP_ALTERNATIVE_TO_USER]); | ||
58 | + if(!ftpc->alternative_to_user) { | ||
59 | + Curl_safefree(ftpc->account); | ||
60 | + free(ftp); | ||
61 | + return CURLE_OUT_OF_MEMORY; | ||
62 | + } | ||
63 | + } | ||
64 | + conn->data->req.protop = ftp; | ||
65 | + | ||
66 | ftp->path = &data->state.up.path[1]; /* don't include the initial slash */ | ||
67 | |||
68 | /* FTP URLs support an extension like ";type=<typecode>" that | ||
69 | @@ -4366,7 +4390,9 @@ static CURLcode ftp_setup_connection(struct connectdata *conn) | ||
70 | /* get some initial data into the ftp struct */ | ||
71 | ftp->transfer = FTPTRANSFER_BODY; | ||
72 | ftp->downloadsize = 0; | ||
73 | - conn->proto.ftpc.known_filesize = -1; /* unknown size for now */ | ||
74 | + ftpc->known_filesize = -1; /* unknown size for now */ | ||
75 | + ftpc->use_ssl = data->set.use_ssl; | ||
76 | + ftpc->ccc = data->set.ftp_ccc; | ||
77 | |||
78 | return CURLE_OK; | ||
79 | } | ||
80 | diff --git a/lib/ftp.h b/lib/ftp.h | ||
81 | index 984347f..163dcb3 100644 | ||
82 | --- a/lib/ftp.h | ||
83 | +++ b/lib/ftp.h | ||
84 | @@ -116,6 +116,8 @@ struct FTP { | ||
85 | struct */ | ||
86 | struct ftp_conn { | ||
87 | struct pingpong pp; | ||
88 | + char *account; | ||
89 | + char *alternative_to_user; | ||
90 | char *entrypath; /* the PWD reply when we logged on */ | ||
91 | char **dirs; /* realloc()ed array for path components */ | ||
92 | int dirdepth; /* number of entries used in the 'dirs' array */ | ||
93 | @@ -141,6 +143,9 @@ struct ftp_conn { | ||
94 | ftpstate state; /* always use ftp.c:state() to change state! */ | ||
95 | ftpstate state_saved; /* transfer type saved to be reloaded after | ||
96 | data connection is established */ | ||
97 | + unsigned char use_ssl; /* if AUTH TLS is to be attempted etc, for FTP or | ||
98 | + IMAP or POP3 or others! (type: curl_usessl)*/ | ||
99 | + unsigned char ccc; /* ccc level for this connection */ | ||
100 | curl_off_t retr_size_saved; /* Size of retrieved file saved */ | ||
101 | char *server_os; /* The target server operating system. */ | ||
102 | curl_off_t known_filesize; /* file size is different from -1, if wildcard | ||
103 | diff --git a/lib/setopt.c b/lib/setopt.c | ||
104 | index 4d96f6b..a91bb70 100644 | ||
105 | --- a/lib/setopt.c | ||
106 | +++ b/lib/setopt.c | ||
107 | @@ -2126,7 +2126,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param) | ||
108 | arg = va_arg(param, long); | ||
109 | if((arg < CURLUSESSL_NONE) || (arg >= CURLUSESSL_LAST)) | ||
110 | return CURLE_BAD_FUNCTION_ARGUMENT; | ||
111 | - data->set.use_ssl = (curl_usessl)arg; | ||
112 | + data->set.use_ssl = (unsigned char)arg; | ||
113 | break; | ||
114 | |||
115 | case CURLOPT_SSL_OPTIONS: | ||
116 | diff --git a/lib/url.c b/lib/url.c | ||
117 | index dfbde3b..f84375c 100644 | ||
118 | --- a/lib/url.c | ||
119 | +++ b/lib/url.c | ||
120 | @@ -1257,10 +1257,24 @@ ConnectionExists(struct Curl_easy *data, | ||
121 | } | ||
122 | } | ||
123 | |||
124 | - if(get_protocol_family(needle->handler->protocol) & PROTO_FAMILY_SSH) { | ||
125 | +#ifdef USE_SSH | ||
126 | + else if(get_protocol_family(needle->handler->protocol) & PROTO_FAMILY_SSH) { | ||
127 | if(!ssh_config_matches(needle, check)) | ||
128 | continue; | ||
129 | } | ||
130 | +#endif | ||
131 | +#ifndef CURL_DISABLE_FTP | ||
132 | + else if(get_protocol_family(needle->handler->protocol) & PROTO_FAMILY_FTP) { | ||
133 | + /* Also match ACCOUNT, ALTERNATIVE-TO-USER, USE_SSL and CCC options */ | ||
134 | + if(Curl_timestrcmp(needle->proto.ftpc.account, | ||
135 | + check->proto.ftpc.account) || | ||
136 | + Curl_timestrcmp(needle->proto.ftpc.alternative_to_user, | ||
137 | + check->proto.ftpc.alternative_to_user) || | ||
138 | + (needle->proto.ftpc.use_ssl != check->proto.ftpc.use_ssl) || | ||
139 | + (needle->proto.ftpc.ccc != check->proto.ftpc.ccc)) | ||
140 | + continue; | ||
141 | + } | ||
142 | +#endif | ||
143 | |||
144 | if(!needle->bits.httpproxy || (needle->handler->flags&PROTOPT_SSL) || | ||
145 | needle->bits.tunnel_proxy) { | ||
146 | diff --git a/lib/urldata.h b/lib/urldata.h | ||
147 | index 168f874..51b793b 100644 | ||
148 | --- a/lib/urldata.h | ||
149 | +++ b/lib/urldata.h | ||
150 | @@ -1730,8 +1730,6 @@ struct UserDefined { | ||
151 | void *ssh_keyfunc_userp; /* custom pointer to callback */ | ||
152 | enum CURL_NETRC_OPTION | ||
153 | use_netrc; /* defined in include/curl.h */ | ||
154 | - curl_usessl use_ssl; /* if AUTH TLS is to be attempted etc, for FTP or | ||
155 | - IMAP or POP3 or others! */ | ||
156 | long new_file_perms; /* Permissions to use when creating remote files */ | ||
157 | long new_directory_perms; /* Permissions to use when creating remote dirs */ | ||
158 | long ssh_auth_types; /* allowed SSH auth types */ | ||
159 | @@ -1851,6 +1849,8 @@ struct UserDefined { | ||
160 | BIT(http09_allowed); /* allow HTTP/0.9 responses */ | ||
161 | BIT(mail_rcpt_allowfails); /* allow RCPT TO command to fail for some | ||
162 | recipients */ | ||
163 | + unsigned char use_ssl; /* if AUTH TLS is to be attempted etc, for FTP or | ||
164 | + IMAP or POP3 or others! (type: curl_usessl)*/ | ||
165 | }; | ||
166 | |||
167 | struct Names { | ||
168 | -- | ||
169 | 2.25.1 | ||
170 | |||
diff --git a/meta/recipes-support/curl/curl/CVE-2023-27536.patch b/meta/recipes-support/curl/curl/CVE-2023-27536.patch new file mode 100644 index 0000000000..b04a77de25 --- /dev/null +++ b/meta/recipes-support/curl/curl/CVE-2023-27536.patch | |||
@@ -0,0 +1,55 @@ | |||
1 | From cb49e67303dbafbab1cebf4086e3ec15b7d56ee5 Mon Sep 17 00:00:00 2001 | ||
2 | From: Daniel Stenberg <daniel@haxx.se> | ||
3 | Date: Fri, 10 Mar 2023 09:22:43 +0100 | ||
4 | Subject: [PATCH] url: only reuse connections with same GSS delegation | ||
5 | |||
6 | Reported-by: Harry Sintonen | ||
7 | Closes #10731 | ||
8 | |||
9 | Upstream-Status: Backport [https://github.com/curl/curl/commit/cb49e67303dbafbab1cebf4086e3ec15b7d56ee5] | ||
10 | CVE: CVE-2023-27536 | ||
11 | Signed-off-by: Vijay Anusuri <vanusuri@mvista.com> | ||
12 | --- | ||
13 | lib/url.c | 6 ++++++ | ||
14 | lib/urldata.h | 1 + | ||
15 | 2 files changed, 7 insertions(+) | ||
16 | |||
17 | diff --git a/lib/url.c b/lib/url.c | ||
18 | index f84375c..87f4eb0 100644 | ||
19 | --- a/lib/url.c | ||
20 | +++ b/lib/url.c | ||
21 | @@ -1257,6 +1257,11 @@ ConnectionExists(struct Curl_easy *data, | ||
22 | } | ||
23 | } | ||
24 | |||
25 | + /* GSS delegation differences do not actually affect every connection | ||
26 | + and auth method, but this check takes precaution before efficiency */ | ||
27 | + if(needle->gssapi_delegation != check->gssapi_delegation) | ||
28 | + continue; | ||
29 | + | ||
30 | #ifdef USE_SSH | ||
31 | else if(get_protocol_family(needle->handler->protocol) & PROTO_FAMILY_SSH) { | ||
32 | if(!ssh_config_matches(needle, check)) | ||
33 | @@ -1708,6 +1713,7 @@ static struct connectdata *allocate_conn(struct Curl_easy *data) | ||
34 | conn->fclosesocket = data->set.fclosesocket; | ||
35 | conn->closesocket_client = data->set.closesocket_client; | ||
36 | conn->lastused = Curl_now(); /* used now */ | ||
37 | + conn->gssapi_delegation = data->set.gssapi_delegation; | ||
38 | |||
39 | return conn; | ||
40 | error: | ||
41 | diff --git a/lib/urldata.h b/lib/urldata.h | ||
42 | index 51b793b..b8a611b 100644 | ||
43 | --- a/lib/urldata.h | ||
44 | +++ b/lib/urldata.h | ||
45 | @@ -1118,6 +1118,7 @@ struct connectdata { | ||
46 | handle */ | ||
47 | BIT(sock_accepted); /* TRUE if the SECONDARYSOCKET was created with | ||
48 | accept() */ | ||
49 | + long gssapi_delegation; /* inherited from set.gssapi_delegation */ | ||
50 | }; | ||
51 | |||
52 | /* The end of connectdata. */ | ||
53 | -- | ||
54 | 2.25.1 | ||
55 | |||
diff --git a/meta/recipes-support/curl/curl_7.69.1.bb b/meta/recipes-support/curl/curl_7.69.1.bb index 46ee25da3a..32d18ddb3a 100644 --- a/meta/recipes-support/curl/curl_7.69.1.bb +++ b/meta/recipes-support/curl/curl_7.69.1.bb | |||
@@ -45,6 +45,10 @@ SRC_URI = "https://curl.haxx.se/download/curl-${PV}.tar.bz2 \ | |||
45 | file://CVE-2023-23916.patch \ | 45 | file://CVE-2023-23916.patch \ |
46 | file://CVE-2023-27534.patch \ | 46 | file://CVE-2023-27534.patch \ |
47 | file://CVE-2023-27538.patch \ | 47 | file://CVE-2023-27538.patch \ |
48 | file://CVE-2023-27533.patch \ | ||
49 | file://CVE-2023-27535-pre1.patch \ | ||
50 | file://CVE-2023-27535.patch \ | ||
51 | file://CVE-2023-27536.patch \ | ||
48 | " | 52 | " |
49 | 53 | ||
50 | SRC_URI[md5sum] = "ec5fc263f898a3dfef08e805f1ecca42" | 54 | SRC_URI[md5sum] = "ec5fc263f898a3dfef08e805f1ecca42" |