Skip to contentSkip to conversation

curl: fix CVE-2026-8927, CVE-2026-8932, CVE-2026-6429 and CVE-2026-7168

PATCH New Devansh Patel -X (devanshp - E INFOCHIPS PRIVATE LIMITED at Cisco) 1 participant 5 messages Nov 20

lore
Share & tools
lore
#0 lore raw

cover curl: fix CVE-2026-8927, CVE-2026-8932, CVE-2026-6429 and CVE-2026-7168

From: Devansh Patel <[email protected]>

This series was developed against the latest OE-Core contrib stable/scarthgap-review branch.

This series backports fixes for CVE-2026-8927, CVE-2026-8932, CVE-2026-6429 and CVE-2026-7168 to Scarthgap curl 8.7.1.

The fixes clear Digest state when an environment proxy changes, include mTLS credentials in connection and session reuse checks, clear redirect credentials and Digest state across origins, compare IPv6 zone IDs, and reset proxy authentication when CURLOPT_PROXY changes.

Changes in v3:
- Omit the adapted test additions and minimize differences from upstream.
- Renumber the four curl patches as 1/4 through 4/4.
- Refresh recipe hunks against stable/scarthgap-review.
- Add cross-origin Digest cleanup from upstream 6daf4bc7.
- Compare IPv6 zone IDs in the origin helper using upstream edfc80c7.
- Fold only the required helper prerequisite into CVE-2026-6429_p1.patch.
- Document target API/header adaptations and omitted test files.

Upstream tests are omitted from the submitted backports. The embedded patches document omissions and adaptations in Backport Changes and preserve the original upstream commit messages and public provenance.

Devansh Patel (4):
curl: Fix CVE-2026-8927
curl: Fix CVE-2026-8932
curl: Fix CVE-2026-6429
curl: Fix CVE-2026-7168

 .../curl/curl/CVE-2026-6429_p1.patch          | 205 ++++++++++++++++++
 .../curl/curl/CVE-2026-6429_p2.patch          |  52 +++++
 .../curl/curl/CVE-2026-6429_p3.patch          |  29 +++
 .../curl/curl/CVE-2026-7168.patch             |  83 +++++++
 .../curl/curl/CVE-2026-8927.patch             |  87 ++++++++
 .../curl/curl/CVE-2026-8932.patch             | 170 +++++++++++++++
 meta/recipes-support/curl/curl_8.7.1.bb       |   6 +
 7 files changed, 632 insertions(+)
 create mode 100644 meta/recipes-support/curl/curl/CVE-2026-6429_p1.patch
 create mode 100644 meta/recipes-support/curl/curl/CVE-2026-6429_p2.patch
 create mode 100644 meta/recipes-support/curl/curl/CVE-2026-6429_p3.patch
 create mode 100644 meta/recipes-support/curl/curl/CVE-2026-7168.patch
 create mode 100644 meta/recipes-support/curl/curl/CVE-2026-8927.patch
 create mode 100644 meta/recipes-support/curl/curl/CVE-2026-8932.patch
#1 lore raw

PATCH 1/4 curl: Fix CVE-2026-8927

From: Devansh Patel <[email protected]>

This patch applies the upstream fix commit as referenced in [1], and the public CVE advisory is referenced in [2].

[1] https://github.com/curl/curl/commit/5c225384b8d52c67ce8259c6e4203bc57aacb567
[2] https://curl.se/docs/CVE-2026-8927.html
[3] https://www.cve.org/CVERecord?id=CVE-2026-8927

---
 .../curl/curl/CVE-2026-8927.patch             | 87 +++++++++++++++++++
 meta/recipes-support/curl/curl_8.7.1.bb       |  1 +
 2 files changed, 88 insertions(+)
 create mode 100644 meta/recipes-support/curl/curl/CVE-2026-8927.patch
meta/recipes-support/curl/curl/CVE-2026-8927.patch new file +87 -0
new file mode 100644
index 0000000..a8b07a5
@@ -0,0 +1,87 @@
+From d4e71ad3aed07542606d9c4afdf6884eccdb3a26 Mon Sep 17 00:00:00 2001
+From: Daniel Stenberg <[email protected]>
+Date: Mon, 18 May 2026 23:47:11 +0200
+Subject: [PATCH] url: detect proxy changes read from environment
+
+When a proxy is set from an environment variable, detect if that proxy
+is not the same as previously and flush state.
+
+Verified by test1647: verify changing proxy with env variables and make
+sure Digest state is flushed in the second use
+
+Closes #21666
+
+CVE: CVE-2026-8927
+Upstream-Status: Backport [https://github.com/curl/curl/commit/5c225384b8d52c67ce8259c6e4203bc57aacb567]
+
+Backport Changes:
+- Use the 8.7.1 free()/strdup() names and include vauth/vauth.h.
+  Keep the parsed proxy string until the existing out cleanup so the
+  upstream Digest-state comparison can still read it.
+- Omit tests/data/Makefile.am, tests/data/test1647,
+  tests/libtest/Makefile.inc and tests/libtest/lib1647.c.
+  The test-only feature-detection dependency is therefore unnecessary.
+
+Signed-off-by: Devansh Patel <[email protected]>
+---
+ lib/url.c     | 13 ++++++++++++-
+ lib/urldata.h |  1 +
+ 2 files changed, 13 insertions(+), 1 deletion(-)
+
+diff --git a/lib/url.c b/lib/url.c
+index 9e1ca03..fe76397 100644
+--- a/lib/url.c
++++ b/lib/url.c
+@@ -79,6 +79,7 @@
+ #include "share.h"
+ #include "content_encoding.h"
+ #include "http_digest.h"
++#include "vauth/vauth.h"
+ #include "http_negotiate.h"
+ #include "select.h"
+ #include "multiif.h"
+@@ -331,6 +332,9 @@ CURLcode Curl_close(struct Curl_easy **datap)
+   Curl_wildcard_dtor(&data->wildcard);
+   Curl_freeset(data);
+   Curl_headers_cleanup(data);
++#ifndef CURL_DISABLE_DIGEST_AUTH
++  free(data->state.envproxy);
++#endif
+   free(data);
+   return CURLE_OK;
+ }
+@@ -2535,7 +2539,6 @@ static CURLcode create_conn_helper_init_proxy(struct Curl_easy *data,
+     curl_proxytype ptype = (curl_proxytype)conn->http_proxy.proxytype;
+     if(proxy) {
+       result = parse_proxy(data, conn, proxy, ptype);
+-      Curl_safefree(proxy); /* parse_proxy copies the proxy string */
+       if(result)
+         goto out;
+     }
+@@ -2554,6 +2557,14 @@ static CURLcode create_conn_helper_init_proxy(struct Curl_easy *data,
+       result = CURLE_UNSUPPORTED_PROTOCOL;
+       goto out;
+ #else
++#ifndef CURL_DISABLE_DIGEST_AUTH
++      if(!Curl_safecmp(data->state.envproxy, proxy)) {
++        /* proxy changed */
++        Curl_auth_digest_cleanup(&data->state.proxydigest);
++        free(data->state.envproxy);
++        data->state.envproxy = strdup(proxy);
++      }
++#endif
+       /* force this connection's protocol to become HTTP if compatible */
+       if(!(conn->handler->protocol & PROTO_FAMILY_HTTP)) {
+         if((conn->handler->flags & PROTOPT_PROXY_AS_HTTP) &&
+diff --git a/lib/urldata.h b/lib/urldata.h
+index 4fc595a..d2d9424 100644
+--- a/lib/urldata.h
++++ b/lib/urldata.h
+@@ -1247,6 +1247,7 @@ struct UrlState {
+   void (*prev_signal)(int sig);
+ #endif
+ #ifndef CURL_DISABLE_DIGEST_AUTH
++  char *envproxy; /* last proxy string used for proxy-related state */
+   struct digestdata digest;      /* state data for host Digest auth */
+   struct digestdata proxydigest; /* state data for proxy Digest auth */
+ #endif
meta/recipes-support/curl/curl_8.7.1.bb +1 -0
index 076c875..6539f7f 100644
@@ -49,6 +49,7 @@ SRC_URI = "https://curl.se/download/${BP}.tar.xz \
            file://CVE-2026-92388-1.patch \
            file://CVE-2026-92388-2.patch \
            file://CVE-2026-87864.patch \
+           file://CVE-2026-8927.patch \
            "
 
 SRC_URI:append:class-nativesdk = " \
#2 lore raw

PATCH 2/4 curl: Fix CVE-2026-8932

In reply to Devansh Patel -X (devanshp - E INFOCHIPS PRIVATE LIMITED at Cisco)

From: Devansh Patel <[email protected]>

This patch applies the upstream fix commit as referenced in [1], and the public CVE advisory is referenced in [2].

[1] https://github.com/curl/curl/commit/7541ae569d82fb308a5e2d94916027da4fa3ba3e
[2] https://curl.se/docs/CVE-2026-8932.html
[3] https://www.cve.org/CVERecord?id=CVE-2026-8932

---
 .../curl/curl/CVE-2026-8932.patch             | 170 ++++++++++++++++++
 meta/recipes-support/curl/curl_8.7.1.bb       |   1 +
 2 files changed, 171 insertions(+)
 create mode 100644 meta/recipes-support/curl/curl/CVE-2026-8932.patch
meta/recipes-support/curl/curl/CVE-2026-8932.patch new file +170 -0
new file mode 100644
index 0000000..c7a6c4f
@@ -0,0 +1,170 @@
+From 8b62ee5391b03f780223bfc0780c9e14f01d34f2 Mon Sep 17 00:00:00 2001
+From: Joshua Rogers <[email protected]>
+Date: Tue, 19 May 2026 11:47:50 +0200
+Subject: [PATCH] tls: fix incomplete mTLS config in conn reuse and session
+ cache
+
+cert_type, key, key_type, key_passwd and key_blob lived in
+ssl_config_data but not in ssl_primary_config, so they were invisible to
+match_ssl_primary_config() and to the TLS session cache peer key.
+
+Two easy handles sharing a connection pool could reuse each other's
+authenticated connections when they differed only on SSLKEY, SSLKEYTYPE,
+KEYPASSWD, SSLCERTTYPE or SSLKEYBLOB. The second handle would silently
+inherit the first handle's authenticated identity.
+
+Promote all five fields into ssl_primary_config so the conn-reuse
+predicate and session cache key cover the complete client credential
+set. Also replace the fixed ":CCERT" session cache marker with the
+actual clientcert path so sessions are not shared across different
+client certificates.
+
+Verified by test 3303 and 3304
+
+Reported-By: Joshua Rogers (AISLE Research)
+Closes #21667
+
+CVE: CVE-2026-8932
+Upstream-Status: Backport [https://github.com/curl/curl/commit/7541ae569d82fb308a5e2d94916027da4fa3ba3e]
+
+Backport Changes:
+- Add the credential fields in upstream order and initialize primary
+  directly. Retain the old ssl_config_data fields as backend aliases.
+  The omitted lib/ldap.c, lib/vssh/{libssh,libssh2}.c and lib/vtls/
+  {gtls,mbedtls,openssl,rustls,schannel,wolfssl}.c hunks only relocate
+  equivalent credential reads. Use the old Curl_safefree name.
+- Apply session isolation through the existing vtls.c primary-config
+  clone/match paths. 8.7.1 lacks lib/vtls/vtls_scache.{c,h}; its cache
+  already compares the actual clientcert path, without a peer-key API.
+- Omit tests/data/{Makefile.am,test3303,test3304} and
+  tests/unit/{Makefile.inc,unit3303.c,unit3304.c}.
+
+Signed-off-by: Devansh Patel <[email protected]>
+---
+ lib/urldata.h   |  5 +++++
+ lib/vtls/vtls.c | 47 ++++++++++++++++++++++++++++++++++++-----------
+ 2 files changed, 41 insertions(+), 11 deletions(-)
+
+diff --git a/lib/urldata.h b/lib/urldata.h
+index d2d9424..957fef7 100644
+--- a/lib/urldata.h
++++ b/lib/urldata.h
+@@ -290,9 +290,14 @@ struct ssl_primary_config {
+   char *cipher_list13;   /* list of TLS 1.3 cipher suites to use */
+   char *pinned_key;
+   char *CRLfile;         /* CRL to check certificate revocation */
++  char *cert_type;       /* format for certificate (default: PEM) */
++  char *key;             /* private key filename */
++  char *key_type;        /* format for private key (default: PEM) */
++  char *key_passwd;      /* plain text private key password */
+   struct curl_blob *cert_blob;
+   struct curl_blob *ca_info_blob;
+   struct curl_blob *issuercert_blob;
++  struct curl_blob *key_blob;
+ #ifdef USE_TLS_SRP
+   char *username; /* TLS username (for, e.g., SRP) */
+   char *password; /* TLS password (for, e.g., SRP) */
+diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c
+index d13a3cb..969a8a2 100644
+--- a/lib/vtls/vtls.c
++++ b/lib/vtls/vtls.c
+@@ -187,6 +187,7 @@ match_ssl_primary_config(struct Curl_easy *data,
+      blobcmp(c1->cert_blob, c2->cert_blob) &&
+      blobcmp(c1->ca_info_blob, c2->ca_info_blob) &&
+      blobcmp(c1->issuercert_blob, c2->issuercert_blob) &&
++     blobcmp(c1->key_blob, c2->key_blob) &&
+      Curl_safecmp(c1->CApath, c2->CApath) &&
+      Curl_safecmp(c1->CAfile, c2->CAfile) &&
+      Curl_safecmp(c1->issuercert, c2->issuercert) &&
+@@ -199,7 +200,11 @@ match_ssl_primary_config(struct Curl_easy *data,
+      strcasecompare(c1->cipher_list13, c2->cipher_list13) &&
+      strcasecompare(c1->curves, c2->curves) &&
+      strcasecompare(c1->CRLfile, c2->CRLfile) &&
+-     strcasecompare(c1->pinned_key, c2->pinned_key))
++     strcasecompare(c1->pinned_key, c2->pinned_key) &&
++     curl_strequal(c1->cert_type, c2->cert_type) &&
++     Curl_safecmp(c1->key, c2->key) &&
++     curl_strequal(c1->key_type, c2->key_type) &&
++     !Curl_timestrcmp(c1->key_passwd, c2->key_passwd))
+     return TRUE;
+ 
+   return FALSE;
+@@ -234,6 +239,7 @@ static bool clone_ssl_primary_config(struct ssl_primary_config *source,
+   CLONE_BLOB(cert_blob);
+   CLONE_BLOB(ca_info_blob);
+   CLONE_BLOB(issuercert_blob);
++  CLONE_BLOB(key_blob);
+   CLONE_STRING(CApath);
+   CLONE_STRING(CAfile);
+   CLONE_STRING(issuercert);
+@@ -243,6 +249,10 @@ static bool clone_ssl_primary_config(struct ssl_primary_config *source,
+   CLONE_STRING(pinned_key);
+   CLONE_STRING(curves);
+   CLONE_STRING(CRLfile);
++  CLONE_STRING(cert_type);
++  CLONE_STRING(key);
++  CLONE_STRING(key_type);
++  CLONE_STRING(key_passwd);
+ #ifdef USE_TLS_SRP
+   CLONE_STRING(username);
+   CLONE_STRING(password);
+@@ -263,8 +273,13 @@ static void Curl_free_primary_ssl_config(struct ssl_primary_config *sslc)
+   Curl_safefree(sslc->cert_blob);
+   Curl_safefree(sslc->ca_info_blob);
+   Curl_safefree(sslc->issuercert_blob);
++  Curl_safefree(sslc->key_blob);
+   Curl_safefree(sslc->curves);
+   Curl_safefree(sslc->CRLfile);
++  Curl_safefree(sslc->cert_type);
++  Curl_safefree(sslc->key);
++  Curl_safefree(sslc->key_type);
++  Curl_safefree(sslc->key_passwd);
+ #ifdef USE_TLS_SRP
+   Curl_safefree(sslc->username);
+   Curl_safefree(sslc->password);
+@@ -291,12 +306,17 @@ CURLcode Curl_ssl_easy_config_complete(struct Curl_easy *data)
+   data->set.ssl.primary.username = data->set.str[STRING_TLSAUTH_USERNAME];
+   data->set.ssl.primary.password = data->set.str[STRING_TLSAUTH_PASSWORD];
+ #endif
+-  data->set.ssl.cert_type = data->set.str[STRING_CERT_TYPE];
+-  data->set.ssl.key = data->set.str[STRING_KEY];
+-  data->set.ssl.key_type = data->set.str[STRING_KEY_TYPE];
+-  data->set.ssl.key_passwd = data->set.str[STRING_KEY_PASSWD];
++  data->set.ssl.primary.cert_type = data->set.str[STRING_CERT_TYPE];
++  data->set.ssl.primary.key = data->set.str[STRING_KEY];
++  data->set.ssl.primary.key_type = data->set.str[STRING_KEY_TYPE];
++  data->set.ssl.primary.key_passwd = data->set.str[STRING_KEY_PASSWD];
+   data->set.ssl.primary.clientcert = data->set.str[STRING_CERT];
+-  data->set.ssl.key_blob = data->set.blobs[BLOB_KEY];
++  data->set.ssl.primary.key_blob = data->set.blobs[BLOB_KEY];
++  data->set.ssl.cert_type = data->set.ssl.primary.cert_type;
++  data->set.ssl.key = data->set.ssl.primary.key;
++  data->set.ssl.key_type = data->set.ssl.primary.key_type;
++  data->set.ssl.key_passwd = data->set.ssl.primary.key_passwd;
++  data->set.ssl.key_blob = data->set.ssl.primary.key_blob;
+ 
+ #ifndef CURL_DISABLE_PROXY
+   data->set.proxy_ssl.primary.CApath = data->set.str[STRING_SSL_CAPATH_PROXY];
+@@ -316,12 +336,17 @@ CURLcode Curl_ssl_easy_config_complete(struct Curl_easy *data)
+     data->set.blobs[BLOB_SSL_ISSUERCERT_PROXY];
+   data->set.proxy_ssl.primary.CRLfile =
+     data->set.str[STRING_SSL_CRLFILE_PROXY];
+-  data->set.proxy_ssl.cert_type = data->set.str[STRING_CERT_TYPE_PROXY];
+-  data->set.proxy_ssl.key = data->set.str[STRING_KEY_PROXY];
+-  data->set.proxy_ssl.key_type = data->set.str[STRING_KEY_TYPE_PROXY];
+-  data->set.proxy_ssl.key_passwd = data->set.str[STRING_KEY_PASSWD_PROXY];
++  data->set.proxy_ssl.primary.cert_type = data->set.str[STRING_CERT_TYPE_PROXY];
++  data->set.proxy_ssl.primary.key = data->set.str[STRING_KEY_PROXY];
++  data->set.proxy_ssl.primary.key_type = data->set.str[STRING_KEY_TYPE_PROXY];
++  data->set.proxy_ssl.primary.key_passwd = data->set.str[STRING_KEY_PASSWD_PROXY];
+   data->set.proxy_ssl.primary.clientcert = data->set.str[STRING_CERT_PROXY];
+-  data->set.proxy_ssl.key_blob = data->set.blobs[BLOB_KEY_PROXY];
++  data->set.proxy_ssl.primary.key_blob = data->set.blobs[BLOB_KEY_PROXY];
++  data->set.proxy_ssl.cert_type = data->set.proxy_ssl.primary.cert_type;
++  data->set.proxy_ssl.key = data->set.proxy_ssl.primary.key;
++  data->set.proxy_ssl.key_type = data->set.proxy_ssl.primary.key_type;
++  data->set.proxy_ssl.key_passwd = data->set.proxy_ssl.primary.key_passwd;
++  data->set.proxy_ssl.key_blob = data->set.proxy_ssl.primary.key_blob;
+ #ifdef USE_TLS_SRP
+   data->set.proxy_ssl.primary.username =
+     data->set.str[STRING_TLSAUTH_USERNAME_PROXY];
meta/recipes-support/curl/curl_8.7.1.bb +1 -0
index 6539f7f..144a5c2 100644
@@ -50,6 +50,7 @@ SRC_URI = "https://curl.se/download/${BP}.tar.xz \
            file://CVE-2026-92388-2.patch \
            file://CVE-2026-87864.patch \
            file://CVE-2026-8927.patch \
+           file://CVE-2026-8932.patch \
            "
 
 SRC_URI:append:class-nativesdk = " \
#3 lore raw

PATCH 3/4 curl: Fix CVE-2026-6429

In reply to Devansh Patel -X (devanshp - E INFOCHIPS PRIVATE LIMITED at Cisco)

From: Devansh Patel <[email protected]>

This patch applies the upstream fix commit as referenced in [1], and the public CVE advisory is referenced in [2].

[1] https://github.com/curl/curl/commit/b4024bf808bd558026fdc6096e8457f199ace306
[2] https://curl.se/docs/CVE-2026-6429.html
[3] https://www.cve.org/CVERecord?id=CVE-2026-6429

---
 .../curl/curl/CVE-2026-6429_p1.patch          | 205 ++++++++++++++++++
 .../curl/curl/CVE-2026-6429_p2.patch          |  52 +++++
 .../curl/curl/CVE-2026-6429_p3.patch          |  29 +++
 meta/recipes-support/curl/curl_8.7.1.bb       |   3 +
 4 files changed, 289 insertions(+)
 create mode 100644 meta/recipes-support/curl/curl/CVE-2026-6429_p1.patch
 create mode 100644 meta/recipes-support/curl/curl/CVE-2026-6429_p2.patch
 create mode 100644 meta/recipes-support/curl/curl/CVE-2026-6429_p3.patch
meta/recipes-support/curl/curl/CVE-2026-6429_p1.patch new file +205 -0
new file mode 100644
index 0000000..6b195dc
@@ -0,0 +1,205 @@
+From ad29c80f3afaffd4ee3c902e30e331eb3667b809 Mon Sep 17 00:00:00 2001
+From: Daniel Stenberg <[email protected]>
+Date: Thu, 16 Apr 2026 14:26:20 +0200
+Subject: [PATCH] http: clear credentials better on redirect
+
+Verify with test 2506: netrc with redirect using proxy
+
+Updated test 998 which was wrong.
+
+Reported-by: Muhamad Arga Reksapati
+
+Closes #21345
+
+CVE: CVE-2026-6429
+Upstream-Status: Backport [https://github.com/curl/curl/commit/b4024bf808bd558026fdc6096e8457f199ace306]
+
+Backport Changes:
+- Apply Curl_http_follow changes to Curl_follow in lib/transfer.c,
+  where 8.7.1 implements redirects. Use its newurl/state.url strings
+  and free/Curl_safefree names instead of the newer buffer API.
+- Fold in only the required Curl_url_same_origin helper and declaration
+  from upstream prerequisite 32a513e180ce83d5e9b708211306045407074134:
+  https://github.com/curl/curl/commit/32a513e180ce83d5e9b708211306045407074134
+  The target lacks this helper, so the redirect fix cannot compile.
+  Use Curl_handler/Curl_get_scheme_handler because the unchanged
+  upstream Curl_scheme/Curl_get_scheme API fails to compile on 8.7.1.
+  Omit the prerequisite's independent lib/http2.c consumer changes;
+  they are not needed for the redirect fix.
+- Remove the obsolete outer result declaration: the upstream block
+  declares its own result, leaving 8.7.1's outer variable unused
+  (confirmed with -Wall).
+- Omit tests/data/{Makefile.am,test998,test2506},
+  tests/libtest/{Makefile.inc,lib2506.c} and the prerequisite's
+  tests/unit/unit1675.c under the submitted series' code-only policy.
+
+Signed-off-by: Devansh Patel <[email protected]>
+---
+ lib/transfer.c   | 87 ++++++++++++++++--------------------------------
+ lib/urlapi-int.h |  2 ++
+ lib/urlapi.c     | 33 ++++++++++++++++++
+ 3 files changed, 64 insertions(+), 58 deletions(-)
+
+diff --git a/lib/transfer.c b/lib/transfer.c
+index a734629..082b0ae 100644
+--- a/lib/transfer.c
++++ b/lib/transfer.c
+@@ -777,7 +777,6 @@ CURLcode Curl_follow(struct Curl_easy *data,
+   bool disallowport = FALSE;
+   bool reachedmax = FALSE;
+   CURLUcode uc;
+-  CURLcode result;
+ 
+   DEBUGASSERT(type != FOLLOW_NONE);
+ 
+@@ -861,69 +860,41 @@ CURLcode Curl_follow(struct Curl_easy *data,
+       return CURLE_OUT_OF_MEMORY;
+   }
+   else {
+-    uc = curl_url_get(data->state.uh, CURLUPART_URL, &newurl, 0);
+-    if(uc)
++    bool same_origin;
++    CURLcode result;
++    CURLU *u = curl_url();
++    if(!u)
++      return CURLE_OUT_OF_MEMORY;
++    uc = curl_url_set(u, CURLUPART_URL,
++                      data->state.url,
++                      CURLU_URLENCODE | CURLU_ALLOW_SPACE);
++    if(!uc)
++      uc = curl_url_get(data->state.uh, CURLUPART_URL, &newurl, 0);
++    if(uc) {
++      curl_url_cleanup(u);
+       return Curl_uc_to_curlcode(uc);
++    }
+ 
+-    /* Clear auth if this redirects to a different port number or protocol,
+-       unless permitted */
+-    if(!data->set.allow_auth_to_other_hosts && (type != FOLLOW_FAKE)) {
+-      char *portnum;
+-      int port;
+-      bool clear = FALSE;
+-
+-      if(data->set.use_port && data->state.allow_port)
+-        /* a custom port is used */
+-        port = (int)data->set.use_port;
+-      else {
+-        uc = curl_url_get(data->state.uh, CURLUPART_PORT, &portnum,
+-                          CURLU_DEFAULT_PORT);
+-        if(uc) {
+-          free(newurl);
+-          return Curl_uc_to_curlcode(uc);
+-        }
+-        port = atoi(portnum);
+-        free(portnum);
+-      }
+-      if(port != data->info.conn_remote_port) {
+-        infof(data, "Clear auth, redirects to port from %u to %u",
+-              data->info.conn_remote_port, port);
+-        clear = TRUE;
+-      }
+-      else {
+-        char *scheme;
+-        const struct Curl_handler *p;
+-        uc = curl_url_get(data->state.uh, CURLUPART_SCHEME, &scheme, 0);
+-        if(uc) {
+-          free(newurl);
+-          return Curl_uc_to_curlcode(uc);
+-        }
++    same_origin = Curl_url_same_origin(u, data->state.uh);
++    curl_url_cleanup(u);
+ 
+-        p = Curl_get_scheme_handler(scheme);
+-        if(p && (p->protocol != data->info.conn_protocol)) {
+-          infof(data, "Clear auth, redirects scheme from %s to %s",
+-                data->info.conn_scheme, scheme);
+-          clear = TRUE;
+-        }
+-        free(scheme);
+-      }
+-      if(clear) {
+-        result = Curl_reset_userpwd(data);
+-        if(result) {
+-          free(newurl);
+-          return result;
+-        }
+-        Curl_safefree(data->state.aptr.user);
+-        Curl_safefree(data->state.aptr.passwd);
++    if((!same_origin && !data->set.allow_auth_to_other_hosts) ||
++       !data->set.str[STRING_USERNAME]) {
++      result = Curl_reset_userpwd(data);
++      if(result) {
++        free(newurl);
++        return result;
+       }
++      Curl_safefree(data->state.aptr.user);
++      Curl_safefree(data->state.aptr.passwd);
++    }
++    result = Curl_reset_proxypwd(data);
++    if(result) {
++      free(newurl);
++      return result;
+     }
+   }
+-
+-  result = Curl_reset_proxypwd(data);
+-  if(result) {
+-    free(newurl);
+-    return result;
+-  }
++  DEBUGASSERT(newurl);
+ 
+   if(type == FOLLOW_FAKE) {
+     /* we're only figuring out the new url if we would've followed locations
+diff --git a/lib/urlapi-int.h b/lib/urlapi-int.h
+index d6e240a..8176ff7 100644
+--- a/lib/urlapi-int.h
++++ b/lib/urlapi-int.h
+@@ -36,4 +36,6 @@ CURLUcode Curl_parse_port(struct Curl_URL *u, struct dynbuf *host,
+                           bool has_scheme);
+ #endif
+ 
++bool Curl_url_same_origin(CURLU *base, CURLU *href);
++
+ #endif /* HEADER_CURL_URLAPI_INT_H */
+diff --git a/lib/urlapi.c b/lib/urlapi.c
+index dc42489..7b02c86 100644
+--- a/lib/urlapi.c
++++ b/lib/urlapi.c
+@@ -1972,3 +1972,36 @@ nomem:
+     u->portnum = port;
+   return CURLUE_OK;
+ }
++
++bool Curl_url_same_origin(CURLU *base, CURLU *href)
++{
++  const struct Curl_handler *s = NULL;
++
++  /* base must be an absolute URL */
++  if(!base->scheme || !base->host)
++    return FALSE;
++  if(href->scheme && !curl_strequal(base->scheme, href->scheme))
++    return FALSE;
++  if(href->host) {
++    if(!curl_strequal(base->host, href->host))
++      return FALSE;
++    if(!curl_strequal(base->port, href->port)) {
++      /* This may still match if only one has an explicit port
++       * and it is the default for the scheme. */
++      if(base->port && href->port)
++        return FALSE;
++
++      s = Curl_get_scheme_handler(base->scheme);
++      if(!s) /* Cannot match default port for unknown scheme */
++        return FALSE;
++
++      /* The port which is set must be the default one */
++      if((base->port && (base->portnum != s->defport)) ||
++         (href->port && (href->portnum != s->defport)))
++        return FALSE;
++    }
++  }
++  else if(href->port) /* no host in href, then there must be no port */
++    return FALSE;
++  return TRUE;
++}
meta/recipes-support/curl/curl/CVE-2026-6429_p2.patch new file +52 -0

52 lines not on this page · raw message

meta/recipes-support/curl/curl/CVE-2026-6429_p3.patch new file +29 -0
new file mode 100644
index 0000000..4512bae
@@ -0,0 +1,29 @@
+From 15bbabb568d8516845223e088177588fa5d30fc4 Mon Sep 17 00:00:00 2001
+From: Joshua Rogers <[email protected]>
+Date: Wed, 20 May 2026 01:03:31 +0200
+Subject: [PATCH] urlapi: compare zone-id in Curl_url_same_origin()
+
+Closes #21686
+
+CVE: CVE-2026-6429
+Upstream-Status: Backport [https://github.com/curl/curl/commit/edfc80c7c473b9a09eba9e98e59c4d7d167bbb9e]
+
+Signed-off-by: Devansh Patel <[email protected]>
+---
+ lib/urlapi.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/lib/urlapi.c b/lib/urlapi.c
+index 7b02c86..f96ff42 100644
+--- a/lib/urlapi.c
++++ b/lib/urlapi.c
+@@ -1985,6 +1985,9 @@ bool Curl_url_same_origin(CURLU *base, CURLU *href)
+   if(href->host) {
+     if(!curl_strequal(base->host, href->host))
+       return FALSE;
++    if(!curl_strequal(base->zoneid ? base->zoneid : "",
++                      href->zoneid ? href->zoneid : ""))
++      return FALSE;
+     if(!curl_strequal(base->port, href->port)) {
+       /* This may still match if only one has an explicit port
+        * and it is the default for the scheme. */
meta/recipes-support/curl/curl_8.7.1.bb +3 -0
index 144a5c2..e365c68 100644
@@ -51,6 +51,9 @@ SRC_URI = "https://curl.se/download/${BP}.tar.xz \
            file://CVE-2026-87864.patch \
            file://CVE-2026-8927.patch \
            file://CVE-2026-8932.patch \
+           file://CVE-2026-6429_p1.patch \
+           file://CVE-2026-6429_p2.patch \
+           file://CVE-2026-6429_p3.patch \
            "
 
 SRC_URI:append:class-nativesdk = " \
#4 lore raw

PATCH 4/4 curl: Fix CVE-2026-7168

In reply to Devansh Patel -X (devanshp - E INFOCHIPS PRIVATE LIMITED at Cisco)

From: Devansh Patel <[email protected]>

This patch applies the upstream fix commit as referenced in [1], and the public CVE advisory is referenced in [2].

[1] https://github.com/curl/curl/commit/c1cfdf59acbaf9504c4578d4cf56cdd7c8594507
[2] https://curl.se/docs/CVE-2026-7168.html
[3] https://www.cve.org/CVERecord?id=CVE-2026-7168

---
 .../curl/curl/CVE-2026-7168.patch             | 83 +++++++++++++++++++
 meta/recipes-support/curl/curl_8.7.1.bb       |  1 +
 2 files changed, 84 insertions(+)
 create mode 100644 meta/recipes-support/curl/curl/CVE-2026-7168.patch
meta/recipes-support/curl/curl/CVE-2026-7168.patch new file +83 -0
new file mode 100644
index 0000000..cc12db0
@@ -0,0 +1,83 @@
+From 2b1d18e42252aa09236666f0469b48a0e1f95080 Mon Sep 17 00:00:00 2001
+From: Daniel Stenberg <[email protected]>
+Date: Mon, 27 Apr 2026 09:14:51 +0200
+Subject: [PATCH] setopt: clear proxy auth properties when switching
+
+Verify with test 1588
+
+Closes #21453
+
+CVE: CVE-2026-7168
+Upstream-Status: Backport [https://github.com/curl/curl/commit/c1cfdf59acbaf9504c4578d4cf56cdd7c8594507]
+
+Backport Changes:
+- Place setproxy() beside Curl_setstropt() and call it from the old
+  Curl_vsetopt CURLOPT_PROXY case; 8.7.1 has no setopt_cptr_proxy().
+  Add CURL_DISABLE_PROXY protection because this helper is outside
+  the upstream proxy-only section in the older monolithic file.
+  Keep the upstream Digest-disabled cleanup macro in vauth/vauth.h.
+- Omit tests/data/{Makefile.am,test1588} and
+  tests/libtest/{Makefile.inc,lib1588.c}.
+
+Signed-off-by: Devansh Patel <[email protected]>
+---
+ lib/setopt.c      | 18 ++++++++++++++++--
+ lib/vauth/vauth.h |  2 ++
+ 2 files changed, 18 insertions(+), 2 deletions(-)
+
+diff --git a/lib/setopt.c b/lib/setopt.c
+index 8a5a5d7..7eaf309 100644
+--- a/lib/setopt.c
++++ b/lib/setopt.c
+@@ -51,6 +51,7 @@
+ #include "altsvc.h"
+ #include "hsts.h"
+ #include "tftp.h"
++#include "vauth/vauth.h"
+ #include "strdup.h"
+ /* The last 3 #include files should be in this order */
+ #include "curl_printf.h"
+@@ -76,6 +77,20 @@ CURLcode Curl_setstropt(char **charp, const char *s)
+   return CURLE_OK;
+ }
+ 
++#ifndef CURL_DISABLE_PROXY
++static CURLcode setproxy(struct Curl_easy *data, const char *proxy)
++{
++  if((data->set.str[STRING_PROXY] && proxy) &&
++     /* there was one set, is this a new one? */
++     !strcmp(data->set.str[STRING_PROXY], proxy))
++    return CURLE_OK; /* same one as before */
++
++  Curl_auth_digest_cleanup(&data->state.proxydigest);
++  memset(&data->state.authproxy, 0, sizeof(data->state.authproxy));
++  return Curl_setstropt(&data->set.str[STRING_PROXY], proxy);
++}
++#endif
++
+ CURLcode Curl_setblobopt(struct curl_blob **blobp,
+                          const struct curl_blob *blob)
+ {
+@@ -1139,8 +1154,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
+      * Setting it to NULL, means no proxy but allows the environment variables
+      * to decide for us (if CURLOPT_SOCKS_PROXY setting it to NULL).
+      */
+-    result = Curl_setstropt(&data->set.str[STRING_PROXY],
+-                            va_arg(param, char *));
++    result = setproxy(data, va_arg(param, char *));
+     break;
+ 
+   case CURLOPT_PRE_PROXY:
+diff --git a/lib/vauth/vauth.h b/lib/vauth/vauth.h
+index 9da0540..bf5c7a3 100644
+--- a/lib/vauth/vauth.h
++++ b/lib/vauth/vauth.h
+@@ -119,6 +119,8 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
+ 
+ /* This is used to clean up the digest specific data */
+ void Curl_auth_digest_cleanup(struct digestdata *digest);
++#else
++#define Curl_auth_digest_cleanup(x)
+ #endif /* !CURL_DISABLE_DIGEST_AUTH */
+ 
+ #ifdef USE_GSASL
meta/recipes-support/curl/curl_8.7.1.bb +1 -0
index e365c68..0149a6f 100644
@@ -54,6 +54,7 @@ SRC_URI = "https://curl.se/download/${BP}.tar.xz \
            file://CVE-2026-6429_p1.patch \
            file://CVE-2026-6429_p2.patch \
            file://CVE-2026-6429_p3.patch \
+           file://CVE-2026-7168.patch \
            "
 
 SRC_URI:append:class-nativesdk = " \