From 9177f76ef4379545238c5105e95cce1ca01eed15 Mon Sep 17 00:00:00 2001 From: suresh-thelkar Date: Mon, 18 Sep 2023 14:11:43 +0530 Subject: [PATCH] Patch libssh2 to address CVE-2020-22218 (#6214) * Patch libssh2 to address CVE-2020-22218 * libssh2: Updating toolchain manifests --- SPECS/libssh2/CVE-2020-22218.patch | 23 +++++++++++++++++++ SPECS/libssh2/libssh2.spec | 9 +++++--- .../manifests/package/pkggen_core_aarch64.txt | 4 ++-- .../manifests/package/pkggen_core_x86_64.txt | 4 ++-- .../manifests/package/toolchain_aarch64.txt | 6 ++--- .../manifests/package/toolchain_x86_64.txt | 6 ++--- 6 files changed, 39 insertions(+), 13 deletions(-) create mode 100644 SPECS/libssh2/CVE-2020-22218.patch diff --git a/SPECS/libssh2/CVE-2020-22218.patch b/SPECS/libssh2/CVE-2020-22218.patch new file mode 100644 index 0000000000..094732d04c --- /dev/null +++ b/SPECS/libssh2/CVE-2020-22218.patch @@ -0,0 +1,23 @@ +From 41533173d27140400a17c49314efde6df54abdeb Mon Sep 17 00:00:00 2001 +From: lutianxiong +Date: Wed, 27 May 2020 22:26:33 +0800 +Subject: [PATCH] fix use-of-uninitialized-value + +return error if malloc(0) +--- + src/transport.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/transport.c b/src/transport.c +index 96fca6b8cc..adf96c2437 100644 +--- a/src/transport.c ++++ b/src/transport.c +@@ -472,7 +472,7 @@ int _libssh2_transport_read(LIBSSH2_SESSION * session) + /* Get a packet handle put data into. We get one to + hold all data, including padding and MAC. */ + p->payload = LIBSSH2_ALLOC(session, total_num); +- if(!p->payload) { ++ if(total_num == 0 || !p->payload) { + return LIBSSH2_ERROR_ALLOC; + } + p->total_num = total_num; diff --git a/SPECS/libssh2/libssh2.spec b/SPECS/libssh2/libssh2.spec index 7a67b59c69..bafe304dae 100644 --- a/SPECS/libssh2/libssh2.spec +++ b/SPECS/libssh2/libssh2.spec @@ -3,7 +3,7 @@ Summary: libssh2 is a library implementing the SSH2 protocol. Name: libssh2 Version: 1.9.0 -Release: 2%{?dist} +Release: 3%{?dist} License: BSD URL: https://www.libssh2.org/ Group: System Environment/NetworkingLibraries @@ -11,6 +11,7 @@ Vendor: Microsoft Corporation Distribution: Mariner Source0: https://www.libssh2.org/download/libssh2-%{version}.tar.gz Patch0: CVE-2019-17498.patch +Patch1: CVE-2020-22218.patch BuildRequires: openssl-devel BuildRequires: zlib-devel @@ -28,8 +29,7 @@ Requires: libssh2 These are the header files of libssh2. %prep -%setup -q -%patch0 -p1 +%autosetup -p1 %build ./configure --prefix=%{_prefix} \ @@ -59,6 +59,9 @@ find %{buildroot} -name '*.la' -exec rm -f {} ';' %{_mandir}/man3/* %changelog +* Wed Sep 13 2023 Suresh Thelkar - 1.9.0-3 +- Add patch for CVE-2020-22218 + * Tue Feb 08 2022 Thomas Crain - 1.9.0-2 - Remove unused `%%define sha1` lines - License verified diff --git a/toolkit/resources/manifests/package/pkggen_core_aarch64.txt b/toolkit/resources/manifests/package/pkggen_core_aarch64.txt index 74d41c90a1..f6273d6094 100644 --- a/toolkit/resources/manifests/package/pkggen_core_aarch64.txt +++ b/toolkit/resources/manifests/package/pkggen_core_aarch64.txt @@ -186,8 +186,8 @@ cpio-lang-2.13-4.cm2.aarch64.rpm e2fsprogs-libs-1.46.5-3.cm2.aarch64.rpm libsolv-0.7.24-1.cm2.aarch64.rpm libsolv-devel-0.7.24-1.cm2.aarch64.rpm -libssh2-1.9.0-2.cm2.aarch64.rpm -libssh2-devel-1.9.0-2.cm2.aarch64.rpm +libssh2-1.9.0-3.cm2.aarch64.rpm +libssh2-devel-1.9.0-3.cm2.aarch64.rpm krb5-1.19.4-2.cm2.aarch64.rpm nghttp2-1.46.0-3.cm2.aarch64.rpm curl-8.2.1-1.cm2.aarch64.rpm diff --git a/toolkit/resources/manifests/package/pkggen_core_x86_64.txt b/toolkit/resources/manifests/package/pkggen_core_x86_64.txt index 344709ef3a..40e593b0b5 100644 --- a/toolkit/resources/manifests/package/pkggen_core_x86_64.txt +++ b/toolkit/resources/manifests/package/pkggen_core_x86_64.txt @@ -186,8 +186,8 @@ cpio-lang-2.13-4.cm2.x86_64.rpm e2fsprogs-libs-1.46.5-3.cm2.x86_64.rpm libsolv-0.7.24-1.cm2.x86_64.rpm libsolv-devel-0.7.24-1.cm2.x86_64.rpm -libssh2-1.9.0-2.cm2.x86_64.rpm -libssh2-devel-1.9.0-2.cm2.x86_64.rpm +libssh2-1.9.0-3.cm2.x86_64.rpm +libssh2-devel-1.9.0-3.cm2.x86_64.rpm krb5-1.19.4-2.cm2.x86_64.rpm nghttp2-1.46.0-3.cm2.x86_64.rpm curl-8.2.1-1.cm2.x86_64.rpm diff --git a/toolkit/resources/manifests/package/toolchain_aarch64.txt b/toolkit/resources/manifests/package/toolchain_aarch64.txt index 4c7b9972d1..95ff9d49b8 100644 --- a/toolkit/resources/manifests/package/toolchain_aarch64.txt +++ b/toolkit/resources/manifests/package/toolchain_aarch64.txt @@ -199,9 +199,9 @@ libsolv-0.7.24-1.cm2.aarch64.rpm libsolv-debuginfo-0.7.24-1.cm2.aarch64.rpm libsolv-devel-0.7.24-1.cm2.aarch64.rpm libsolv-tools-0.7.24-1.cm2.aarch64.rpm -libssh2-1.9.0-2.cm2.aarch64.rpm -libssh2-debuginfo-1.9.0-2.cm2.aarch64.rpm -libssh2-devel-1.9.0-2.cm2.aarch64.rpm +libssh2-1.9.0-3.cm2.aarch64.rpm +libssh2-debuginfo-1.9.0-3.cm2.aarch64.rpm +libssh2-devel-1.9.0-3.cm2.aarch64.rpm libstdc++-11.2.0-5.cm2.aarch64.rpm libstdc++-devel-11.2.0-5.cm2.aarch64.rpm libtasn1-4.19.0-1.cm2.aarch64.rpm diff --git a/toolkit/resources/manifests/package/toolchain_x86_64.txt b/toolkit/resources/manifests/package/toolchain_x86_64.txt index 2fe0d1d816..f9a8513dcb 100644 --- a/toolkit/resources/manifests/package/toolchain_x86_64.txt +++ b/toolkit/resources/manifests/package/toolchain_x86_64.txt @@ -199,9 +199,9 @@ libsolv-0.7.24-1.cm2.x86_64.rpm libsolv-debuginfo-0.7.24-1.cm2.x86_64.rpm libsolv-devel-0.7.24-1.cm2.x86_64.rpm libsolv-tools-0.7.24-1.cm2.x86_64.rpm -libssh2-1.9.0-2.cm2.x86_64.rpm -libssh2-debuginfo-1.9.0-2.cm2.x86_64.rpm -libssh2-devel-1.9.0-2.cm2.x86_64.rpm +libssh2-1.9.0-3.cm2.x86_64.rpm +libssh2-debuginfo-1.9.0-3.cm2.x86_64.rpm +libssh2-devel-1.9.0-3.cm2.x86_64.rpm libstdc++-11.2.0-5.cm2.x86_64.rpm libstdc++-devel-11.2.0-5.cm2.x86_64.rpm libtasn1-4.19.0-1.cm2.x86_64.rpm