Skip to contentSkip to conversation

curl: Add fix for CVE-2022-27781 CVE-2022-27782

PATCH Superseded [email protected] 3 participants 4 messages May 23, 2022 – May 30, 2022 1 message not in the archive

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 curl: Add fix for CVE-2022-27781 CVE-2022-27782

Add patches for CVE issues: CVE-2022-27781 CVE-2022-27782

CVE-2022-27781

CVE-2022-27782

---
 .../curl/curl/CVE-2022-27781.patch            | 50 +++++++++++++
 .../curl/curl/CVE-2022-27782.patch            | 75 +++++++++++++++++++
 meta/recipes-support/curl/curl_7.69.1.bb      |  2 +
 3 files changed, 127 insertions(+)
 create mode 100644 meta/recipes-support/curl/curl/CVE-2022-27781.patch
 create mode 100644 meta/recipes-support/curl/curl/CVE-2022-27782.patch
meta/recipes-support/curl/curl/CVE-2022-27781.patch new file +50 -0
new file mode 100644
index 0000000000..70e75ead4f
@@ -0,0 +1,50 @@
+From 5c7da89d404bf59c8dd82a001119a16d18365917 Mon Sep 17 00:00:00 2001
+From: Daniel Stenberg <[email protected]>
+Date: Mon, 9 May 2022 10:07:15 +0200
+Subject: [PATCH] nss: return error if seemingly stuck in a cert loop
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+CVE-2022-27781
+
+Reported-by: Florian Kohnhäuser
+Bug: https://curl.se/docs/CVE-2022-27781.html
+Closes #8822
+
+CVE: CVE-2022-27781
+
+Upstream-Status: Backport [https://github.com/curl/curl/commit/5c7da89d404bf59c8dd82a001119a16d18365917]
+
+Signed-off-by: Riyaz Ahmed Khan <[email protected]>
+
+---
+ lib/vtls/nss.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c
+index 5b7de9f81895..569c0628feb5 100644
+--- a/lib/vtls/nss.c
++++ b/lib/vtls/nss.c
+@@ -950,6 +950,9 @@
+   PR_Free(common_name);
+ }
+
++/* A number of certs that will never occur in a real server handshake */
++#define TOO_MANY_CERTS 300
++
+ static CURLcode display_conn_info(struct connectdata *conn, PRFileDesc *sock)
+ {
+   CURLcode result = CURLE_OK;
+@@ -1018,6 +1021,11 @@ static CURLcode display_conn_info(struct Curl_easy *data, PRFileDesc *sock)
+         cert2 = CERT_FindCertIssuer(cert, now, certUsageSSLCA);
+         while(cert2) {
+           i++;
++          if(i >= TOO_MANY_CERTS) {
++            CERT_DestroyCertificate(cert2);
++            failf(data, "certificate loop");
++            return CURLE_SSL_CERTPROBLEM;
++          }
+           if(cert2->isRoot) {
+             CERT_DestroyCertificate(cert2);
+             break;
meta/recipes-support/curl/curl/CVE-2022-27782.patch new file +75 -0

75 lines not on this page · raw message

meta/recipes-support/curl/curl_7.69.1.bb +2 -0
index e850376ff8..602caf97ab 100644
@@ -28,6 +28,8 @@ SRC_URI = "https://curl.haxx.se/download/curl-${PV}.tar.bz2 \
            file://CVE-2022-27776.patch \
            file://CVE-2022-27775.patch \
            file://CVE-2022-22576.patch \
+           file://CVE-2022-27781.patch \
+           file://CVE-2022-27782.patch \
 "
 
 SRC_URI[md5sum] = "ec5fc263f898a3dfef08e805f1ecca42"
Signature · 1 line
2.17.1
#1 lore raw

Hi Riyaz,

You have used the wrong label meta-oe while sending this patch.

Steve, Can you please take this or do you want us to send it again?

Thanks,
Ranjitsinh Rathod

#2 lore raw
Quoted 4 lines · Ranjitsinh Rathod

Hi Riyaz,

You have used the wrong label meta-oe while sending this patch.

Indeed, I missed it due to the wrong tag!

Quoted 1 line

Steve, Can you please take this or do you want us to send it again?

I've got it now, no need to resend.

Thank you,

Steve

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

#4 lore raw
Quoted 6 lines · Steve Sakoman via lists.openembedded.org
Quoted 3 lines · Ranjitsinh Rathod

Hi Riyaz,

Quoted 7 lines
Quoted 1 line

You have used the wrong label meta-oe while sending this patch.

Indeed, I missed it due to the wrong tag!

Quoted 1 line

Steve, Can you please take this or do you want us to send it again?

I've got it now, no need to resend.

Actually you will need to refresh the patch so that it will apply cleanly. It is generating warning on the autobuilder:

stdio: WARNING: curl-7.69.1-r0 do_patch: Fuzz detected:
stdio: WARNING: curl-7.69.1-r0 do_patch: QA Issue: Patch log indicates that patches do not apply cleanly. [patch-fuzz]

Steve