Skip to contentSkip to conversation

curl

PATCH In review Valek, Andrej 2 participants 13 messages Mar 9, 2023 – Mar 14, 2023 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hello Steve,

I have a question about curl. Would it be possible to backport some fixes for CVEs from kirkstone to dunfell?

CVE-2022-32221
CVE-2022-42915
CVE-2022-42916
CVE-2022-43552
CVE-2022-43551

Thank you,
Andrej

#1 lore raw
Quoted 2 lines · Andrej

I have a question about curl. Would it be possible to backport some fixes for CVEs from kirkstone to dunfell?

The curl versions in kirkstone and dunfell are different, so a direct cherry-pick of those patches may or may not work.

If you could test cherry-picking them and then submit the patches to the list (with your Signed-off-by added) I would be happy to take them :-)

Steve

#2 lore raw

PATCH 1/2 curl: Fix CVE CVE-2022-43552

https://curl.se/docs/CVE-2022-43552.html

---
 .../curl/curl/CVE-2022-43552.patch            | 79 +++++++++++++++++++
 meta/recipes-support/curl/curl_7.69.1.bb      |  1 +
 2 files changed, 80 insertions(+)
 create mode 100644 meta/recipes-support/curl/curl/CVE-2022-43552.patch
meta/recipes-support/curl/curl/CVE-2022-43552.patch new file +79 -0
new file mode 100644
index 0000000000..7dc7dfa5ae
@@ -0,0 +1,79 @@
+From 4f20188ac644afe174be6005ef4f6ffba232b8b2 Mon Sep 17 00:00:00 2001
+From: Daniel Stenberg <[email protected]>
+Date: Mon, 19 Dec 2022 08:38:37 +0100
+Subject: [PATCH] smb/telnet: do not free the protocol struct in *_done()
+
+It is managed by the generic layer.
+
+Reported-by: Trail of Bits
+
+Closes #10112
+
+CVE: CVE-2022-43552
+Upstream-Status: Backport [https://github.com/curl/curl/commit/4f20188ac644afe174be6005ef4f6ffba232b8b2]
+Signed-off-by: Ranjitsinh Rathod <[email protected]>
+Signed-off-by: Andrej Valek <[email protected]>
+
+---
+ lib/smb.c    | 14 ++------------
+ lib/telnet.c |  3 ---
+ 2 files changed, 2 insertions(+), 15 deletions(-)
+
+diff --git a/lib/smb.c b/lib/smb.c
+index 2cfe041dff072..48d5a2fe006d5 100644
+--- a/lib/smb.c
++++ b/lib/smb.c
+@@ -61,8 +61,6 @@ static CURLcode smb_connect(struct conne
+ static CURLcode smb_connection_state(struct connectdata *conn, bool *done);
+ static CURLcode smb_do(struct connectdata *conn, bool *done);
+ static CURLcode smb_request_state(struct connectdata *conn, bool *done);
+-static CURLcode smb_done(struct connectdata *conn, CURLcode status,
+-                         bool premature);
+ static CURLcode smb_disconnect(struct connectdata *conn, bool dead);
+ static int smb_getsock(struct connectdata *conn, curl_socket_t *socks);
+ static CURLcode smb_parse_url_path(struct connectdata *conn);
+@@ -74,7 +72,7 @@ const struct Curl_handler Curl_handler_s
+   "SMB",                                /* scheme */
+   smb_setup_connection,                 /* setup_connection */
+   smb_do,                               /* do_it */
+-  smb_done,                             /* done */
++  ZERO_NULL,                            /* done */
+   ZERO_NULL,                            /* do_more */
+   smb_connect,                          /* connect_it */
+   smb_connection_state,                 /* connecting */
+@@ -99,7 +97,7 @@ const struct Curl_handler Curl_handler_s
+   "SMBS",                               /* scheme */
+   smb_setup_connection,                 /* setup_connection */
+   smb_do,                               /* do_it */
+-  smb_done,                             /* done */
++  ZERO_NULL,                            /* done */
+   ZERO_NULL,                            /* do_more */
+   smb_connect,                          /* connect_it */
+   smb_connection_state,                 /* connecting */
+@@ -919,14 +917,6 @@ static CURLcode smb_request_state(struct
+   return CURLE_OK;
+ }
+ 
+-static CURLcode smb_done(struct connectdata *conn, CURLcode status,
+-                         bool premature)
+-{
+-  (void) premature;
+-  Curl_safefree(conn->data->req.protop);
+-  return status;
+-}
+-
+ static CURLcode smb_disconnect(struct connectdata *conn, bool dead)
+ {
+   struct smb_conn *smbc = &conn->proto.smbc;
+diff -Naurp curl-7.69.1.orig/lib/telnet.c curl-7.69.1/lib/telnet.c
+--- curl-7.69.1.orig/lib/telnet.c	2020-03-09 16:31:01.000000000 +0100
++++ curl-7.69.1/lib/telnet.c	2023-03-10 10:35:27.978378949 +0100
+@@ -1290,8 +1290,6 @@ static CURLcode telnet_done(struct conne
+   curl_slist_free_all(tn->telnet_vars);
+   tn->telnet_vars = NULL;
+ 
+-  Curl_safefree(conn->data->req.protop);
+-
+   return CURLE_OK;
+ }
+ 
\ No newline at end of file
meta/recipes-support/curl/curl_7.69.1.bb +1 -0
index 63faae6296..899daf8eac 100644
@@ -41,6 +41,7 @@ SRC_URI = "https://curl.haxx.se/download/curl-${PV}.tar.bz2 \
            file://CVE-2022-35252.patch \
            file://CVE-2022-32221.patch \
            file://CVE-2022-35260.patch \
+           file://CVE-2022-43552.patch \
 "
 
 SRC_URI[md5sum] = "ec5fc263f898a3dfef08e805f1ecca42"
Signature · 1 line
2.39.2
#3 lore raw

PATCH 2/2 curl: whitelists CVE-2022-42915, CVE-2022-42916 and CVE-2022-43551

All mentioned CVEs are related to HSTS check feature, which is not implemented in version 7.69.1 .

---
 meta/recipes-support/curl/curl_7.69.1.bb | 3 +++
 1 file changed, 3 insertions(+)
meta/recipes-support/curl/curl_7.69.1.bb +3 -0
index 899daf8eac..ea36c0bd3d 100644
@@ -56,6 +56,9 @@ CVE_CHECK_WHITELIST = "CVE-2021-22922 CVE-2021-22923 CVE-2021-22926 CVE-2021-229
 # This CVE issue affects Windows only Hence whitelisting this CVE
 CVE_CHECK_WHITELIST += "CVE-2021-22897"
 
+# HSTS check feature is not implemented
+CVE_CHECK_WHITELIST += "CVE-2022-42915 CVE-2022-42916 CVE-2022-43551"
+
 inherit autotools pkgconfig binconfig multilib_header
 
 PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} gnutls libidn proxy threaded-resolver verbose zlib"
Signature · 1 line
2.39.2
#4 lore raw

Re: [OE-core][dunfell][PATCH 2/2] curl: whitelists CVE-2022-42915, CVE-2022-42916 and CVE-2022-43551

Quoted 3 lines · Andrej Valek

All mentioned CVEs are related to HSTS check feature, which is not implemented in version 7.69.1 .

Is this due to an error in the CPE database? If so, perhaps the better approach would be to send a version correction request to [email protected]

Steve

Quoted 31 lines
---
 meta/recipes-support/curl/curl_7.69.1.bb | 3 +++
 1 file changed, 3 insertions(+)
meta/recipes-support/curl/curl_7.69.1.bb +3 -1
index 899daf8eac..ea36c0bd3d 100644
@@ -56,6 +56,9 @@ CVE_CHECK_WHITELIST = "CVE-2021-22922 CVE-2021-22923 CVE-2021-22926 CVE-2021-229
 # This CVE issue affects Windows only Hence whitelisting this CVE
 CVE_CHECK_WHITELIST += "CVE-2021-22897"
 
+# HSTS check feature is not implemented
+CVE_CHECK_WHITELIST += "CVE-2022-42915 CVE-2022-42916 CVE-2022-43551"
+
 inherit autotools pkgconfig binconfig multilib_header
 
 PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} gnutls libidn proxy threaded-resolver verbose zlib"
--

2.39.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#178321): https://lists.openembedded.org/g/openembedded-core/message/178321
Mute This Topic: https://lists.openembedded.org/mt/97516349/3620601
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

Re: [OE-core][dunfell][PATCH 2/2] curl: whitelists CVE-2022-42915, CVE-2022-42916 and CVE-2022-43551

Quoted 9 lines · Steve Sakoman via lists.openembedded.org
Quoted 3 lines · Andrej Valek

All mentioned CVEs are related to HSTS check feature, which is not implemented in version 7.69.1 .

Is this due to an error in the CPE database? If so, perhaps the better approach would be to send a version correction request to [email protected]

Hmmm . . . looking at the most recent dunfell CVE report I see that only CVE-2022-42916 is listed.

The CPE database indicates the issue is present for versions 7.57.0 onwards up to but not including 7.88.0

Steve

Quoted 34 lines
Quoted 20 lines
---
 meta/recipes-support/curl/curl_7.69.1.bb | 3 +++
 1 file changed, 3 insertions(+)
meta/recipes-support/curl/curl_7.69.1.bb +3 -1
index 899daf8eac..ea36c0bd3d 100644
@@ -56,6 +56,9 @@ CVE_CHECK_WHITELIST = "CVE-2021-22922 CVE-2021-22923 CVE-2021-22926 CVE-2021-229
 # This CVE issue affects Windows only Hence whitelisting this CVE
 CVE_CHECK_WHITELIST += "CVE-2021-22897"
 
+# HSTS check feature is not implemented
+CVE_CHECK_WHITELIST += "CVE-2022-42915 CVE-2022-42916 CVE-2022-43551"
+
 inherit autotools pkgconfig binconfig multilib_header
 
 PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} gnutls libidn proxy threaded-resolver verbose zlib"
--
Quoted 5 lines

2.39.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#178493): https://lists.openembedded.org/g/openembedded-core/message/178493
Mute This Topic: https://lists.openembedded.org/mt/97516349/3620601
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#7 lore raw

Re: [OE-core][dunfell][PATCH 2/2] curl: whitelists CVE-2022-42915, CVE-2022-42916 and CVE-2022-43551

Hello Steve,

Ok, looks like I received a wrong notification, sorry. So you can keep there only the 42916.
Basically all the HSTS check features are not implemented in the 7.69.1 version.

Regards,
Andrej

Quoted 66 lines · Steve Sakoman
Quoted 11 lines · Steve Sakoman via lists.openembedded.org
Quoted 4 lines · Andrej Valek

All mentioned CVEs are related to HSTS check feature, which is not
implemented in version 7.69.1 .

Is this due to an error in the CPE database?  If so, perhaps the better approach would be to send a version correction request to [email protected]

Hmmm . . . looking at the most recent dunfell CVE report I see that only CVE-2022-42916 is listed.

The CPE database indicates the issue is present for versions 7.57.0 onwards up to but not including 7.88.0

Steve

Quoted 42 lines
Quoted 22 lines

---
 meta/recipes-support/curl/curl_7.69.1.bb | 3 +++

 1 file changed, 3 insertions(+)
meta/recipes-support/curl/curl_7.69.1.bb +0 -0
index 899daf8eac..ea36c0bd3d 100644
@@ -56,6 +56,9 @@ CVE_CHECK_WHITELIST = "CVE-2021-22922 CVE-2021-

22923 CVE-2021-22926 CVE-2021-229
 # This CVE issue affects Windows only Hence whitelisting this CVE
 CVE_CHECK_WHITELIST += "CVE-2021-22897"

meta/recipes-support/curl/curl_7.69.1.bb +2 -0
+# HSTS check feature is not implemented
+CVE_CHECK_WHITELIST += "CVE-2022-42915 CVE-2022-42916 CVE-2022-

43551"
+
 inherit autotools pkgconfig binconfig multilib_header

Quoted 8 lines

 PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} gnutls libidn proxy threaded-resolver verbose zlib" --
2.39.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#178493):
https://lists.openembedded.org/g/openembedded-core/message/178493
Mute This Topic: https://lists.openembedded.org/mt/97516349/3620601
Group Owner: [email protected] Unsubscribe:
https://lists.openembedded.org/g/openembedded-core/unsub [
[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#8 lore raw

Re: [OE-core][dunfell][PATCH 2/2] curl: whitelists CVE-2022-42915, CVE-2022-42916 and CVE-2022-43551

Quoted 7 lines · Andrej

Hello Steve,

Ok, looks like I received a wrong notification, sorry. So you can keep there only the 42916.
Basically all the HSTS check features are not implemented in the 7.69.1 version.

I still have the same comment on how we should handle this issue:

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Is this due to an error in the CPE database? If so, perhaps the better approach would be to send a version correction request to [email protected]

Steve

Quoted 43 lines
Quoted 42 lines
Quoted 42 lines
Quoted 22 lines
---
 meta/recipes-support/curl/curl_7.69.1.bb | 3 +++
 1 file changed, 3 insertions(+)
meta/recipes-support/curl/curl_7.69.1.bb +0 -0
index 899daf8eac..ea36c0bd3d 100644
@@ -56,6 +56,9 @@ CVE_CHECK_WHITELIST = "CVE-2021-22922 CVE-2021-

22923 CVE-2021-22926 CVE-2021-229
# This CVE issue affects Windows only Hence whitelisting this
CVE
CVE_CHECK_WHITELIST += "CVE-2021-22897"

meta/recipes-support/curl/curl_7.69.1.bb +2 -0
+# HSTS check feature is not implemented
+CVE_CHECK_WHITELIST += "CVE-2022-42915 CVE-2022-42916 CVE-2022-

43551"
+
inherit autotools pkgconfig binconfig multilib_header

Quoted 8 lines

PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6',
d)} gnutls libidn proxy threaded-resolver verbose zlib" --
2.39.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#178493):
https://lists.openembedded.org/g/openembedded-core/message/178493
Mute This Topic: https://lists.openembedded.org/mt/97516349/3620601
Group Owner: [email protected] Unsubscribe:
https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#9 lore raw

PATCH 1/1 curl: Fix CVE CVE-2021-22897

In reply to Steve Sakoman

https://curl.se/docs/CVE-2021-22897.html

---
 .../curl/curl/CVE-2021-22897.patch            | 73 +++++++++++++++++++
 meta/recipes-support/curl/curl_7.69.1.bb      |  1 +
 2 files changed, 74 insertions(+)
 create mode 100644 meta/recipes-support/curl/curl/CVE-2021-22897.patch
meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +73 -0
new file mode 100644
index 0000000000..cbd6c067ce
@@ -0,0 +1,73 @@
+From bbb71507b7bab52002f9b1e0880bed6a32834511 Mon Sep 17 00:00:00 2001
+From: Daniel Stenberg <[email protected]>
+Date: Fri, 23 Apr 2021 10:54:10 +0200
+Subject: [PATCH] schannel: don't use static to store selected ciphers
+
+CVE-2021-22897
+
+Bug: https://curl.se/docs/CVE-2021-22897.html
+
+Upstream-Status: Backport
+[https://github.com/curl/curl/commit/bbb71507b7bab52002f9b1e0880bed6a32834511]
+
+CVE: CVE-2021-22897
+
+Signed-off-by: Daniel Stenberg <[email protected]>
+Signed-off-by: Khairul Rohaizzat Jamaluddin <[email protected]>
+Signed-off-by: Andrej Valek <[email protected]>
+---
+ lib/vtls/schannel.c | 9 +++++----
+ lib/vtls/schannel.h | 3 +++
+ 2 files changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c
+index 8c25ac5dd5a5..dba7072273a9 100644
+--- a/lib/vtls/schannel.c
++++ b/lib/vtls/schannel.c
+@@ -322,12 +322,12 @@ get_alg_id_by_name(char *name)
+ }
+ 
+ static CURLcode
+-set_ssl_ciphers(SCHANNEL_CRED *schannel_cred, char *ciphers)
++set_ssl_ciphers(SCHANNEL_CRED *schannel_cred, char *ciphers,
++                int *algIds)
+ {
+   char *startCur = ciphers;
+   int algCount = 0;
+-  static ALG_ID algIds[45]; /*There are 45 listed in the MS headers*/
+-  while(startCur && (0 != *startCur) && (algCount < 45)) {
++  while(startCur && (0 != *startCur) && (algCount < NUMOF_CIPHERS)) {
+     long alg = strtol(startCur, 0, 0);
+     if(!alg)
+       alg = get_alg_id_by_name(startCur);
+@@ -566,7 +566,8 @@ schannel_connect_step1(struct connectdat
+     }
+ 
+     if(SSL_CONN_CONFIG(cipher_list)) {
+-      result = set_ssl_ciphers(&schannel_cred, SSL_CONN_CONFIG(cipher_list));
++      result = set_ssl_ciphers(&schannel_cred, SSL_CONN_CONFIG(cipher_list),
++                               BACKEND->algIds);
+       if(CURLE_OK != result) {
+         failf(data, "Unable to set ciphers to passed via SSL_CONN_CONFIG");
+         return result;
+diff --git a/lib/vtls/schannel.h b/lib/vtls/schannel.h
+index 2952caa1a5a1..77853aa30f96 100644
+--- a/lib/vtls/schannel.h
++++ b/lib/vtls/schannel.h
+@@ -70,6 +70,8 @@ CURLcode Curl_verify_certificate(struct
+ #endif
+ #endif
+ 
++#define NUMOF_CIPHERS 45 /* There are 45 listed in the MS headers */
++
+ struct curl_schannel_cred {
+   CredHandle cred_handle;
+   TimeStamp time_stamp;
+@@ -101,6 +103,7 @@ struct ssl_backend_data {
+ #ifdef HAS_MANUAL_VERIFY_API
+   bool use_manual_cred_validation; /* true if manual cred validation is used */
+ #endif
++  ALG_ID algIds[NUMOF_CIPHERS];
+ };
+ #endif /* EXPOSE_SCHANNEL_INTERNAL_STRUCTS */
+ 
meta/recipes-support/curl/curl_7.69.1.bb +1 -0
index ea36c0bd3d..384719dd15 100644
@@ -19,6 +19,7 @@ SRC_URI = "https://curl.haxx.se/download/curl-${PV}.tar.bz2 \
            file://CVE-2020-8286.patch \
            file://CVE-2021-22876.patch \
            file://CVE-2021-22890.patch \
+           file://CVE-2021-22897.patch \
            file://CVE-2021-22898.patch \
            file://CVE-2021-22924.patch \
            file://CVE-2021-22925.patch \
Signature · 1 line
2.39.2
#10 lore raw

Re: [OE-core][dunfell][PATCH] curl: Fix CVE CVE-2021-22897

Hello again,

Looks like that this patch showed some isses/open points:
- CVE-2021-22897 is white-listed already, but in hardknott is fixed already
https://github.com/openembedded/openembedded-core/blob/hardknott/meta/recipes-support/curl/curl/CVE-2021-22897.patch
- So do we have to ignore the patch, or apply and remove the
whitelist, or remove patch from hardknott?
- Https certificate at yocto.io has been expired ;)

Regards,
Andrej

Quoted 117 lines · Andrej Valek

https://curl.se/docs/CVE-2021-22897.html

---
 .../curl/curl/CVE-2021-22897.patch            | 73
+++++++++++++++++++
 meta/recipes-support/curl/curl_7.69.1.bb      |  1 +

 2 files changed, 74 insertions(+)

 create mode 100644 meta/recipes-support/curl/curl/CVE-2021- 22897.patch

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +1 -0
new file mode 100644
index 0000000000..cbd6c067ce
@@ -0,0 +1,73 @@
+From bbb71507b7bab52002f9b1e0880bed6a32834511 Mon Sep 17 00:00:00

2001

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +3 -0
+From: Daniel Stenberg <[email protected]>
+Date: Fri, 23 Apr 2021 10:54:10 +0200
+Subject: [PATCH] schannel: don't use static to store selected

ciphers

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +7 -0
+
+CVE-2021-22897
+
+Bug: https://curl.se/docs/CVE-2021-22897.html
+
+Upstream-Status: Backport
+[

https://github.com/curl/curl/commit/bbb71507b7bab52002f9b1e0880bed6a3
2834511]

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +5 -0
+
+CVE: CVE-2021-22897
+
+Signed-off-by: Daniel Stenberg <[email protected]>
+Signed-off-by: Khairul Rohaizzat Jamaluddin

<[email protected]>

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +21 -0
+Signed-off-by: Andrej Valek <[email protected]>
+---
+ lib/vtls/schannel.c | 9 +++++----
+ lib/vtls/schannel.h | 3 +++
+ 2 files changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c
+index 8c25ac5dd5a5..dba7072273a9 100644
+--- a/lib/vtls/schannel.c
++++ b/lib/vtls/schannel.c
+@@ -322,12 +322,12 @@ get_alg_id_by_name(char *name)
+ }
+ 
+ static CURLcode
+-set_ssl_ciphers(SCHANNEL_CRED *schannel_cred, char *ciphers)
++set_ssl_ciphers(SCHANNEL_CRED *schannel_cred, char *ciphers,
++                int *algIds)
+ {
+   char *startCur = ciphers;
+   int algCount = 0;
+-  static ALG_ID algIds[45]; /*There are 45 listed in the MS

headers*/
+-  while(startCur && (0 != *startCur) && (algCount < 45)) { ++  while(startCur && (0 != *startCur) && (algCount < NUMOF_CIPHERS)) {
+     long alg = strtol(startCur, 0, 0);
+     if(!alg)
+       alg = get_alg_id_by_name(startCur);
+@@ -566,7 +566,8 @@ schannel_connect_step1(struct connectdat +     }
+
+     if(SSL_CONN_CONFIG(cipher_list)) {
+-      result = set_ssl_ciphers(&schannel_cred, SSL_CONN_CONFIG(cipher_list));
++      result = set_ssl_ciphers(&schannel_cred, SSL_CONN_CONFIG(cipher_list),
++                               BACKEND->algIds);
+       if(CURLE_OK != result) {
+         failf(data, "Unable to set ciphers to passed via SSL_CONN_CONFIG");
+         return result;

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +9 -0
+diff --git a/lib/vtls/schannel.h b/lib/vtls/schannel.h
+index 2952caa1a5a1..77853aa30f96 100644
+--- a/lib/vtls/schannel.h
++++ b/lib/vtls/schannel.h
+@@ -70,6 +70,8 @@ CURLcode Curl_verify_certificate(struct
+ #endif
+ #endif
+ 
++#define NUMOF_CIPHERS 45 /* There are 45 listed in the MS headers

*/
++
+ struct curl_schannel_cred {
+   CredHandle cred_handle;
+   TimeStamp time_stamp;
+@@ -101,6 +103,7 @@ struct ssl_backend_data {
+ #ifdef HAS_MANUAL_VERIFY_API
+   bool use_manual_cred_validation; /* true if manual cred validation is used */
+ #endif
++  ALG_ID algIds[NUMOF_CIPHERS];
+ };
+ #endif /* EXPOSE_SCHANNEL_INTERNAL_STRUCTS */
+

meta/recipes- renamed from meta/recipes-support/curl/curl_7.69.1.bb +0 -0

support/curl/curl_7.69.1.bb
index ea36c0bd3d..384719dd15 100644

meta/recipes-support/curl/curl_7.69.1.bb +1 -0
@@ -19,6 +19,7 @@ SRC_URI =
 "https://curl.haxx.se/download/curl-${PV}.tar.bz2 \
             file://CVE-2020-8286.patch \
             file://CVE-2021-22876.patch \
             file://CVE-2021-22890.patch \
+           file://CVE-2021-22897.patch \
             file://CVE-2021-22898.patch \
             file://CVE-2021-22924.patch \

            file://CVE-2021-22925.patch \

#11 lore raw

Re: [OE-core][dunfell][PATCH] curl: Fix CVE CVE-2021-22897

Quoted 9 lines · Andrej

Hello again,

Looks like that this patch showed some isses/open points:
- CVE-2021-22897 is white-listed already, but in hardknott is fixed already
https://github.com/openembedded/openembedded-core/blob/hardknott/meta/recipes-support/curl/curl/CVE-2021-22897.patch
- So do we have to ignore the patch, or apply and remove the
whitelist, or remove patch from hardknott?

Hardknott is no longer being maintained, so nothing needs to be done there.

Since this is a Windows only bug ("It can only trigger when Schannel is used, which is the native TLS library in Microsoft Windows") I think the existing whitelist is fine and we don't need this additional patch.

Quoted 1 line

- Https certificate at yocto.io has been expired ;)

Can you give me the url which is giving the expired certificate error?

Thanks!

Steve

Quoted 122 lines

Regards,
Andrej

Quoted 117 lines · Andrej Valek

https://curl.se/docs/CVE-2021-22897.html

---
 .../curl/curl/CVE-2021-22897.patch            | 73
+++++++++++++++++++
 meta/recipes-support/curl/curl_7.69.1.bb      |  1 +
 2 files changed, 74 insertions(+)
 create mode 100644 meta/recipes-support/curl/curl/CVE-2021-

22897.patch

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +1 -0
new file mode 100644
index 0000000000..cbd6c067ce
@@ -0,0 +1,73 @@
+From bbb71507b7bab52002f9b1e0880bed6a32834511 Mon Sep 17 00:00:00

2001

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +3 -0
+From: Daniel Stenberg <[email protected]>
+Date: Fri, 23 Apr 2021 10:54:10 +0200
+Subject: [PATCH] schannel: don't use static to store selected

ciphers

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +7 -0
+
+CVE-2021-22897
+
+Bug: https://curl.se/docs/CVE-2021-22897.html
+
+Upstream-Status: Backport
+[

https://github.com/curl/curl/commit/bbb71507b7bab52002f9b1e0880bed6a3
2834511]

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +5 -0
+
+CVE: CVE-2021-22897
+
+Signed-off-by: Daniel Stenberg <[email protected]>
+Signed-off-by: Khairul Rohaizzat Jamaluddin

<[email protected]>

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +21 -0
+Signed-off-by: Andrej Valek <[email protected]>
+---
+ lib/vtls/schannel.c | 9 +++++----
+ lib/vtls/schannel.h | 3 +++
+ 2 files changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c
+index 8c25ac5dd5a5..dba7072273a9 100644
+--- a/lib/vtls/schannel.c
++++ b/lib/vtls/schannel.c
+@@ -322,12 +322,12 @@ get_alg_id_by_name(char *name)
+ }
+
+ static CURLcode
+-set_ssl_ciphers(SCHANNEL_CRED *schannel_cred, char *ciphers)
++set_ssl_ciphers(SCHANNEL_CRED *schannel_cred, char *ciphers,
++                int *algIds)
+ {
+   char *startCur = ciphers;
+   int algCount = 0;
+-  static ALG_ID algIds[45]; /*There are 45 listed in the MS

headers*/

+-  while(startCur && (0 != *startCur) && (algCount < 45)) {
++  while(startCur && (0 != *startCur) && (algCount < NUMOF_CIPHERS))

{

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +8 -0
+     long alg = strtol(startCur, 0, 0);
+     if(!alg)
+       alg = get_alg_id_by_name(startCur);
+@@ -566,7 +566,8 @@ schannel_connect_step1(struct connectdat
+     }
+
+     if(SSL_CONN_CONFIG(cipher_list)) {
+-      result = set_ssl_ciphers(&schannel_cred,

SSL_CONN_CONFIG(cipher_list));
++ result = set_ssl_ciphers(&schannel_cred,
SSL_CONN_CONFIG(cipher_list),
++ BACKEND->algIds);

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +2 -0
+       if(CURLE_OK != result) {
+         failf(data, "Unable to set ciphers to passed via

SSL_CONN_CONFIG");

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +10 -0
+         return result;
+diff --git a/lib/vtls/schannel.h b/lib/vtls/schannel.h
+index 2952caa1a5a1..77853aa30f96 100644
+--- a/lib/vtls/schannel.h
++++ b/lib/vtls/schannel.h
+@@ -70,6 +70,8 @@ CURLcode Curl_verify_certificate(struct
+ #endif
+ #endif
+
++#define NUMOF_CIPHERS 45 /* There are 45 listed in the MS headers

*/
++
+ struct curl_schannel_cred {

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +5 -0
+   CredHandle cred_handle;
+   TimeStamp time_stamp;
+@@ -101,6 +103,7 @@ struct ssl_backend_data {
+ #ifdef HAS_MANUAL_VERIFY_API
+   bool use_manual_cred_validation; /* true if manual cred

validation is used */
+ #endif
++ ALG_ID algIds[NUMOF_CIPHERS];
+ };
+ #endif /* EXPOSE_SCHANNEL_INTERNAL_STRUCTS */

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +1 -0
+
meta/recipes- renamed from meta/recipes-support/curl/curl_7.69.1.bb +0 -0

support/curl/curl_7.69.1.bb
index ea36c0bd3d..384719dd15 100644

meta/recipes-support/curl/curl_7.69.1.bb +1 -0
@@ -19,6 +19,7 @@ SRC_URI =
 "https://curl.haxx.se/download/curl-${PV}.tar.bz2 \
            file://CVE-2020-8286.patch \
            file://CVE-2021-22876.patch \
            file://CVE-2021-22890.patch \
+           file://CVE-2021-22897.patch \
            file://CVE-2021-22898.patch \
            file://CVE-2021-22924.patch \
            file://CVE-2021-22925.patch \
#12 lore raw

Re: [OE-core][dunfell][PATCH] curl: Fix CVE CVE-2021-22897

Hello Steve,

- patch
- I'm fine with explanation
- Cert error
- for example here:
https://autobuilder.yocto.io/pub/non-release/patchmetrics/cve-status-dunfell.txt

Regards,
Andrej

Quoted 156 lines · Steve Sakoman
Quoted 9 lines · Andrej

Hello again,

Looks like that this patch showed some isses/open points:
- CVE-2021-22897 is white-listed already, but in hardknott is fixed already
https://github.com/openembedded/openembedded-core/blob/hardknott/meta/recipes-support/curl/curl/CVE-2021-22897.patch
 - So do we have to ignore the patch, or apply and remove the whitelist, or remove patch from hardknott?

Hardknott is no longer being maintained, so nothing needs to be done there.

Since this is a Windows only bug ("It can only trigger when Schannel is used, which is the native TLS library in Microsoft Windows") I think the existing whitelist is fine and we don't need this additional
patch.

Quoted 1 line

- Https certificate at yocto.io has been expired ;)

Can you give me the url which is giving the expired certificate error?

Thanks!

Steve

Quoted 126 lines

Regards,
Andrej

Quoted 121 lines · Andrej Valek

https://curl.se/docs/CVE-2021-22897.html

---
 .../curl/curl/CVE-2021-22897.patch            | 73
+++++++++++++++++++
 meta/recipes-support/curl/curl_7.69.1.bb      |  1 +

 2 files changed, 74 insertions(+)

 create mode 100644 meta/recipes-support/curl/curl/CVE-2021- 22897.patch

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +1 -0
new file mode 100644
index 0000000000..cbd6c067ce
@@ -0,0 +1,73 @@
+From bbb71507b7bab52002f9b1e0880bed6a32834511 Mon Sep 17

00:00:00
2001

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +3 -0
+From: Daniel Stenberg <[email protected]>
+Date: Fri, 23 Apr 2021 10:54:10 +0200
+Subject: [PATCH] schannel: don't use static to store selected

ciphers

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +7 -0
+
+CVE-2021-22897
+
+Bug: https://curl.se/docs/CVE-2021-22897.html
+
+Upstream-Status: Backport
+[

https://github.com/curl/curl/commit/bbb71507b7bab52002f9b1e0880bed6a3
2834511]

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +5 -0
+
+CVE: CVE-2021-22897
+
+Signed-off-by: Daniel Stenberg <[email protected]>
+Signed-off-by: Khairul Rohaizzat Jamaluddin

<[email protected]>

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +21 -0
+Signed-off-by: Andrej Valek <[email protected]>
+---
+ lib/vtls/schannel.c | 9 +++++----
+ lib/vtls/schannel.h | 3 +++
+ 2 files changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c
+index 8c25ac5dd5a5..dba7072273a9 100644
+--- a/lib/vtls/schannel.c
++++ b/lib/vtls/schannel.c
+@@ -322,12 +322,12 @@ get_alg_id_by_name(char *name)
+ }
+
+ static CURLcode
+-set_ssl_ciphers(SCHANNEL_CRED *schannel_cred, char *ciphers)
++set_ssl_ciphers(SCHANNEL_CRED *schannel_cred, char *ciphers,
++                int *algIds)
+ {
+   char *startCur = ciphers;
+   int algCount = 0;
+-  static ALG_ID algIds[45]; /*There are 45 listed in the MS

headers*/
+-  while(startCur && (0 != *startCur) && (algCount < 45)) { ++  while(startCur && (0 != *startCur) && (algCount < NUMOF_CIPHERS))
{
+     long alg = strtol(startCur, 0, 0);
+     if(!alg)
+       alg = get_alg_id_by_name(startCur);
+@@ -566,7 +566,8 @@ schannel_connect_step1(struct connectdat +     }
+
+     if(SSL_CONN_CONFIG(cipher_list)) {
+-      result = set_ssl_ciphers(&schannel_cred, SSL_CONN_CONFIG(cipher_list));
++      result = set_ssl_ciphers(&schannel_cred, SSL_CONN_CONFIG(cipher_list),
++                               BACKEND->algIds); +       if(CURLE_OK != result) {
+         failf(data, "Unable to set ciphers to passed via SSL_CONN_CONFIG");
+         return result;

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +9 -0
+diff --git a/lib/vtls/schannel.h b/lib/vtls/schannel.h
+index 2952caa1a5a1..77853aa30f96 100644
+--- a/lib/vtls/schannel.h
++++ b/lib/vtls/schannel.h
+@@ -70,6 +70,8 @@ CURLcode Curl_verify_certificate(struct
+ #endif
+ #endif
+
++#define NUMOF_CIPHERS 45 /* There are 45 listed in the MS

headers
*/
++
+ struct curl_schannel_cred {
+   CredHandle cred_handle;
+   TimeStamp time_stamp;
+@@ -101,6 +103,7 @@ struct ssl_backend_data {
+ #ifdef HAS_MANUAL_VERIFY_API
+   bool use_manual_cred_validation; /* true if manual cred validation is used */
+ #endif
++  ALG_ID algIds[NUMOF_CIPHERS];
+ };
+ #endif /* EXPOSE_SCHANNEL_INTERNAL_STRUCTS */

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +1 -0
+
meta/recipes- renamed from meta/recipes-support/curl/curl_7.69.1.bb +0 -0

support/curl/curl_7.69.1.bb
index ea36c0bd3d..384719dd15 100644

meta/recipes-support/curl/curl_7.69.1.bb +1 -0
@@ -19,6 +19,7 @@ SRC_URI =
 "https://curl.haxx.se/download/curl-${PV}.tar.bz2 \
             file://CVE-2020-8286.patch \
             file://CVE-2021-22876.patch \
             file://CVE-2021-22890.patch \
+           file://CVE-2021-22897.patch \
             file://CVE-2021-22898.patch \
             file://CVE-2021-22924.patch \

            file://CVE-2021-22925.patch \

#13 lore raw

Re: [OE-core][dunfell][PATCH] curl: Fix CVE CVE-2021-22897

Quoted 8 lines · Andrej

Hello Steve,

- patch
- I'm fine with explanation
- Cert error
- for example here:
https://autobuilder.yocto.io/pub/non-release/patchmetrics/cve-status-dunfell.txt

Thanks, I opened a ticket with the infrastructure support team.

Steve

Quoted 158 lines · Steve Sakoman
Quoted 156 lines
Quoted 9 lines · Andrej

Hello again,

Looks like that this patch showed some isses/open points:
- CVE-2021-22897 is white-listed already, but in hardknott is fixed already
https://github.com/openembedded/openembedded-core/blob/hardknott/meta/recipes-support/curl/curl/CVE-2021-22897.patch
- So do we have to ignore the patch, or apply and remove the
whitelist, or remove patch from hardknott?

Hardknott is no longer being maintained, so nothing needs to be done there.

Since this is a Windows only bug ("It can only trigger when Schannel is used, which is the native TLS library in Microsoft Windows") I think the existing whitelist is fine and we don't need this additional
patch.

Quoted 1 line

- Https certificate at yocto.io has been expired ;)

Can you give me the url which is giving the expired certificate error?

Thanks!

Steve

Quoted 126 lines

Regards,
Andrej

Quoted 121 lines · Andrej Valek

https://curl.se/docs/CVE-2021-22897.html

---
 .../curl/curl/CVE-2021-22897.patch            | 73
+++++++++++++++++++
 meta/recipes-support/curl/curl_7.69.1.bb      |  1 +
 2 files changed, 74 insertions(+)
 create mode 100644 meta/recipes-support/curl/curl/CVE-2021-

22897.patch

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +1 -0
new file mode 100644
index 0000000000..cbd6c067ce
@@ -0,0 +1,73 @@
+From bbb71507b7bab52002f9b1e0880bed6a32834511 Mon Sep 17

00:00:00
2001

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +3 -0
+From: Daniel Stenberg <[email protected]>
+Date: Fri, 23 Apr 2021 10:54:10 +0200
+Subject: [PATCH] schannel: don't use static to store selected

ciphers

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +7 -0
+
+CVE-2021-22897
+
+Bug: https://curl.se/docs/CVE-2021-22897.html
+
+Upstream-Status: Backport
+[

https://github.com/curl/curl/commit/bbb71507b7bab52002f9b1e0880bed6a3
2834511]

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +5 -0
+
+CVE: CVE-2021-22897
+
+Signed-off-by: Daniel Stenberg <[email protected]>
+Signed-off-by: Khairul Rohaizzat Jamaluddin

<[email protected]>

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +21 -0
+Signed-off-by: Andrej Valek <[email protected]>
+---
+ lib/vtls/schannel.c | 9 +++++----
+ lib/vtls/schannel.h | 3 +++
+ 2 files changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c
+index 8c25ac5dd5a5..dba7072273a9 100644
+--- a/lib/vtls/schannel.c
++++ b/lib/vtls/schannel.c
+@@ -322,12 +322,12 @@ get_alg_id_by_name(char *name)
+ }
+
+ static CURLcode
+-set_ssl_ciphers(SCHANNEL_CRED *schannel_cred, char *ciphers)
++set_ssl_ciphers(SCHANNEL_CRED *schannel_cred, char *ciphers,
++                int *algIds)
+ {
+   char *startCur = ciphers;
+   int algCount = 0;
+-  static ALG_ID algIds[45]; /*There are 45 listed in the MS

headers*/

+-  while(startCur && (0 != *startCur) && (algCount < 45)) {
++  while(startCur && (0 != *startCur) && (algCount <

NUMOF_CIPHERS))
{

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +8 -0
+     long alg = strtol(startCur, 0, 0);
+     if(!alg)
+       alg = get_alg_id_by_name(startCur);
+@@ -566,7 +566,8 @@ schannel_connect_step1(struct connectdat
+     }
+
+     if(SSL_CONN_CONFIG(cipher_list)) {
+-      result = set_ssl_ciphers(&schannel_cred,

SSL_CONN_CONFIG(cipher_list));
++ result = set_ssl_ciphers(&schannel_cred,
SSL_CONN_CONFIG(cipher_list),
++ BACKEND->algIds);

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +2 -0
+       if(CURLE_OK != result) {
+         failf(data, "Unable to set ciphers to passed via

SSL_CONN_CONFIG");

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +10 -0
+         return result;
+diff --git a/lib/vtls/schannel.h b/lib/vtls/schannel.h
+index 2952caa1a5a1..77853aa30f96 100644
+--- a/lib/vtls/schannel.h
++++ b/lib/vtls/schannel.h
+@@ -70,6 +70,8 @@ CURLcode Curl_verify_certificate(struct
+ #endif
+ #endif
+
++#define NUMOF_CIPHERS 45 /* There are 45 listed in the MS

headers
*/
++
+ struct curl_schannel_cred {

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +5 -0
+   CredHandle cred_handle;
+   TimeStamp time_stamp;
+@@ -101,6 +103,7 @@ struct ssl_backend_data {
+ #ifdef HAS_MANUAL_VERIFY_API
+   bool use_manual_cred_validation; /* true if manual cred

validation is used */
+ #endif
++ ALG_ID algIds[NUMOF_CIPHERS];
+ };
+ #endif /* EXPOSE_SCHANNEL_INTERNAL_STRUCTS */

meta/recipes-support/curl/curl/CVE-2021-22897.patch new file +1 -0
+
meta/recipes- renamed from meta/recipes-support/curl/curl_7.69.1.bb +0 -0

support/curl/curl_7.69.1.bb
index ea36c0bd3d..384719dd15 100644

meta/recipes-support/curl/curl_7.69.1.bb +1 -0
@@ -19,6 +19,7 @@ SRC_URI =
 "https://curl.haxx.se/download/curl-${PV}.tar.bz2 \
            file://CVE-2020-8286.patch \
            file://CVE-2021-22876.patch \
            file://CVE-2021-22890.patch \
+           file://CVE-2021-22897.patch \
            file://CVE-2021-22898.patch \
            file://CVE-2021-22924.patch \
            file://CVE-2021-22925.patch \