klibc: patch CVE-2021-31870
PATCH 1/10 klibc: patch CVE-2021-31870
Details: https://nvd.nist.gov/vuln/detail/CVE-2021-31870
Pick patch mentioned in the nvd report.
--- .../klibc/files/CVE-2021-31870.patch | 45 +++++++++++++++++++ .../recipes-devtools/klibc/klibc.inc | 1 + 2 files changed, 46 insertions(+) create mode 100644 meta-initramfs/recipes-devtools/klibc/files/CVE-2021-31870.patch
meta-initramfs/recipes-devtools/klibc/files/CVE-2021-31870.patch new file +45 -0
@@ -0,0 +1,45 @@ +From 15c0e066ac8a75bdb3189dd5d77dc0f3539afefd Mon Sep 17 00:00:00 2001 +From: Ben Hutchings <[email protected]> +Date: Wed, 28 Apr 2021 04:29:50 +0200 +Subject: [PATCH] calloc: Fail if multiplication overflows + +calloc() multiplies its 2 arguments together and passes the result to +malloc(). Since the factors and product both have type size_t, this +can result in an integer overflow and subsequent buffer overflow. +Check for this and fail if it happens. + +CVE-2021-31870 + +CVE: CVE-2021-31870 +Upstream-Status: Backport [https://git.kernel.org/pub/scm/libs/klibc/klibc.git/commit/?id=292650f04c2b5348b4efbad61fb014ed09b4f3f2] + +Signed-off-by: Ben Hutchings <[email protected]> +--- + usr/klibc/calloc.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/usr/klibc/calloc.c b/usr/klibc/calloc.c +index 53dcc6b..4a81cda 100644 +--- a/usr/klibc/calloc.c ++++ b/usr/klibc/calloc.c +@@ -2,12 +2,17 @@ + * calloc.c + */ + ++#include <errno.h> + #include <stdlib.h> + #include <string.h> + +-/* FIXME: This should look for multiplication overflow */ +- + void *calloc(size_t nmemb, size_t size) + { +- return zalloc(nmemb * size); ++ unsigned long prod; ++ ++ if (__builtin_umull_overflow(nmemb, size, &prod)) { ++ errno = ENOMEM; ++ return NULL; ++ } ++ return zalloc(prod); + }
meta-initramfs/recipes-devtools/klibc/klibc.inc +1 -0
@@ -21,6 +21,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/libs/klibc/2.0/klibc-${PV}.tar.xz \ file://0001-klibc-Kbuild-Accept-EXTRA_KLIBCAFLAGS.patch \ file://cross-clang.patch \ file://0001-workaround-for-overlapping-sections-in-binary.patch \ + file://CVE-2021-31870.patch \ " ARMPATCHES ?= ""
PATCH 2/10 klibc: patch CVE-2021-31871
Details: https://nvd.nist.gov/vuln/detail/CVE-2021-31871
Pick the patch mentioned in the nvd report.
--- .../klibc/files/CVE-2021-31871.patch | 34 +++++++++++++++++++ .../recipes-devtools/klibc/klibc.inc | 1 + 2 files changed, 35 insertions(+) create mode 100644 meta-initramfs/recipes-devtools/klibc/files/CVE-2021-31871.patch
meta-initramfs/recipes-devtools/klibc/files/CVE-2021-31871.patch new file +34 -0
@@ -0,0 +1,34 @@ +From db29a01c413fcaaa1095284dfe31582e97d35679 Mon Sep 17 00:00:00 2001 +From: Ben Hutchings <[email protected]> +Date: Wed, 28 Apr 2021 19:46:47 +0200 +Subject: [PATCH] cpio: Fix possible crash on 64-bit systems + +copyin_link() tries to allocate (unsigned int)c_filesize + 1 bytes. +If c_filesize == UINT_MAX, this works out as 0 bytes, resulting in a +null pointer and a subsequent SIGSEGV. + +The previous commit made this impossible on 32-bit systems. + +CVE-2021-31871 + +CVE: CVE-2021-31871 +Upstream-Status: Backport [https://git.kernel.org/pub/scm/libs/klibc/klibc.git/commit/?id=2e48a12ab1e30d43498c2d53e878a11a1b5102d5] + +Signed-off-by: Ben Hutchings <[email protected]> +--- + usr/utils/cpio.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/usr/utils/cpio.c b/usr/utils/cpio.c +index cb61679..a13c876 100644 +--- a/usr/utils/cpio.c ++++ b/usr/utils/cpio.c +@@ -831,7 +831,7 @@ static void copyin_link(struct new_cpio_header *file_hdr, int in_file_des) + char *link_name = NULL; /* Name of hard and symbolic links. */ + int res; /* Result of various function calls. */ + +- link_name = (char *)xmalloc((unsigned int)file_hdr->c_filesize + 1); ++ link_name = (char *)xmalloc(file_hdr->c_filesize + 1); + link_name[file_hdr->c_filesize] = '\0'; + tape_buffered_read(link_name, in_file_des, file_hdr->c_filesize); + tape_skip_padding(in_file_des, file_hdr->c_filesize);
meta-initramfs/recipes-devtools/klibc/klibc.inc +1 -0
@@ -22,6 +22,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/libs/klibc/2.0/klibc-${PV}.tar.xz \ file://cross-clang.patch \ file://0001-workaround-for-overlapping-sections-in-binary.patch \ file://CVE-2021-31870.patch \ + file://CVE-2021-31871.patch \ " ARMPATCHES ?= ""
PATCH 3/10 klibc: patch CVE-2021-31872
In reply to Gyorgy SarvariDetails: https://nvd.nist.gov/vuln/detail/CVE-2021-31872
Pick the patch mentioned by the nvd report.
--- .../klibc/files/CVE-2021-31872.patch | 70 +++++++++++++++++++ .../recipes-devtools/klibc/klibc.inc | 1 + 2 files changed, 71 insertions(+) create mode 100644 meta-initramfs/recipes-devtools/klibc/files/CVE-2021-31872.patch
meta-initramfs/recipes-devtools/klibc/files/CVE-2021-31872.patch new file +70 -0
@@ -0,0 +1,70 @@ +From 5e8b9d0c9cef6194b3588b12f04afd617de3587d Mon Sep 17 00:00:00 2001 +From: Ben Hutchings <[email protected]> +Date: Wed, 28 Apr 2021 05:16:34 +0200 +Subject: [PATCH] cpio: Fix possible integer overflow on 32-bit systems + +The maximum name and file sizes in the "new" header format are 32-bit +unsigned values. However, the I/O functions mostly use long for sizes +and offsets, so that sizes >= 2^31 are handled wrongly on 32-bit +systems. + +The current GNU cpio code doesn't seem to have this problem, but the +divergence between this version and that is large enough that I can't +simply cherry-pick a fix for it. + +As a short-term fix, in read_in_new_ascii(), fail if c_namesize or +c_filesize is > LONG_MAX. + +CVE-2021-31872 + +CVE: CVE-2021-31872 +Upstream-Status: Backport [https://git.kernel.org/pub/scm/libs/klibc/klibc.git/commit/?id=9b1c91577aef7f2e72c3aa11a27749160bd278ff] + +Signed-off-by: Ben Hutchings <[email protected]> +--- + usr/utils/cpio.c | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/usr/utils/cpio.c b/usr/utils/cpio.c +index a13c876..9b0b6ae 100644 +--- a/usr/utils/cpio.c ++++ b/usr/utils/cpio.c +@@ -17,6 +17,7 @@ + + #include <errno.h> + #include <fcntl.h> ++#include <limits.h> + #include <malloc.h> + #include <stdbool.h> + #include <stdio.h> +@@ -904,6 +905,15 @@ static void read_in_new_ascii(struct new_cpio_header *file_hdr, int in_des) + file_hdr->c_hdr[i] = strtoul(hexbuf, NULL, 16); + ah += 8; + } ++ ++ /* Sizes > LONG_MAX can currently result in integer overflow ++ in various places. Fail if name is too large. */ ++ if (file_hdr->c_namesize > LONG_MAX) { ++ fprintf(stderr, "%s: name size out of range\n", ++ progname); ++ exit(1); ++ } ++ + /* Read file name from input. */ + free(file_hdr->c_name); + file_hdr->c_name = (char *)xmalloc(file_hdr->c_namesize); +@@ -914,6 +924,14 @@ static void read_in_new_ascii(struct new_cpio_header *file_hdr, int in_des) + is rounded up to the next long-word, so we might need to drop + 1-3 bytes. */ + tape_skip_padding(in_des, file_hdr->c_namesize + 110); ++ ++ /* Fail if file is too large. We could check this earlier ++ but it's helpful to report the name. */ ++ if (file_hdr->c_filesize > LONG_MAX) { ++ fprintf(stderr, "%s: %s: file size out of range\n", ++ progname, file_hdr->c_name); ++ exit(1); ++ } + } + + /* Return 16-bit integer I with the bytes swapped. */
meta-initramfs/recipes-devtools/klibc/klibc.inc +1 -0
@@ -23,6 +23,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/libs/klibc/2.0/klibc-${PV}.tar.xz \ file://0001-workaround-for-overlapping-sections-in-binary.patch \ file://CVE-2021-31870.patch \ file://CVE-2021-31871.patch \ + file://CVE-2021-31872.patch \ " ARMPATCHES ?= ""
PATCH 4/10 klibc: patch CVE-2021-31873
In reply to Gyorgy SarvariDetails: https://nvd.nist.gov/vuln/detail/CVE-2021-31873
Pick the patch mentioned by the nvd report.
--- .../klibc/files/CVE-2021-31873.patch | 43 +++++++++++++++++++ .../recipes-devtools/klibc/klibc.inc | 1 + 2 files changed, 44 insertions(+) create mode 100644 meta-initramfs/recipes-devtools/klibc/files/CVE-2021-31873.patch
meta-initramfs/recipes-devtools/klibc/files/CVE-2021-31873.patch new file +43 -0
@@ -0,0 +1,43 @@ +From 34f6170eca948ad221effc79db1f38c51e20329f Mon Sep 17 00:00:00 2001 +From: Ben Hutchings <[email protected]> +Date: Wed, 28 Apr 2021 04:03:49 +0200 +Subject: [PATCH] malloc: Fail if requested size > PTRDIFF_MAX + +malloc() adds some overhead to the requested size, which may result in +an integer overflow and subsequent buffer overflow if it is close to +SIZE_MAX. It should fail if size is large enough for this to happen. + +Further, it's not legal for a C object to be larger than +PTRDIFF_MAX (half of SIZE_MAX) as pointer arithmetic within it could +overflow. So return failure immediately if size is greater than that. + +CVE-2021-31873 + +CVE: CVE-2021-31873 +Upstream-Status: Backport [https://git.kernel.org/pub/scm/libs/klibc/klibc.git/commit/?id=a31ae8c508fc8d1bca4f57e9f9f88127572d5202] + +Signed-off-by: Ben Hutchings <[email protected]> +--- + usr/klibc/malloc.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/usr/klibc/malloc.c b/usr/klibc/malloc.c +index 413b733..14bfa63 100644 +--- a/usr/klibc/malloc.c ++++ b/usr/klibc/malloc.c +@@ -146,6 +146,15 @@ void *malloc(size_t size) + if (size == 0) + return NULL; + ++ /* Various additions below will overflow if size is close to ++ SIZE_MAX. Further, it's not legal for a C object to be ++ larger than PTRDIFF_MAX (half of SIZE_MAX) as pointer ++ arithmetic within it could overflow. */ ++ if (size > PTRDIFF_MAX) { ++ errno = ENOMEM; ++ return NULL; ++ } ++ + /* Add the obligatory arena header, and round up */ + size = (size + 2 * sizeof(struct arena_header) - 1) & ARENA_SIZE_MASK; +
meta-initramfs/recipes-devtools/klibc/klibc.inc +1 -0
@@ -24,6 +24,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/libs/klibc/2.0/klibc-${PV}.tar.xz \ file://CVE-2021-31870.patch \ file://CVE-2021-31871.patch \ file://CVE-2021-31872.patch \ + file://CVE-2021-31873.patch \ " ARMPATCHES ?= ""
PATCH 5/10 evince: Update status for CVE-2011-0433 and CVE-2011-5244
In reply to Gyorgy SarvariFrom: Alexandre Truong <[email protected]>
The current version 46.0 is not affected by the issues. Both issues have been fixed in commit [0].
The fix is in effect since early versions of evince (3.1.2). Thus, both can be safely ignored.
[0]: https://gitlab.gnome.org/GNOME/evince/-/commit/efadec4ffcdde3373f6f4ca0eaac98dc963c4fd5
Reworked for Kirkstone (CVE_STATUS -> CVE_CHECK_IGNORE)
--- meta-gnome/recipes-gnome/evince/evince_42.3.bb | 4 ++++ 1 file changed, 4 insertions(+)
meta-gnome/recipes-gnome/evince/evince_42.3.bb +4 -0
@@ -51,3 +51,7 @@ FILES:${PN} += "${datadir}/dbus-1 \ ${datadir}/thumbnailers \ " FILES:${PN}-nautilus-extension = "${libdir}/nautilus/*/*so" + +CVE_PRODUCT = "evince" +# fixed-version: No action required. The current version (42.3) is not affected by the CVE which has been patched since version 3.1.2 +CVE_CHECK_IGNORE += "CVE-2021-0433 CVE-2011-5244"
PATCH 6/10 gattlib: ignore CVE-2019-6498
In reply to Gyorgy SarvariDetails: https://nvd.nist.gov/vuln/detail/CVE-2019-6498
The used revision already contains the fix.
--- meta-oe/recipes-connectivity/gattlib/gattlib_git.bb | 3 +++ 1 file changed, 3 insertions(+)
meta-oe/recipes-connectivity/gattlib/gattlib_git.bb +3 -0
@@ -30,3 +30,6 @@ inherit pkgconfig cmake FILES:${PN} = "${libdir}/*" FILES:${PN}-dev = "${includedir}/* ${libdir}/pkgconfig" + +# The used revision contains the fix +CVE_CHECK_IGNORE += "CVE-2019-6498"
PATCH 7/10 id3lib: mark CVE-2007-4460 as fixed
In reply to Gyorgy SarvariFrom: Peter Marko <[email protected]>
This is fixed in id3lib3.8.3_3.8.3-16.2.debian.tar.xz patch included in SRC_URI.
Version 3.8.3-7 contains patch for this CVE, we use 3.8.3-16.2. This can be verified by checking the debian/changelog within this patch or diffing [1] and [2] and verifying that this can be reverse-applied.
[1] https://snapshot.debian.org/archive/debian/20070819T000000Z/pool/main/i/id3lib3.8.3/id3lib3.8.3_3.8.3-6.diff.gz
[2] https://snapshot.debian.org/archive/debian/20070819T000000Z/pool/main/i/id3lib3.8.3/id3lib3.8.3_3.8.3-7.diff.gz
Adapted to Kirkstone (CVE_STATUS -> CVE_CHECK_IGNORE)
--- meta-oe/recipes-multimedia/id3lib/id3lib_3.8.3.bb | 3 +++ 1 file changed, 3 insertions(+)
meta-oe/recipes-multimedia/id3lib/id3lib_3.8.3.bb +3 -0
@@ -15,6 +15,9 @@ SRC_URI[archive.sha256sum] = "2749cc3c0cd7280b299518b1ddf5a5bcfe2d1100614519b687 SRC_URI[patch.md5sum] = "997c764d3be11c9a51779d93facf1118" SRC_URI[patch.sha256sum] = "ac2ee23ec89ba2af51d2c6dd5b1b6bf9f8a9f813de251bc182941439a4053176" +#patched: fix is included in debian patch +CVE_CHECK_IGNORE += "CVE-2007-4460" + inherit autotools # Unlike other Debian packages, id3lib*.diff.gz contains another series of
PATCH 8/10 influxdb: Update CVE status for CVE-2019-10329
In reply to Gyorgy SarvariFrom: Ninette Adhikari <[email protected]>
The version don't match and only the Jenkins plugin is affected.
Adapted to Kirkstone (CVE_STATUS -> CVE_CHECK_IGNORE))
--- meta-oe/recipes-dbs/influxdb/influxdb_1.8.10.bb | 3 +++ 1 file changed, 3 insertions(+)
meta-oe/recipes-dbs/influxdb/influxdb_1.8.10.bb +3 -0
@@ -68,3 +68,6 @@ INITSCRIPT_NAME = "influxdb" INITSCRIPT_PARAMS = "defaults" SYSTEMD_SERVICE:${PN} = "influxdb.service" + +#cpe-incorrect: Version does not match and only the Jenkins plugin is affected. +CVE_CHECK_IGNORE += "CVE-2019-10329"
PATCH 9/10 iptraf-ng: patch CVE-2024-52949
In reply to Gyorgy SarvariDetails: https://nvd.nist.gov/vuln/detail/CVE-2024-52949
Pick the commit that mentions the CVE in its description.
--- .../iptraf/iptraf-ng/CVE-2024-52949.patch | 218 ++++++++++++++++++ .../iptraf/iptraf-ng_1.2.1.bb | 1 + 2 files changed, 219 insertions(+) create mode 100644 meta-oe/recipes-devtools/iptraf/iptraf-ng/CVE-2024-52949.patch
meta-oe/recipes-devtools/iptraf/iptraf-ng/CVE-2024-52949.patch new file +218 -0
@@ -0,0 +1,218 @@ +From 6a35a7f68c2dd946c5092376d71bbf0b925e2c4e Mon Sep 17 00:00:00 2001 +From: Vitezslav Samel <[email protected]> +Date: Thu, 21 Nov 2024 08:43:57 +0100 +Subject: [PATCH] interface names: limit length to IFNAMSIZ + +This fixes CVE-2024-52949 (stack based buffer overflow) +when copying user supplied interface name without any +check. + +Problem was reported by Massimiliano Ferraresi and Massimiliano Brolli +from TIM Red team (https://www.gruppotim.it/it/footer/red-team.html) + +CVE: CVE-2024-52949 +Upstream-Status: Backport [https://github.com/iptraf-ng/iptraf-ng/commit/2b623e991115358a57275af8a53feb5ae707b3ae] + +Reported-by: Massimiliano Ferraresi, Massimiliano Brolli +Signed-off-by: Vitezslav Samel <[email protected]> +--- + src/ifaces.c | 16 ++++++++-------- + src/ifstats.c | 6 +++--- + src/iptraf-ng-compat.h | 1 + + src/iptraf.c | 9 +++++++++ + src/othptab.c | 2 +- + src/promisc.c | 2 +- + src/tcptable.c | 4 ++-- + src/wrapper.c | 8 ++++++++ + 8 files changed, 33 insertions(+), 15 deletions(-) + +diff --git a/src/ifaces.c b/src/ifaces.c +index aeb1614..4c5a545 100644 +--- a/src/ifaces.c ++++ b/src/ifaces.c +@@ -67,7 +67,7 @@ int dev_up(char *iface) + + fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); + +- strcpy(ifr.ifr_name, iface); ++ ifname_copy(ifr.ifr_name, iface); + ir = ioctl(fd, SIOCGIFFLAGS, &ifr); + + close(fd); +@@ -90,7 +90,7 @@ int dev_get_ifindex(const char *iface) + return fd; + + struct ifreq ifr; +- strcpy(ifr.ifr_name, iface); ++ ifname_copy(ifr.ifr_name, iface); + int ir = ioctl(fd, SIOCGIFINDEX, &ifr); + + /* need to preserve errno across call to close() */ +@@ -114,7 +114,7 @@ int dev_get_mtu(const char *iface) + return fd; + + struct ifreq ifr; +- strcpy(ifr.ifr_name, iface); ++ ifname_copy(ifr.ifr_name, iface); + int ir = ioctl(fd, SIOCGIFMTU, &ifr); + + /* need to preserve errno across call to close() */ +@@ -138,7 +138,7 @@ int dev_get_flags(const char *iface) + return fd; + + struct ifreq ifr; +- strcpy(ifr.ifr_name, iface); ++ ifname_copy(ifr.ifr_name, iface); + int ir = ioctl(fd, SIOCGIFFLAGS, &ifr); + + /* need to preserve errno across call to close() */ +@@ -162,7 +162,7 @@ int dev_set_flags(const char *iface, int flags) + return fd; + + struct ifreq ifr; +- strcpy(ifr.ifr_name, iface); ++ ifname_copy(ifr.ifr_name, iface); + int ir = ioctl(fd, SIOCGIFFLAGS, &ifr); + if (ir == -1) + goto err; +@@ -190,7 +190,7 @@ int dev_clear_flags(const char *iface, int flags) + return fd; + + struct ifreq ifr; +- strcpy(ifr.ifr_name, iface); ++ ifname_copy(ifr.ifr_name, iface); + int ir = ioctl(fd, SIOCGIFFLAGS, &ifr); + if (ir == -1) + goto err; +@@ -233,7 +233,7 @@ int dev_get_ifname(int ifindex, char *ifname) + return ir; + } + +- strncpy(ifname, ifr.ifr_name, IFNAMSIZ); ++ ifname_copy(ifname, ifr.ifr_name); + return ir; + } + +@@ -256,7 +256,7 @@ int dev_bind_ifname(int fd, const char * const ifname) + int ir; + struct ifreq ifr; + +- strcpy(ifr.ifr_name, ifname); ++ ifname_copy(ifr.ifr_name, ifname); + ir = ioctl(fd, SIOCGIFINDEX, &ifr); + if (ir) + return ir; +diff --git a/src/ifstats.c b/src/ifstats.c +index 00a2a3f..1b687b6 100644 +--- a/src/ifstats.c ++++ b/src/ifstats.c +@@ -194,7 +194,7 @@ static void initiflist(struct iflist **list) + + struct iflist *itmp = alloc_iflist_entry(); + itmp->ifindex = ifindex; +- strcpy(itmp->ifname, ifname); ++ ifname_copy(itmp->ifname, ifname); + + /* make the linked list sorted by ifindex */ + struct iflist *cur = *list, *last = NULL; +@@ -714,9 +714,9 @@ void selectiface(char *ifname, int withall, int *aborted) + if (!(*aborted) && (list != NULL)) { + ptmp = (struct iflist *) scrolllist.textptr->nodeptr; + if ((withall) && (ptmp->prev_entry == NULL)) /* All Interfaces */ +- strcpy(ifname, ""); ++ ifname_copy(ifname, ""); + else +- strcpy(ifname, ptmp->ifname); ++ ifname_copy(ifname, ptmp->ifname); + } + + tx_destroy_list(&scrolllist); +diff --git a/src/iptraf-ng-compat.h b/src/iptraf-ng-compat.h +index 5aec185..845f18b 100644 +--- a/src/iptraf-ng-compat.h ++++ b/src/iptraf-ng-compat.h +@@ -112,6 +112,7 @@ extern void *xmallocz(size_t size); + extern char *xstrdup(const char *s); + extern int strtoul_ui(char const *s, int base, unsigned int *result); + extern int strtol_i(char const *s, int base, int *result); ++extern void ifname_copy(char *dst, const char *src); + + extern void die(const char *err, ...) __noreturn __printf(1,2); + extern void die_errno(const char *fmt, ...) __noreturn __printf(1,2); +diff --git a/src/iptraf.c b/src/iptraf.c +index 95f8e53..e5dcb64 100644 +--- a/src/iptraf.c ++++ b/src/iptraf.c +@@ -388,6 +388,15 @@ int main(int argc, char **argv) + if (__builtin_popcount(command) > 1) + die("only one of -i|-d|-s|-z|-l|-g options must be used"); + ++ /* sanity check of passed arguments */ ++ if ((i_opt && strlen(i_opt) >= IFNAMSIZ) || ++ (d_opt && strlen(d_opt) >= IFNAMSIZ) || ++ (s_opt && strlen(s_opt) >= IFNAMSIZ) || ++ (z_opt && strlen(z_opt) >= IFNAMSIZ) || ++ (l_opt && strlen(l_opt) >= IFNAMSIZ)) { ++ die("interface name is too long"); ++ } ++ + strcpy(current_logfile, ""); + + if (f_opt) { +diff --git a/src/othptab.c b/src/othptab.c +index d1d9658..80f3dc8 100644 +--- a/src/othptab.c ++++ b/src/othptab.c +@@ -271,7 +271,7 @@ struct othptabent *add_othp_entry(struct othptable *table, struct pkt_hdr *pkt, + } + + new_entry->protocol = protocol; +- strcpy(new_entry->iface, ifname); ++ ifname_copy(new_entry->iface, ifname); + + new_entry->pkt_length = pkt->pkt_len; + +diff --git a/src/promisc.c b/src/promisc.c +index d94e8bb..4737962 100644 +--- a/src/promisc.c ++++ b/src/promisc.c +@@ -70,7 +70,7 @@ static void promisc_enable_dev(struct list_head *promisc, int sock, const char * + struct promisc_list *new = xmallocz(sizeof(*new)); + + new->ifindex = ifindex; +- strcpy(new->ifname, dev); ++ ifname_copy(new->ifname, dev); + list_add_tail(&new->list, promisc); + } + +diff --git a/src/tcptable.c b/src/tcptable.c +index 159d628..2c4efc1 100644 +--- a/src/tcptable.c ++++ b/src/tcptable.c +@@ -365,8 +365,8 @@ struct tcptableent *addentry(struct tcptable *table, + * Store interface name + */ + +- strcpy(new_entry->ifname, ifname); +- strcpy(new_entry->oth_connection->ifname, ifname); ++ ifname_copy(new_entry->ifname, ifname); ++ ifname_copy(new_entry->oth_connection->ifname, ifname); + + /* + * Zero out MAC address fields +diff --git a/src/wrapper.c b/src/wrapper.c +index 2eb3b59..1d2dc6f 100644 +--- a/src/wrapper.c ++++ b/src/wrapper.c +@@ -78,3 +78,11 @@ int strtol_i(char const *s, int base, int *result) + *result = ul; + return 0; + } ++ ++/* it's up to the caller to ensure there is room for */ ++/* at least IFNAMSIZ bytes in dst */ ++void ifname_copy(char *dst, const char *src) ++{ ++ strncpy(dst, src, IFNAMSIZ - 1); ++ dst[IFNAMSIZ - 1] = '\0'; ++}
meta-oe/recipes-devtools/iptraf/iptraf-ng_1.2.1.bb +1 -0
@@ -28,6 +28,7 @@ SRC_URI = "https://src.fedoraproject.org/repo/pkgs/iptraf-ng/v${PV}.tar.gz/sha51 file://iptraf-ng-tmpfiles.conf \ file://ncurses-config.patch \ file://0001-make-Make-CC-weak-assignment.patch \ + file://CVE-2024-52949.patch \ " SRC_URI[sha256sum] = "9f5cef584065420dea1ba32c86126aede1fa9bd25b0f8362b0f9fd9754f00870"
PATCH 10/10 keepalived: patch CVE-2021-44225
In reply to Gyorgy SarvariDetails: https://nvd.nist.gov/vuln/detail/CVE-2021-44225
Pick patch mentioned in the nvd report.
--- .../keepalived/CVE-2021-44225.patch | 41 +++++++++++++++++++ .../keepalived/keepalived_2.2.2.bb | 1 + 2 files changed, 42 insertions(+) create mode 100644 meta-networking/recipes-daemons/keepalived/keepalived/CVE-2021-44225.patch
meta-networking/recipes-daemons/keepalived/keepalived/CVE-2021-44225.patch new file +41 -0
@@ -0,0 +1,41 @@ +From 585788ee03bfe204a2a796a5f096a499a02c65db Mon Sep 17 00:00:00 2001 +From: Vincent Bernat <[email protected]> +Date: Tue, 23 Nov 2021 06:50:59 +0100 +Subject: [PATCH] dbus: fix policy to not be overly broad + +The DBus policy did not restrict the message destination, allowing any +user to inspect and manipulate any property. + +CVE: CVE-2021-44225 +Upstream-Status: Backport [https://github.com/acassen/keepalived/commit/7977fec0be89ae6fe87405b3f8da2f0b5e415e3d] + +Signed-off-by: Vincent Bernat <[email protected]> +--- + keepalived/dbus/org.keepalived.Vrrp1.conf | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/keepalived/dbus/org.keepalived.Vrrp1.conf b/keepalived/dbus/org.keepalived.Vrrp1.conf +index 2b78a57..b5ced60 100644 +--- a/keepalived/dbus/org.keepalived.Vrrp1.conf ++++ b/keepalived/dbus/org.keepalived.Vrrp1.conf +@@ -3,12 +3,15 @@ + "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> + <busconfig> + <policy user="root"> +- <allow own="org.keepalived.Vrrp1"/> +- <allow send_destination="org.keepalived.Vrrp1"/> ++ <allow own="org.keepalived.Vrrp1" /> ++ <allow send_destination="org.keepalived.Vrrp1" /> + </policy> + <policy context="default"> +- <allow send_interface="org.freedesktop.DBus.Introspectable" /> +- <allow send_interface="org.freedesktop.DBus.Peer" /> +- <allow send_interface="org.freedesktop.DBus.Properties" /> ++ <allow send_destination="org.keepalived.Vrrp1" ++ send_interface="org.freedesktop.DBus.Introspectable" /> ++ <allow send_destination="org.keepalived.Vrrp1" ++ send_interface="org.freedesktop.DBus.Peer" /> ++ <allow send_destination="org.keepalived.Vrrp1" ++ send_interface="org.freedesktop.DBus.Properties" /> + </policy> + </busconfig>
meta-networking/recipes-daemons/keepalived/keepalived_2.2.2.bb +1 -0
@@ -12,6 +12,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" SRC_URI = "http://www.keepalived.org/software/${BP}.tar.gz \ file://0001-layer4-Change-order-of-include-files.patch \ + file://CVE-2021-44225.patch \ " SRC_URI[sha256sum] = "103692bd5345a4ed9f4581632ea636214fdf53e45682e200aab122c4fa674ece" UPSTREAM_CHECK_URI = "https://github.com/acassen/keepalived/releases"