summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVijay Anusuri <vanusuri@mvista.com>2024-06-21 12:21:27 +0530
committerSteve Sakoman <steve@sakoman.com>2024-07-03 06:28:34 -0700
commitf2310cc64a0d638997b2d4912fa972ec16869fa7 (patch)
tree4c589a5d14912b562b9a6bacd5006c6aee7f095c
parentf7def85be9f99dcb4ba488bead201f670304379b (diff)
downloadpoky-f2310cc64a0d638997b2d4912fa972ec16869fa7.tar.gz
wget: Fix for CVE-2024-38428
Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/wget.git/commit/?id=ed0c7c7e0e8f7298352646b2fd6e06a11e242ace] (From OE-Core rev: 3c6e147f57e44d473fbd5fe5a11746150e561937) Signed-off-by: Vijay Anusuri <vanusuri@mvista.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-extended/wget/wget/CVE-2024-38428.patch79
-rw-r--r--meta/recipes-extended/wget/wget_1.21.4.bb1
2 files changed, 80 insertions, 0 deletions
diff --git a/meta/recipes-extended/wget/wget/CVE-2024-38428.patch b/meta/recipes-extended/wget/wget/CVE-2024-38428.patch
new file mode 100644
index 0000000000..ed99a05464
--- /dev/null
+++ b/meta/recipes-extended/wget/wget/CVE-2024-38428.patch
@@ -0,0 +1,79 @@
1From ed0c7c7e0e8f7298352646b2fd6e06a11e242ace Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Tim=20R=C3=BChsen?= <tim.ruehsen@gmx.de>
3Date: Sun, 2 Jun 2024 12:40:16 +0200
4Subject: Properly re-implement userinfo parsing (rfc2396)
5
6* src/url.c (url_skip_credentials): Properly re-implement userinfo parsing (rfc2396)
7
8The reason why the implementation is based on RFC 2396, an outdated standard,
9is that the whole file is based on that RFC, and mixing standard here might be
10dangerous.
11
12Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/wget.git/commit/?id=ed0c7c7e0e8f7298352646b2fd6e06a11e242ace]
13CVE: CVE-2024-38428
14Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
15---
16 src/url.c | 40 ++++++++++++++++++++++++++++++++++------
17 1 file changed, 34 insertions(+), 6 deletions(-)
18
19diff --git a/src/url.c b/src/url.c
20index 69e948b..07c3bc8 100644
21--- a/src/url.c
22+++ b/src/url.c
23@@ -41,6 +41,7 @@ as that of the covered work. */
24 #include "url.h"
25 #include "host.h" /* for is_valid_ipv6_address */
26 #include "c-strcase.h"
27+#include "c-ctype.h"
28
29 #ifdef HAVE_ICONV
30 # include <iconv.h>
31@@ -526,12 +527,39 @@ scheme_leading_string (enum url_scheme scheme)
32 static const char *
33 url_skip_credentials (const char *url)
34 {
35- /* Look for '@' that comes before terminators, such as '/', '?',
36- '#', or ';'. */
37- const char *p = (const char *)strpbrk (url, "@/?#;");
38- if (!p || *p != '@')
39- return url;
40- return p + 1;
41+ /*
42+ * This whole file implements https://www.rfc-editor.org/rfc/rfc2396 .
43+ * RFC 2396 is outdated since 2005 and needs a rewrite or a thorough re-visit.
44+ *
45+ * The RFC says
46+ * server = [ [ userinfo "@" ] hostport ]
47+ * userinfo = *( unreserved | escaped | ";" | ":" | "&" | "=" | "+" | "$" | "," )
48+ * unreserved = alphanum | mark
49+ * mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")"
50+ */
51+ static const char *allowed = "-_.!~*'();:&=+$,";
52+
53+ for (const char *p = url; *p; p++)
54+ {
55+ if (c_isalnum(*p))
56+ continue;
57+
58+ if (strchr(allowed, *p))
59+ continue;
60+
61+ if (*p == '%' && c_isxdigit(p[1]) && c_isxdigit(p[2]))
62+ {
63+ p += 2;
64+ continue;
65+ }
66+
67+ if (*p == '@')
68+ return p + 1;
69+
70+ break;
71+ }
72+
73+ return url;
74 }
75
76 /* Parse credentials contained in [BEG, END). The region is expected
77--
78cgit v1.1
79
diff --git a/meta/recipes-extended/wget/wget_1.21.4.bb b/meta/recipes-extended/wget/wget_1.21.4.bb
index 1d31b0116d..bc65a8f7c8 100644
--- a/meta/recipes-extended/wget/wget_1.21.4.bb
+++ b/meta/recipes-extended/wget/wget_1.21.4.bb
@@ -1,5 +1,6 @@
1SRC_URI = "${GNU_MIRROR}/wget/wget-${PV}.tar.gz \ 1SRC_URI = "${GNU_MIRROR}/wget/wget-${PV}.tar.gz \
2 file://0002-improve-reproducibility.patch \ 2 file://0002-improve-reproducibility.patch \
3 file://CVE-2024-38428.patch \
3 " 4 "
4 5
5SRC_URI[sha256sum] = "81542f5cefb8faacc39bbbc6c82ded80e3e4a88505ae72ea51df27525bcde04c" 6SRC_URI[sha256sum] = "81542f5cefb8faacc39bbbc6c82ded80e3e4a88505ae72ea51df27525bcde04c"