diff options
-rw-r--r-- | meta/recipes-core/busybox/busybox/BUG9071_buffer_overflow_arp.patch | 53 | ||||
-rw-r--r-- | meta/recipes-core/busybox/busybox_1.24.1.bb | 1 |
2 files changed, 54 insertions, 0 deletions
diff --git a/meta/recipes-core/busybox/busybox/BUG9071_buffer_overflow_arp.patch b/meta/recipes-core/busybox/busybox/BUG9071_buffer_overflow_arp.patch new file mode 100644 index 0000000000..828694cbb9 --- /dev/null +++ b/meta/recipes-core/busybox/busybox/BUG9071_buffer_overflow_arp.patch | |||
@@ -0,0 +1,53 @@ | |||
1 | busybox1.24.1: Fix busybox - (local) cmdline stack buffer overwrite | ||
2 | |||
3 | [No upstream tracking] -- https://bugs.busybox.net/show_bug.cgi?id=9071 | ||
4 | |||
5 | busybox - (local) cmdline stack buffer overwrite | ||
6 | |||
7 | Busybox provides an `arp` applet which is missing an array bounds check for | ||
8 | command-line parameter `IFNAME`. It is therefore vulnerable to a command-line | ||
9 | based local stack buffer overwrite effectively allowing local users to write | ||
10 | past a 16 bytes fixed stack buffer. This leads to two scenarios, one (A) where | ||
11 | an IOCTL for GET_HW_ADDRESS (`SIOCGIFHWADDR`) fails and results in a corrupted | ||
12 | `va_list` being passed to `*printf()` and one (B) where an attacker might provide | ||
13 | valid params for the IOCTL and trick the program to proceed and result in a | ||
14 | `RET eip overwrite` eventually gaining code execution. | ||
15 | |||
16 | Upstream-Status: Backport [https://git.busybox.net/busybox/commit/networking/arp.c?id=88e2b1cb626761b1924305b761a5dfc723613c4e] | ||
17 | BUG: BUG9071 | ||
18 | Signed-off-by: Martin Balik <martin.balik@siemens.com> | ||
19 | Signed-off-by: Pascal Bach <pascal.bach@siemens.com> | ||
20 | |||
21 | -- | ||
22 | |||
23 | diff --git a/networking/arp.c b/networking/arp.c | ||
24 | index 0099aa5..87eb327 100644 | ||
25 | --- a/networking/arp.c | ||
26 | +++ b/networking/arp.c | ||
27 | @@ -176,7 +176,7 @@ static int arp_del(char **args) | ||
28 | if (flags == 0) | ||
29 | flags = 3; | ||
30 | |||
31 | - strncpy(req.arp_dev, device, sizeof(req.arp_dev)); | ||
32 | + strncpy_IFNAMSIZ(req.arp_dev, device); | ||
33 | |||
34 | err = -1; | ||
35 | |||
36 | @@ -217,7 +217,7 @@ static void arp_getdevhw(char *ifname, struct sockaddr *sa) | ||
37 | struct ifreq ifr; | ||
38 | const struct hwtype *xhw; | ||
39 | |||
40 | - strcpy(ifr.ifr_name, ifname); | ||
41 | + strncpy_IFNAMSIZ(ifr.ifr_name, ifname); | ||
42 | ioctl_or_perror_and_die(sockfd, SIOCGIFHWADDR, &ifr, | ||
43 | "can't get HW-Address for '%s'", ifname); | ||
44 | if (hw_set && (ifr.ifr_hwaddr.sa_family != hw->type)) { | ||
45 | @@ -330,7 +330,7 @@ static int arp_set(char **args) | ||
46 | /* Fill in the remainder of the request. */ | ||
47 | req.arp_flags = flags; | ||
48 | |||
49 | - strncpy(req.arp_dev, device, sizeof(req.arp_dev)); | ||
50 | + strncpy_IFNAMSIZ(req.arp_dev, device); | ||
51 | |||
52 | /* Call the kernel. */ | ||
53 | if (option_mask32 & ARP_OPT_v) | ||
diff --git a/meta/recipes-core/busybox/busybox_1.24.1.bb b/meta/recipes-core/busybox/busybox_1.24.1.bb index 6013ec9e5d..e26dfff776 100644 --- a/meta/recipes-core/busybox/busybox_1.24.1.bb +++ b/meta/recipes-core/busybox/busybox_1.24.1.bb | |||
@@ -56,6 +56,7 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \ | |||
56 | file://makefile-libbb-race.patch \ | 56 | file://makefile-libbb-race.patch \ |
57 | file://0001-libiproute-handle-table-ids-larger-than-255.patch \ | 57 | file://0001-libiproute-handle-table-ids-larger-than-255.patch \ |
58 | file://ifupdown-pass-interface-device-name-for-ipv6-route-c.patch \ | 58 | file://ifupdown-pass-interface-device-name-for-ipv6-route-c.patch \ |
59 | file://BUG9071_buffer_overflow_arp.patch \ | ||
59 | " | 60 | " |
60 | SRC_URI_append_libc-musl = " file://musl.cfg " | 61 | SRC_URI_append_libc-musl = " file://musl.cfg " |
61 | 62 | ||