backport CVE-2024-3049
(cherry picked from commit e8bba8a56f8038e061248a2a01e0f81ef0ee32c1)
This commit is contained in:
parent
a0c726f27a
commit
bcd660b4a7
80
backport-CVE-2024-3049.patch
Normal file
80
backport-CVE-2024-3049.patch
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
From 98b4284d1701f2efec278b51f151314148bfe70e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jan Friesse <jfriesse@redhat.com>
|
||||||
|
Date: Wed, 21 Feb 2024 18:12:28 +0100
|
||||||
|
Subject: [PATCH] auth: Check result of gcrypt gcry_md_get_algo_dlen
|
||||||
|
|
||||||
|
When unknown hash is passed to gcry_md_get_algo_dlen 0 is returned. This
|
||||||
|
value is then used for memcmp so wrong hmac might be accepted as
|
||||||
|
correct.
|
||||||
|
|
||||||
|
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
|
||||||
|
|
||||||
|
---
|
||||||
|
src/attr.c | 2 +-
|
||||||
|
src/auth.c | 16 +++++++++++++---
|
||||||
|
2 files changed, 14 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/attr.c b/src/attr.c
|
||||||
|
index 09c15bc..e615c33 100644
|
||||||
|
--- a/src/attr.c
|
||||||
|
+++ b/src/attr.c
|
||||||
|
@@ -142,7 +142,7 @@ static int read_server_reply(
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
len = ntohl(header->length);
|
||||||
|
- rv = tpt->recv(site, msg+len, len-sizeof(*header));
|
||||||
|
+ rv = tpt->recv(site, msg+sizeof(*header), len-sizeof(*header));
|
||||||
|
if (rv < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
diff --git a/src/auth.c b/src/auth.c
|
||||||
|
index 8f86b9a..a3b3d20 100644
|
||||||
|
--- a/src/auth.c
|
||||||
|
+++ b/src/auth.c
|
||||||
|
@@ -28,6 +28,11 @@ int calc_hmac(const void *data, size_t datalen,
|
||||||
|
{
|
||||||
|
static gcry_md_hd_t digest;
|
||||||
|
gcry_error_t err;
|
||||||
|
+ int hlen;
|
||||||
|
+
|
||||||
|
+ hlen = gcry_md_get_algo_dlen(hid);
|
||||||
|
+ if (!hlen)
|
||||||
|
+ return -1;
|
||||||
|
|
||||||
|
if (!digest) {
|
||||||
|
err = gcry_md_open(&digest, hid, GCRY_MD_FLAG_HMAC);
|
||||||
|
@@ -42,7 +47,7 @@ int calc_hmac(const void *data, size_t datalen,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gcry_md_write(digest, data, datalen);
|
||||||
|
- memcpy(result, gcry_md_read(digest, 0), gcry_md_get_algo_dlen(hid));
|
||||||
|
+ memcpy(result, gcry_md_read(digest, 0), hlen);
|
||||||
|
gcry_md_reset(digest);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@@ -54,15 +59,20 @@ int verify_hmac(const void *data, size_t datalen,
|
||||||
|
{
|
||||||
|
unsigned char *our_hmac;
|
||||||
|
int rc;
|
||||||
|
+ int hlen;
|
||||||
|
+
|
||||||
|
+ hlen = gcry_md_get_algo_dlen(hid);
|
||||||
|
+ if (!hlen)
|
||||||
|
+ return -1;
|
||||||
|
|
||||||
|
- our_hmac = malloc(gcry_md_get_algo_dlen(hid));
|
||||||
|
+ our_hmac = malloc(hlen);
|
||||||
|
if (!our_hmac)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
rc = calc_hmac(data, datalen, hid, our_hmac, key, keylen);
|
||||||
|
if (rc)
|
||||||
|
goto out_free;
|
||||||
|
- rc = memcmp(our_hmac, hmac, gcry_md_get_algo_dlen(hid));
|
||||||
|
+ rc = memcmp(our_hmac, hmac, hlen);
|
||||||
|
|
||||||
|
out_free:
|
||||||
|
if (our_hmac)
|
||||||
|
--
|
||||||
|
2.23.0
|
||||||
|
|
||||||
@ -10,7 +10,7 @@
|
|||||||
%global git_describe_str v1.0-283-g9d4029aa14323a7f3b496215d25e40bd14f33632
|
%global git_describe_str v1.0-283-g9d4029aa14323a7f3b496215d25e40bd14f33632
|
||||||
|
|
||||||
# Set this to 1 when rebasing (changing git_describe_str) and increase otherwise
|
# Set this to 1 when rebasing (changing git_describe_str) and increase otherwise
|
||||||
%global release 6
|
%global release 7
|
||||||
|
|
||||||
# Run shell script to parse git_describe str into version, numcomm and sha1 hash
|
# Run shell script to parse git_describe str into version, numcomm and sha1 hash
|
||||||
%global booth_ver %(s=%{git_describe_str}; vver=${s%%%%-*}; echo ${vver:1})
|
%global booth_ver %(s=%{git_describe_str}; vver=${s%%%%-*}; echo ${vver:1})
|
||||||
@ -37,6 +37,7 @@ Summary: Ticket Manager for Multi-site Clusters
|
|||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
Url: https://github.com/%{github_owner}/%{name}
|
Url: https://github.com/%{github_owner}/%{name}
|
||||||
Source0: https://github.com/%{github_owner}/%{name}/archive/%{booth_short_sha1}/%{booth_archive_name}.tar.gz
|
Source0: https://github.com/%{github_owner}/%{name}/archive/%{booth_short_sha1}/%{booth_archive_name}.tar.gz
|
||||||
|
Patch3000: backport-CVE-2024-3049.patch
|
||||||
|
|
||||||
# direct build process dependencies
|
# direct build process dependencies
|
||||||
BuildRequires: autoconf
|
BuildRequires: autoconf
|
||||||
@ -262,6 +263,12 @@ VERBOSE=1 make check
|
|||||||
%{_usr}/lib/ocf/resource.d/booth/sharedrsc
|
%{_usr}/lib/ocf/resource.d/booth/sharedrsc
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sun Jun 09 2024 xuchenchen <xuchenchen@kylinos.cn> -1.0-7
|
||||||
|
- Type:CVES
|
||||||
|
- ID:CVE-2024-3049
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:fix CVE-2024-3049
|
||||||
|
|
||||||
* Fri May 19 2023 jiangxinyu <jiangxinyu@kylinos.cn> - 1.0-6
|
* Fri May 19 2023 jiangxinyu <jiangxinyu@kylinos.cn> - 1.0-6
|
||||||
- Rebase to newest upstream snapshot
|
- Rebase to newest upstream snapshot
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user