Skip to content

Commit 7cef86d

Browse files
[AUTO-CHERRYPICK] [Medium] patch curl for CVE-2024-9681 - branch 3.0-dev (#12084)
Co-authored-by: jykanase <[email protected]>
1 parent fbb8161 commit 7cef86d

File tree

6 files changed

+83
-15
lines changed

6 files changed

+83
-15
lines changed

SPECS/curl/CVE-2024-9681.patch

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
From 42e322412593a4b98b8ade35f2adfdce9b171478 Mon Sep 17 00:00:00 2001
2+
From: jykanase <[email protected]>
3+
Date: Fri, 24 Jan 2025 06:27:04 +0000
4+
Subject: [PATCH] CVE-2024-9681
5+
6+
Backported from : https://github.com/curl/curl/commit/a94973805df96269bf
7+
---
8+
lib/hsts.c | 14 ++++++++++----
9+
1 file changed, 10 insertions(+), 4 deletions(-)
10+
11+
diff --git a/lib/hsts.c b/lib/hsts.c
12+
index a5e7676..d1e434f 100644
13+
--- a/lib/hsts.c
14+
+++ b/lib/hsts.c
15+
@@ -249,12 +249,14 @@ CURLcode Curl_hsts_parse(struct hsts *h, const char *hostname,
16+
struct stsentry *Curl_hsts(struct hsts *h, const char *hostname,
17+
bool subdomain)
18+
{
19+
+ struct stsentry *bestsub = NULL;
20+
if(h) {
21+
char buffer[MAX_HSTS_HOSTLEN + 1];
22+
time_t now = time(NULL);
23+
size_t hlen = strlen(hostname);
24+
struct Curl_llist_element *e;
25+
struct Curl_llist_element *n;
26+
+ size_t blen = 0;
27+
28+
if((hlen > MAX_HSTS_HOSTLEN) || !hlen)
29+
return NULL;
30+
@@ -279,15 +281,19 @@ struct stsentry *Curl_hsts(struct hsts *h, const char *hostname,
31+
if(ntail < hlen) {
32+
size_t offs = hlen - ntail;
33+
if((hostname[offs-1] == '.') &&
34+
- strncasecompare(&hostname[offs], sts->host, ntail))
35+
- return sts;
36+
+ strncasecompare(&hostname[offs], sts->host, ntail) &&
37+
+ (ntail > blen)) {
38+
+ /* save the tail match with the longest tail */
39+
+ bestsub = sts;
40+
+ blen = ntail;
41+
+ }
42+
}
43+
}
44+
if(strcasecompare(hostname, sts->host))
45+
return sts;
46+
}
47+
}
48+
- return NULL; /* no match */
49+
+ return bestsub;
50+
}
51+
52+
/*
53+
@@ -439,7 +445,7 @@ static CURLcode hsts_add(struct hsts *h, char *line)
54+
e = Curl_hsts(h, p, subdomain);
55+
if(!e)
56+
result = hsts_create(h, p, subdomain, expires);
57+
- else {
58+
+ else if(strcasecompare(p, e->host)) {
59+
/* the same host name, use the largest expire time */
60+
if(expires > e->expires)
61+
e->expires = expires;
62+
--
63+
2.45.2
64+

SPECS/curl/curl.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Summary: An URL retrieval utility and library
22
Name: curl
33
Version: 8.8.0
4-
Release: 3%{?dist}
4+
Release: 4%{?dist}
55
License: curl
66
Vendor: Microsoft Corporation
77
Distribution: Azure Linux
@@ -10,6 +10,7 @@ URL: https://curl.haxx.se
1010
Source0: https://curl.haxx.se/download/%{name}-%{version}.tar.gz
1111
Patch0: CVE-2024-6197.patch
1212
Patch1: CVE-2024-8096.patch
13+
Patch2: CVE-2024-9681.patch
1314
BuildRequires: krb5-devel
1415
BuildRequires: libssh2-devel
1516
BuildRequires: nghttp2-devel
@@ -87,6 +88,9 @@ find %{buildroot} -type f -name "*.la" -delete -print
8788
%{_libdir}/libcurl.so.*
8889

8990
%changelog
91+
* Fri Jan 24 2025 Jyoti Kanase <[email protected]> - 8.8.0-4
92+
- Fix for CVE-2024-9681
93+
9094
* Tue Oct 15 2024 Muhammad Falak <[email protected]> - 8.8.0-3
9195
- Address CVE-2024-8096
9296

toolkit/resources/manifests/package/pkggen_core_aarch64.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,9 @@ libssh2-1.11.0-1.azl3.aarch64.rpm
195195
libssh2-devel-1.11.0-1.azl3.aarch64.rpm
196196
krb5-1.21.3-2.azl3.aarch64.rpm
197197
nghttp2-1.61.0-2.azl3.aarch64.rpm
198-
curl-8.8.0-3.azl3.aarch64.rpm
199-
curl-devel-8.8.0-3.azl3.aarch64.rpm
200-
curl-libs-8.8.0-3.azl3.aarch64.rpm
198+
curl-8.8.0-4.azl3.aarch64.rpm
199+
curl-devel-8.8.0-4.azl3.aarch64.rpm
200+
curl-libs-8.8.0-4.azl3.aarch64.rpm
201201
createrepo_c-1.0.3-1.azl3.aarch64.rpm
202202
libxml2-2.11.5-3.azl3.aarch64.rpm
203203
libxml2-devel-2.11.5-3.azl3.aarch64.rpm

toolkit/resources/manifests/package/pkggen_core_x86_64.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,9 @@ libssh2-1.11.0-1.azl3.x86_64.rpm
195195
libssh2-devel-1.11.0-1.azl3.x86_64.rpm
196196
krb5-1.21.3-2.azl3.x86_64.rpm
197197
nghttp2-1.61.0-2.azl3.x86_64.rpm
198-
curl-8.8.0-3.azl3.x86_64.rpm
199-
curl-devel-8.8.0-3.azl3.x86_64.rpm
200-
curl-libs-8.8.0-3.azl3.x86_64.rpm
198+
curl-8.8.0-4.azl3.x86_64.rpm
199+
curl-devel-8.8.0-4.azl3.x86_64.rpm
200+
curl-libs-8.8.0-4.azl3.x86_64.rpm
201201
createrepo_c-1.0.3-1.azl3.x86_64.rpm
202202
libxml2-2.11.5-3.azl3.x86_64.rpm
203203
libxml2-devel-2.11.5-3.azl3.x86_64.rpm

toolkit/resources/manifests/package/toolchain_aarch64.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ cracklib-lang-2.9.11-1.azl3.aarch64.rpm
6565
createrepo_c-1.0.3-1.azl3.aarch64.rpm
6666
createrepo_c-debuginfo-1.0.3-1.azl3.aarch64.rpm
6767
createrepo_c-devel-1.0.3-1.azl3.aarch64.rpm
68-
curl-8.8.0-3.azl3.aarch64.rpm
69-
curl-debuginfo-8.8.0-3.azl3.aarch64.rpm
70-
curl-devel-8.8.0-3.azl3.aarch64.rpm
71-
curl-libs-8.8.0-3.azl3.aarch64.rpm
68+
curl-8.8.0-4.azl3.aarch64.rpm
69+
curl-debuginfo-8.8.0-4.azl3.aarch64.rpm
70+
curl-devel-8.8.0-4.azl3.aarch64.rpm
71+
curl-libs-8.8.0-4.azl3.aarch64.rpm
7272
Cython-debuginfo-3.0.5-2.azl3.aarch64.rpm
7373
debugedit-5.0-2.azl3.aarch64.rpm
7474
debugedit-debuginfo-5.0-2.azl3.aarch64.rpm

toolkit/resources/manifests/package/toolchain_x86_64.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ createrepo_c-debuginfo-1.0.3-1.azl3.x86_64.rpm
7070
createrepo_c-devel-1.0.3-1.azl3.x86_64.rpm
7171
cross-binutils-common-2.41-2.azl3.noarch.rpm
7272
cross-gcc-common-13.2.0-7.azl3.noarch.rpm
73-
curl-8.8.0-3.azl3.x86_64.rpm
74-
curl-debuginfo-8.8.0-3.azl3.x86_64.rpm
75-
curl-devel-8.8.0-3.azl3.x86_64.rpm
76-
curl-libs-8.8.0-3.azl3.x86_64.rpm
73+
curl-8.8.0-4.azl3.x86_64.rpm
74+
curl-debuginfo-8.8.0-4.azl3.x86_64.rpm
75+
curl-devel-8.8.0-4.azl3.x86_64.rpm
76+
curl-libs-8.8.0-4.azl3.x86_64.rpm
7777
Cython-debuginfo-3.0.5-2.azl3.x86_64.rpm
7878
debugedit-5.0-2.azl3.x86_64.rpm
7979
debugedit-debuginfo-5.0-2.azl3.x86_64.rpm

0 commit comments

Comments
 (0)