From 97ddd308973dbe52f27a7596230ea12d03ea8606737d0f530b4a9929f5c83e25 Mon Sep 17 00:00:00 2001 From: Ihno Krumreich Date: Wed, 23 Nov 2022 16:26:38 +0000 Subject: [PATCH] Accepting request 1037611 from home:dimstar:Factory - Add e63d7cdf.patch: awk: fix use after free (CVE-2022-30065, boo#1199744). OBS-URL: https://build.opensuse.org/request/show/1037611 OBS-URL: https://build.opensuse.org/package/show/Base:System/busybox?expand=0&rev=114 --- busybox.changes | 6 ++++++ busybox.spec | 2 ++ cpio-long-opt.patch | 9 +++++---- e63d7cdf.patch | 46 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 e63d7cdf.patch diff --git a/busybox.changes b/busybox.changes index e94b51e..e03d1cc 100644 --- a/busybox.changes +++ b/busybox.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Nov 23 13:24:55 UTC 2022 - Dominique Leuenberger + +- Add e63d7cdf.patch: awk: fix use after free (CVE-2022-30065, + boo#1199744). + ------------------------------------------------------------------- Mon Nov 14 08:52:35 UTC 2022 - Radoslav Kolev diff --git a/busybox.spec b/busybox.spec index e6e1708..0e6ff67 100644 --- a/busybox.spec +++ b/busybox.spec @@ -42,6 +42,8 @@ Source7: busybox.config.static.warewulf3 Patch0: cpio-long-opt.patch Patch1: sendmail-ignore-F-option.patch Patch2: testsuite-gnu-echo.patch +# PATCH-FIX-UPSTREAM e63d7cdf.patch CVE-2022-30065 - awk: fix use after free (rebased https://github.com/mirror/busybox/commit/e63d7cdf.patch) +Patch3: e63d7cdf.patch # other patches Patch100: busybox.install.patch Provides: useradd_or_adduser_dep diff --git a/cpio-long-opt.patch b/cpio-long-opt.patch index 1cc770b..8eaea4b 100644 --- a/cpio-long-opt.patch +++ b/cpio-long-opt.patch @@ -1,7 +1,8 @@ -diff -urN busybox-1.32.0.orig/archival/cpio.c busybox-1.32.0/archival/cpio.c ---- busybox-1.32.0.orig/archival/cpio.c 2020-06-26 20:47:44.000000000 +0200 -+++ busybox-1.32.0/archival/cpio.c 2020-12-07 11:23:44.913676627 +0100 -@@ -367,6 +367,9 @@ +Index: busybox-1.35.0/archival/cpio.c +=================================================================== +--- busybox-1.35.0.orig/archival/cpio.c ++++ busybox-1.35.0/archival/cpio.c +@@ -413,6 +413,9 @@ int cpio_main(int argc UNUSED_PARAM, cha const char *long_opts = "extract\0" No_argument "i" "list\0" No_argument "t" diff --git a/e63d7cdf.patch b/e63d7cdf.patch new file mode 100644 index 0000000..e220539 --- /dev/null +++ b/e63d7cdf.patch @@ -0,0 +1,46 @@ +From e63d7cdfdac78c6fd27e9e63150335767592b85e Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Fri, 17 Jun 2022 17:45:34 +0200 +Subject: [PATCH] awk: fix use after free (CVE-2022-30065) + +fixes https://bugs.busybox.net/show_bug.cgi?id=14781 + +function old new delta +evaluate 3343 3357 +14 + +Signed-off-by: Natanael Copa +Signed-off-by: Denys Vlasenko +--- + editors/awk.c | 3 +++ + testsuite/awk.tests | 6 ++++++ + 2 files changed, 9 insertions(+) + +Index: busybox-1.35.0/editors/awk.c +=================================================================== +--- busybox-1.35.0.orig/editors/awk.c ++++ busybox-1.35.0/editors/awk.c +@@ -3114,6 +3114,9 @@ static var *evaluate(node *op, var *res) + + case XC( OC_MOVE ): + debug_printf_eval("MOVE\n"); ++ /* make sure that we never return a temp var */ ++ if (L.v == TMPVAR0) ++ L.v = res; + /* if source is a temporary string, jusk relink it to dest */ + if (R.v == TMPVAR1 + && !(R.v->type & VF_NUMBER) +Index: busybox-1.35.0/testsuite/awk.tests +=================================================================== +--- busybox-1.35.0.orig/testsuite/awk.tests ++++ busybox-1.35.0/testsuite/awk.tests +@@ -469,4 +469,10 @@ testing 'awk printf %% prints one %' \ + "%\n" \ + '' '' + ++testing 'awk assign while test' \ ++ "awk '\$1==\$1=\"foo\" {print \$1}'" \ ++ "foo\n" \ ++ "" \ ++ "foo" ++ + exit $FAILCOUNT