[openwrt/openwrt] busybox: awk: fix use after free (CVE-2022-30065)
LEDE Commits
lede-commits at lists.infradead.org
Sat Nov 5 16:03:56 PDT 2022
hauke pushed a commit to openwrt/openwrt.git, branch openwrt-22.03:
https://git.openwrt.org/13bd217821e766110298498d0b73c4394e3330bd
commit 13bd217821e766110298498d0b73c4394e3330bd
Author: Hauke Mehrtens <hauke at hauke-m.de>
AuthorDate: Tue Nov 1 15:23:17 2022 +0100
busybox: awk: fix use after free (CVE-2022-30065)
This backports a commit which fixes a use after free bug in awk.
CVE-2022-30065 description:
A use-after-free in Busybox 1.35-x's awk applet leads to denial of
service and possibly code execution when processing a crafted awk
pattern in the copyvar function.
Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
(cherry picked from commit 8b383ee2a0d21144258346ad39006fc499d04b4f)
---
...001-CVE-2022-30065-awk-fix-use-after-free.patch | 42 ++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/package/utils/busybox/patches/001-CVE-2022-30065-awk-fix-use-after-free.patch b/package/utils/busybox/patches/001-CVE-2022-30065-awk-fix-use-after-free.patch
new file mode 100644
index 0000000000..7dcb9dff3f
--- /dev/null
+++ b/package/utils/busybox/patches/001-CVE-2022-30065-awk-fix-use-after-free.patch
@@ -0,0 +1,42 @@
+From e63d7cdfdac78c6fd27e9e63150335767592b85e Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa at alpinelinux.org>
+Date: Fri, 17 Jun 2022 17:45:34 +0200
+Subject: 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 <ncopa at alpinelinux.org>
+Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
+---
+ editors/awk.c | 3 +++
+ testsuite/awk.tests | 6 ++++++
+ 2 files changed, 9 insertions(+)
+
+--- a/editors/awk.c
++++ b/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)
+--- a/testsuite/awk.tests
++++ b/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
More information about the lede-commits
mailing list