libconfuse: patch CVE-2022-40320
PATCH 1/2 libconfuse: patch CVE-2022-40320
Details: https://nvd.nist.gov/vuln/detail/CVE-2022-40320
Pick the patch that was marked to resolve the github bug in the NVD advisory.
Signed-off-by Gyorgy Sarvari <[email protected]>
--- .../libconfuse/CVE-2022-40320.patch | 40 +++++++++++++++++++ .../libconfuse/libconfuse_3.3.bb | 4 +- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 meta-networking/recipes-support/libconfuse/libconfuse/CVE-2022-40320.patch
meta-networking/recipes-support/libconfuse/libconfuse/CVE-2022-40320.patch new file +40 -0
@@ -0,0 +1,40 @@ +From ee3769c0bb797e648dd16997148aad135283e829 Mon Sep 17 00:00:00 2001 +From: Joachim Wiberg <[email protected]> +Date: Fri, 2 Sep 2022 16:12:46 +0200 +Subject: [PATCH] Fix #163: unterminated username used with getpwnam() + +Signed-off-by: Joachim Wiberg <[email protected]> + +CVE: CVE-2022-40320 +Upstream-Status: Backport [https://github.com/libconfuse/libconfuse/commit/d73777c2c3566fb2647727bb56d9a2295b81669b] +Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + src/confuse.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/src/confuse.c b/src/confuse.c +index ce4fca8..18dbccf 100644 +--- a/src/confuse.c ++++ b/src/confuse.c +@@ -1865,16 +1865,19 @@ DLLIMPORT char *cfg_tilde_expand(const char *filename) + } else { + /* ~user or ~user/path */ + char *user; ++ size_t len; + + file = strchr(filename, '/'); + if (file == 0) + file = filename + strlen(filename); + +- user = malloc(file - filename); ++ len = file - filename - 1; ++ user = malloc(len + 1); + if (!user) + return NULL; + +- strncpy(user, filename + 1, file - filename - 1); ++ strncpy(user, &filename[1], len); ++ user[len] = 0; + passwd = getpwnam(user); + free(user); + }
meta-networking/recipes-support/libconfuse/libconfuse_3.3.bb +3 -1
@@ -3,7 +3,9 @@ LICENSE = "ISC" LIC_FILES_CHKSUM = "file://LICENSE;md5=42fa47330d4051cd219f7d99d023de3a" SRCREV = "a42aebf13db33afd575da6e63f55163d371f776d" -SRC_URI = "git://github.com/libconfuse/libconfuse.git;branch=master;protocol=https" +SRC_URI = "git://github.com/libconfuse/libconfuse.git;branch=master;protocol=https \ + file://CVE-2022-40320.patch \ + " inherit autotools-brokensep pkgconfig gettext
PATCH 2/2 keepalived: patch CVE-2024-41184
Details: https://nvd.nist.gov/vuln/detail/CVE-2024-41184
Backport the patches referenced by upstream in the bug mentioned by the NVD advisory.
Signed-off-by Gyorgy Sarvari <[email protected]>
--- .../keepalived/CVE-2024-41184-1.patch | 100 ++++++++++++++++++ .../keepalived/CVE-2024-41184-2.patch | 88 +++++++++++++++ .../keepalived/CVE-2024-41184-3.patch | 94 ++++++++++++++++ .../keepalived/CVE-2024-41184-4.patch | 33 ++++++ .../keepalived/keepalived_2.2.2.bb | 4 + 5 files changed, 319 insertions(+) create mode 100644 meta-networking/recipes-daemons/keepalived/keepalived/CVE-2024-41184-1.patch create mode 100644 meta-networking/recipes-daemons/keepalived/keepalived/CVE-2024-41184-2.patch create mode 100644 meta-networking/recipes-daemons/keepalived/keepalived/CVE-2024-41184-3.patch create mode 100644 meta-networking/recipes-daemons/keepalived/keepalived/CVE-2024-41184-4.patch
meta-networking/recipes-daemons/keepalived/keepalived/CVE-2024-41184-1.patch new file +100 -0
@@ -0,0 +1,100 @@ +From b7e7e83e92812707669aa92a41f301366bfbd114 Mon Sep 17 00:00:00 2001 +From: Quentin Armitage <[email protected]> +Date: Fri, 12 Jul 2024 15:16:47 +0100 +Subject: [PATCH] vrrp: Handle empty ipset names with vrrp_ipsets keyword + +We now handle empty ipset names and return a config error. + +Signed-off-by: Quentin Armitage <[email protected]> + +CVE: CVE-2024-41184 +Upstream-Status: Backport [https://github.com/acassen/keepalived/commit/e78513fe0ce5d83c226ea2c0bd222f375c2438e7] +Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + keepalived/core/global_parser.c | 37 ++++++++++++++++++++------------- + 1 file changed, 22 insertions(+), 15 deletions(-) + +diff --git a/keepalived/core/global_parser.c b/keepalived/core/global_parser.c +index 2b8a80d..e273b74 100644 +--- a/keepalived/core/global_parser.c ++++ b/keepalived/core/global_parser.c +@@ -1008,6 +1008,22 @@ vrrp_iptables_handler(const vector_t *strvec) + } + } + #ifdef _HAVE_LIBIPSET_ ++static bool ++check_valid_ipset_name(const vector_t *strvec, unsigned entry, const char *log_name) ++{ ++ if (strlen(strvec_slot(strvec, entry)) >= IPSET_MAXNAMELEN - 1) { ++ report_config_error(CONFIG_GENERAL_ERROR, "VRRP Error : ipset %s name too long - ignored", log_name); ++ return false; ++ } ++ ++ if (strlen(strvec_slot(strvec, entry)) == 0) { ++ report_config_error(CONFIG_GENERAL_ERROR, "VRRP Error : ipset %s name empty - ignored", log_name); ++ return false; ++ } ++ ++ return true; ++} ++ + static void + vrrp_ipsets_handler(const vector_t *strvec) + { +@@ -1025,17 +1041,14 @@ vrrp_ipsets_handler(const vector_t *strvec) + return; + } + +- if (strlen(strvec_slot(strvec,1)) >= IPSET_MAXNAMELEN - 1) { +- report_config_error(CONFIG_GENERAL_ERROR, "VRRP Error : ipset address name too long - ignored"); ++ if (!check_valid_ipset_name(strvec, 1, "address")) + return; +- } ++ + global_data->vrrp_ipset_address = STRDUP(strvec_slot(strvec,1)); + + if (vector_size(strvec) >= 3) { +- if (strlen(strvec_slot(strvec,2)) >= IPSET_MAXNAMELEN - 1) { +- report_config_error(CONFIG_GENERAL_ERROR, "VRRP Error : ipset IPv6 address name too long - ignored"); ++ if (!check_valid_ipset_name(strvec, 2, "IPv6 address")) + return; +- } + global_data->vrrp_ipset_address6 = STRDUP(strvec_slot(strvec,2)); + } + else { +@@ -1046,10 +1059,8 @@ vrrp_ipsets_handler(const vector_t *strvec) + global_data->vrrp_ipset_address6 = STRDUP(set_name); + } + if (vector_size(strvec) >= 4) { +- if (strlen(strvec_slot(strvec,3)) >= IPSET_MAXNAMELEN - 1) { +- report_config_error(CONFIG_GENERAL_ERROR, "VRRP Error : ipset IPv6 address_iface name too long - ignored"); ++ if (!check_valid_ipset_name(strvec, 3, "IPv6 address_iface")) + return; +- } + global_data->vrrp_ipset_address_iface6 = STRDUP(strvec_slot(strvec,3)); + } + else { +@@ -1064,10 +1075,8 @@ vrrp_ipsets_handler(const vector_t *strvec) + } + + if (vector_size(strvec) >= 5) { +- if (strlen(strvec_slot(strvec,4)) >= IPSET_MAXNAMELEN - 1) { +- report_config_error(CONFIG_GENERAL_ERROR, "VRRP Error : ipset IGMP name too long - ignored"); ++ if (!check_valid_ipset_name(strvec, 4, "IGMP")) + return; +- } + global_data->vrrp_ipset_igmp = STRDUP(strvec_slot(strvec,4)); + } + else { +@@ -1078,10 +1087,8 @@ vrrp_ipsets_handler(const vector_t *strvec) + global_data->vrrp_ipset_igmp = STRDUP(set_name); + } + if (vector_size(strvec) >= 6) { +- if (strlen(strvec_slot(strvec,5)) >= IPSET_MAXNAMELEN - 1) { +- report_config_error(CONFIG_GENERAL_ERROR, "VRRP Error : ipset MLD name too long - ignored"); ++ if (!check_valid_ipset_name(strvec, 5, "MLD")) + return; +- } + global_data->vrrp_ipset_mld = STRDUP(strvec_slot(strvec,5)); + } + else {
meta-networking/recipes-daemons/keepalived/keepalived/CVE-2024-41184-2.patch new file +88 -0
88 lines not on this page · raw message
meta-networking/recipes-daemons/keepalived/keepalived/CVE-2024-41184-3.patch new file +94 -0
94 lines not on this page · raw message
meta-networking/recipes-daemons/keepalived/keepalived/CVE-2024-41184-4.patch new file +33 -0
@@ -0,0 +1,33 @@ +From 67174a59068633ada8f77756d56399a53794224e Mon Sep 17 00:00:00 2001 +From: Quentin Armitage <[email protected]> +Date: Fri, 12 Jul 2024 15:11:13 +0100 +Subject: [PATCH] lib: don't return subtracted addresses for rb_find() compare + function + +If sizeof(int) < sizeof(void *) returning the difference between two +addresses in an int can cause an overflow. + +Use less_equal_greater_than() for comparing addresses. + +Signed-off-by: Quentin Armitage <[email protected]> + +CVE: CVE-2024-41184 +Upstream-Status: Backport [https://github.com/acassen/keepalived/commit/f3a32e3557520dccb298b36b4952eff3e236fb86] +Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + lib/memory.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/memory.c b/lib/memory.c +index 78ca675..46d7172 100644 +--- a/lib/memory.c ++++ b/lib/memory.c +@@ -185,7 +185,7 @@ static FILE *log_op = NULL; + static inline int + memcheck_ptr_cmp(const MEMCHECK *m1, const MEMCHECK *m2) + { +- return (char *)m1->ptr - (char *)m2->ptr; ++ return less_equal_greater_than((char *)m1->ptr, (char *)m2->ptr); + } + + static inline int
meta-networking/recipes-daemons/keepalived/keepalived_2.2.2.bb +4 -0
@@ -13,6 +13,10 @@ 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 \ + file://CVE-2024-41184-1.patch \ + file://CVE-2024-41184-2.patch \ + file://CVE-2024-41184-3.patch \ + file://CVE-2024-41184-4.patch \ " SRC_URI[sha256sum] = "103692bd5345a4ed9f4581632ea636214fdf53e45682e200aab122c4fa674ece" UPSTREAM_CHECK_URI = "https://github.com/acassen/keepalived/releases"