Skip to contentSkip to conversation

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

PATCH Superseded Riyaz Ahmed Khan 1 participant 1 message Jun 1, 2022

lore
Share & tools
lore
#0 lore raw

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

From: Riyaz Khan <[email protected]>

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

CVE-2022-27781

CVE-2022-27782

Change-Id I6ebe14ff8caf809f8332bb785b159090f5046896
---
 .../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..83cdd1290f
@@ -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
+@@ -983,6 +983,9 @@ static void display_cert_info(struct Curl_easy *data,
+   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 Curl_easy *data, 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