about<
aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches/heimdal-CVE-2022-45142.patch
blob: a7258a937c54f4bf61c76533d2e6aa8d27dfe84c (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
From: Helmut Grohne <helmut@...divi.de>
Subject: [PATCH v3] CVE-2022-45142: gsskrb5: fix accidental logic inversions

The referenced commit attempted to fix miscompilations with gcc-9 and
gcc-10 by changing `memcmp(...)` to `memcmp(...) != 0`. Unfortunately,
it also inverted the result of the comparison in two occasions. This
inversion happened during backporting the patch to 7.7.1 and 7.8.0.

Fixes: f6edaafcfefd ("gsskrb5: CVE-2022-3437 Use constant-time memcmp()
 for arcfour unwrap")
Signed-off-by: Helmut Grohne <helmut@...divi.de>
---
 lib/gssapi/krb5/arcfour.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Changes since v1:
 * Fix typo in commit message.
 * Mention 7.8.0 in commit message. Thanks to Jeffrey Altman.

Changes since v2:
 * Add CVE identifier.

NB (Felix Lechner): The message above and the patch below were taken from the
disclosure here: https://www.openwall.com/lists/oss-security/2023/02/08/1

diff --git a/lib/gssapi/krb5/arcfour.c b/lib/gssapi/krb5/arcfour.c
index e838d007a..eee6ad72f 100644
--- a/lib/gssapi/krb5/arcfour.c
+++ b/lib/gssapi/krb5/arcfour.c
@@ -365,7 +365,7 @@ _gssapi_verify_mic_arcfour(OM_uint32 * minor_status,
 	return GSS_S_FAILURE;
     }

-    cmp = (ct_memcmp(cksum_data, p + 8, 8) == 0);
+    cmp = (ct_memcmp(cksum_data, p + 8, 8) != 0);
     if (cmp) {
 	*minor_status = 0;
 	return GSS_S_BAD_MIC;
@@ -730,7 +730,7 @@ OM_uint32 _gssapi_unwrap_arcfour(OM_uint32 *minor_status,
 	return GSS_S_FAILURE;
     }

-    cmp = (ct_memcmp(cksum_data, p0 + 16, 8) == 0); /* SGN_CKSUM */
+    cmp = (ct_memcmp(cksum_data, p0 + 16, 8) != 0); /* SGN_CKSUM */
     if (cmp) {
 	_gsskrb5_release_buffer(minor_status, output_message_buffer);
 	*minor_status = 0;
--
2.38.1
t ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. (define-module (gnu packages mcrypt) #:use-module (guix packages) #:use-module ((guix licenses) #:select (gpl2+)) #:use-module (guix download) #:use-module (guix build-system gnu) #:use-module (gnu packages) #:use-module (gnu packages compression) #:use-module (gnu packages perl)) (define-public mcrypt (package (name "mcrypt") (version "2.6.8") (source (origin (method url-fetch) (uri (string-append "mirror://sourceforge/mcrypt/MCrypt/" version "/" name "-" version ".tar.gz")) (sha256 (base32 "161031n1w9pb4yzz9i47szc12a4mwpcpvyxnvafsik2l9s2aliai")) (patches (search-patches "mcrypt-CVE-2012-4409.patch" "mcrypt-CVE-2012-4426.patch" "mcrypt-CVE-2012-4527.patch")))) (build-system gnu-build-system) (inputs (list zlib libmcrypt libmhash)) (home-page "https://mcrypt.sourceforge.net/") (synopsis "Replacement for the popular Unix crypt command") (description "MCrypt is a replacement for the old crypt() package and crypt(1) command, with extensions. It allows developers to use a wide range of encryption functions, without making drastic changes to their code. It allows users to encrypt files or data streams without having to be cryptographers. The companion to MCrypt is Libmcrypt, which contains the actual encryption functions themselves, and provides a standardized mechanism for accessing them.") (license gpl2+))) (define-public libmcrypt (package (name "libmcrypt") (version "2.5.8") (source (origin (method url-fetch) (uri (string-append "mirror://sourceforge/mcrypt/Libmcrypt/" version "/libmcrypt-" version ".tar.gz")) (sha256 (base32 "0gipgb939vy9m66d3k8il98rvvwczyaw2ixr8yn6icds9c3nrsz4")))) (build-system gnu-build-system) (home-page "https://mcrypt.sourceforge.net/") (synopsis "Encryption algorithm library") (description "Libmcrypt is a data encryption library. The library is thread safe and provides encryption and decryption functions. This version of the library supports many encryption algorithms and encryption modes. Some algorithms which are supported: SERPENT, RIJNDAEL, 3DES, GOST, SAFER+, CAST-256, RC2, XTEA, 3WAY, TWOFISH, BLOWFISH, ARCFOUR, WAKE and more.") (license gpl2+))) (define-public libmhash (package (name "libmhash") (version "0.9.9.9") (source (origin (method url-fetch) (uri (string-append "mirror://sourceforge/mhash/mhash/" version "/mhash-" version ".tar.bz2")) (sha256 (base32 "1w7yiljan8gf1ibiypi6hm3r363imm3sxl1j8hapjdq3m591qljn")) (patches (search-patches "mhash-keygen-test-segfault.patch" "libmhash-hmac-fix-uaf.patch")))) (build-system gnu-build-system) (native-inputs (list perl)) ;for tests (home-page "https://mhash.sourceforge.net/") (synopsis "Thread-safe hash library") (description "Mhash is a thread-safe hash library, implemented in C, and provides a uniform interface to a large number of hash algorithms. These algorithms can be used to compute checksums, message digests, and other signatures. The HMAC support implements the basics for message authentication, following RFC 2104. Algorithms currently supplied are: CRC-32, CRC-32B, ALDER-32, MD-2, MD-4, MD-5, RIPEMD-128, RIPEMD-160, RIPEMD-256, RIPEMD-320, SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, HAVAL-128, HAVAL-160, HAVAL-192, HAVAL-256, TIGER, TIGER-128, TIGER-160, GOST, WHIRLPOOL, SNEFRU-128, SNEFRU-256.") (license gpl2+)))