summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHitendra Prajapati <hprajapati@mvista.com>2024-07-16 11:26:43 +0530
committerSteve Sakoman <steve@sakoman.com>2024-07-24 07:51:58 -0700
commit4bad38de6e7261c08c7e9b4c12de6aad53928716 (patch)
tree988079487e31569c9508fcf52c8c40f732e580c5
parent6bd3969d32730538608e680653e032e66958fe84 (diff)
downloadpoky-4bad38de6e7261c08c7e9b4c12de6aad53928716.tar.gz
busybox: Fix CVE-2023-42363
Upstream-Status: Backport from https://git.busybox.net/busybox/commit/?id=fb08d43d44d1fea1f741fafb9aa7e1958a5f69aa (From OE-Core rev: 929deb4a80d65dc3a6e9a523f1aed12635ed7d53) Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-core/busybox/busybox/CVE-2023-42363.patch67
-rw-r--r--meta/recipes-core/busybox/busybox_1.35.0.bb1
2 files changed, 68 insertions, 0 deletions
diff --git a/meta/recipes-core/busybox/busybox/CVE-2023-42363.patch b/meta/recipes-core/busybox/busybox/CVE-2023-42363.patch
new file mode 100644
index 0000000000..b401a6e3e5
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/CVE-2023-42363.patch
@@ -0,0 +1,67 @@
1From fb08d43d44d1fea1f741fafb9aa7e1958a5f69aa Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Mon, 20 May 2024 17:55:28 +0200
4Subject: awk: fix use after free (CVE-2023-42363)
5
6function old new delta
7evaluate 3377 3385 +8
8
9Fixes https://bugs.busybox.net/show_bug.cgi?id=15865
10
11Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
12Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
13
14Upstream-Status: Backport [https://git.busybox.net/busybox/commit/?id=fb08d43d44d1fea1f741fafb9aa7e1958a5f69aa]
15CVE: CVE-2023-42363
16Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
17---
18 editors/awk.c | 21 +++++++++++++--------
19 1 file changed, 13 insertions(+), 8 deletions(-)
20
21diff --git a/editors/awk.c b/editors/awk.c
22index 654cbac..4fbc11d 100644
23--- a/editors/awk.c
24+++ b/editors/awk.c
25@@ -2889,19 +2889,14 @@ static var *evaluate(node *op, var *res)
26 if ((opinfo & OF_REQUIRED) && !op1)
27 syntax_error(EMSG_TOO_FEW_ARGS);
28 L.v = evaluate(op1, TMPVAR0);
29- if (opinfo & OF_STR1) {
30- L.s = getvar_s(L.v);
31- debug_printf_eval("L.s:'%s'\n", L.s);
32- }
33 if (opinfo & OF_NUM1) {
34 L_d = getvar_i(L.v);
35 debug_printf_eval("L_d:%f\n", L_d);
36 }
37 }
38- /* NB: Must get string/numeric values of L (done above)
39- * _before_ evaluate()'ing R.v: if both L and R are $NNNs,
40- * and right one is large, then L.v points to Fields[NNN1],
41- * second evaluate() reallocates and moves (!) Fields[],
42+ /* NB: if both L and R are $NNNs, and right one is large,
43+ * then at this pint L.v points to Fields[NNN1], second
44+ * evaluate() below reallocates and moves (!) Fields[],
45 * R.v points to Fields[NNN2] but L.v now points to freed mem!
46 * (Seen trying to evaluate "$444 $44444")
47 */
48@@ -2914,6 +2909,16 @@ static var *evaluate(node *op, var *res)
49 debug_printf_eval("R.s:'%s'\n", R.s);
50 }
51 }
52+ /* Get L.s _after_ R.v is evaluated: it may have realloc'd L.v
53+ * so we must get the string after "old_Fields_ptr" correction
54+ * above. Testcase: x = (v = "abc", gsub("b", "X", v));
55+ */
56+ if (opinfo & OF_RES1) {
57+ if (opinfo & OF_STR1) {
58+ L.s = getvar_s(L.v);
59+ debug_printf_eval("L.s:'%s'\n", L.s);
60+ }
61+ }
62
63 debug_printf_eval("switch(0x%x)\n", XC(opinfo & OPCLSMASK));
64 switch (XC(opinfo & OPCLSMASK)) {
65--
662.25.1
67
diff --git a/meta/recipes-core/busybox/busybox_1.35.0.bb b/meta/recipes-core/busybox/busybox_1.35.0.bb
index 07a5137d2a..842562c4c4 100644
--- a/meta/recipes-core/busybox/busybox_1.35.0.bb
+++ b/meta/recipes-core/busybox/busybox_1.35.0.bb
@@ -52,6 +52,7 @@ SRC_URI = "https://busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
52 file://CVE-2022-30065.patch \ 52 file://CVE-2022-30065.patch \
53 file://0001-devmem-add-128-bit-width.patch \ 53 file://0001-devmem-add-128-bit-width.patch \
54 file://CVE-2022-48174.patch \ 54 file://CVE-2022-48174.patch \
55 file://CVE-2023-42363.patch \
55 " 56 "
56SRC_URI:append:libc-musl = " file://musl.cfg " 57SRC_URI:append:libc-musl = " file://musl.cfg "
57 58