Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
436ecbd775
!31 Fix CVE-2024-45751
From: @starlet-dx 
Reviewed-by: @wang--ge 
Signed-off-by: @wang--ge
2024-09-09 10:05:28 +00:00
starlet-dx
be98b4efa9 Fix CVE-2024-45751 2024-09-09 17:06:28 +08:00
openeuler-ci-bot
85cc6ebe48 !6 release +1 for rebuild
Merge pull request !6 from yu_boyun/openEuler-20.03-LTS
2020-08-21 11:45:27 +08:00
yu_boyun
94d751762d release +1 2020-08-21 10:32:35 +08:00
openeuler-ci-bot
7aae762a44 !5 update release for rebuilding
Merge pull request !5 from smileknife/update-release
2020-08-19 09:05:43 +08:00
smileknife
2eede7d9e5 update release for rebuilding
Signed-off-by: smileknife <jackshan2010@aliyun.com>
2020-08-18 20:55:26 +08:00
openeuler-ci-bot
833e5cd2cd !4 Fix the situation where the upgrade of dependent packages causes the upgrade to fail
Merge pull request !4 from renxudong/local
2020-05-18 20:29:23 +08:00
renxudong1
6f3b8d648f Fix the situation where the upgrade of dependent packages causes the upgrade to fail 2020-05-18 20:07:44 +08:00
openeuler-ci-bot
ad2ed2242a !3 add yaml file
Merge pull request !3 from sigui/master
2020-05-12 19:46:19 +08:00
si-gui
869a995c64 add yaml file 2020-05-12 18:06:39 +08:00
3 changed files with 86 additions and 2 deletions

View File

@ -0,0 +1,64 @@
From abd8e0d987ab56013d360077202bf2aca20a42dd Mon Sep 17 00:00:00 2001
From: Richard Weinberger <richard@nod.at>
Date: Tue, 3 Sep 2024 16:14:58 +0200
Subject: [PATCH] chap: Use proper entropy source
The challenge sent to the initiator is based on a poor
source of randomness, it uses rand() without seeding it by srand().
So the glibc PRNG is always seeded with 1 and as a consequence the
sequence of challenges is always the same.
An attacker which is able to monitor network traffic can apply a replay
attack to bypass the CHAP authentication. All the attacker has to do
is waiting for the server or the service to restart and replay with a
previously record CHAP session which fits into the sequence.
To overcome the issue, use getrandom() to query the kernel random
number generator.
Also always send a challenge of length CHAP_CHALLENGE_MAX, there is no
benefit in sending a variable length challenge.
Signed-off-by: Richard Weinberger <richard@nod.at>
---
usr/iscsi/chap.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/usr/iscsi/chap.c b/usr/iscsi/chap.c
index aa0fc671..b89ecabd 100644
--- a/usr/iscsi/chap.c
+++ b/usr/iscsi/chap.c
@@ -28,6 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/random.h>
#include "iscsid.h"
#include "tgtd.h"
@@ -359,22 +360,19 @@ static int chap_initiator_auth_create_challenge(struct iscsi_connection *conn)
sprintf(text, "%u", (unsigned char)conn->auth.chap.id);
text_key_add(conn, "CHAP_I", text);
- /*
- * FIXME: does a random challenge length provide any benefits security-
- * wise, or should we rather always use the max. allowed length of
- * 1024 for the (unencoded) challenge?
- */
- conn->auth.chap.challenge_size = (rand() % (CHAP_CHALLENGE_MAX / 2)) + CHAP_CHALLENGE_MAX / 2;
+ conn->auth.chap.challenge_size = CHAP_CHALLENGE_MAX;
conn->auth.chap.challenge = malloc(conn->auth.chap.challenge_size);
if (!conn->auth.chap.challenge)
return CHAP_TARGET_ERROR;
+ if (getrandom(conn->auth.chap.challenge, conn->auth.chap.challenge_size, 0) != conn->auth.chap.challenge_size)
+ return CHAP_TARGET_ERROR;
+
p = text;
strcpy(p, "0x");
p += 2;
for (i = 0; i < conn->auth.chap.challenge_size; i++) {
- conn->auth.chap.challenge[i] = rand();
sprintf(p, "%.2hhx", conn->auth.chap.challenge[i]);
p += 2;
}

View File

@ -6,7 +6,7 @@
Summary: The SCSI target daemon and utility programs
Name: scsi-target-utils
Version: 1.0.79
Release: 1
Release: 5
License: GPLv2
URL: http://stgt.sourceforge.net/
Source0: https://github.com/fujita/tgt/archive/v%{version}/tgt-v%{version}.tar.gz
@ -18,6 +18,7 @@ Source5: tgtd.conf
Patch1: 0002-remove-check-for-xsltproc.patch
Patch2: 0003-default-config.patch
Patch3: tgt-1.0.79-Adapt-to-glusterfs-api-7.6.3.patch
Patch4: backport-CVE-2024-45751.patch
BuildRequires: docbook-style-xsl gcc libaio-devel libxslt perl-generators pkgconfig systemd-devel systemd-units
%if 0%{?with_rdma}
@ -54,7 +55,7 @@ Adds support for the Gluster glfs backstore to scsi-target-utils.
%package_help
%prep
%autosetup -n %{oname}-%{version} -Sgit -p1
%autosetup -n %{oname}-%{version} -p1
%build
%{__sed} -i -e 's|-g -O2 -fno-strict-aliasing|%{optflags} -fcommon|' -e 's| -Werror | |' usr/Makefile
@ -117,5 +118,20 @@ pushd usr
%{_mandir}/man8/*
%changelog
* Mon Sep 09 2024 yaoxin <yao_xin001@hoperun.com> - 1.0.79-5
- Fix CVE-2024-45751
* Aug 21 2020 yuboyun <yuboyun@huawei.com> - 1.0.79-4
- Type: bugfix
- ID: NA
- SUG: NA
- DESC: release +1 for rebuild
* Tue Aug 18 2020 smileknife<jackshan2010@aliyun.com> - 1.0.79-3
- update release for rebuilding
* Mon May 18 2020 renxudong <renxudong1@huawei.com> - 1.0.79-2
- Fix the situation where the upgrade of dependent packages causes the upgrade to fail
* Fri Dec 13 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.0.79-1
- Package init

4
scsi-target-utils.yaml Normal file
View File

@ -0,0 +1,4 @@
version_control: github
src_repo: fujita/tgt
tag_prefix: ^v
seperator: .