Pedro Monreal Gonzalez
79c28ad03b
- Security fix: [bsc#1213487, CVE-2023-3446] * Fix DH_check() excessive time with over sized modulus. * The function DH_check() performs various checks on DH parameters. One of those checks confirms that the modulus ("p" parameter) is not too large. Trying to use a very large modulus is slow and OpenSSL will not normally use a modulus which is over 10,000 bits in length. However the DH_check() function checks numerous aspects of the key or parameters that have been supplied. Some of those checks use the supplied modulus value even if it has already been found to be too large. A new limit has been added to DH_check of 32,768 bits. Supplying a key/parameters with a modulus over this size will simply cause DH_check() to fail. * Add openssl-CVE-2023-3446.patch openssl-CVE-2023-3446-test.patch OBS-URL: https://build.opensuse.org/request/show/1099662 OBS-URL: https://build.opensuse.org/package/show/security:tls/openssl-3?expand=0&rev=68
72 lines
2.6 KiB
Diff
72 lines
2.6 KiB
Diff
From fc9867c1e03c22ebf56943be205202e576aabf23 Mon Sep 17 00:00:00 2001
|
|
From: Matt Caswell <matt@openssl.org>
|
|
Date: Thu, 6 Jul 2023 16:36:35 +0100
|
|
Subject: [PATCH] Fix DH_check() excessive time with over sized modulus
|
|
|
|
The DH_check() function checks numerous aspects of the key or parameters
|
|
that have been supplied. Some of those checks use the supplied modulus
|
|
value even if it is excessively large.
|
|
|
|
There is already a maximum DH modulus size (10,000 bits) over which
|
|
OpenSSL will not generate or derive keys. DH_check() will however still
|
|
perform various tests for validity on such a large modulus. We introduce a
|
|
new maximum (32,768) over which DH_check() will just fail.
|
|
|
|
An application that calls DH_check() and supplies a key or parameters
|
|
obtained from an untrusted source could be vulnerable to a Denial of
|
|
Service attack.
|
|
|
|
The function DH_check() is itself called by a number of other OpenSSL
|
|
functions. An application calling any of those other functions may
|
|
similarly be affected. The other functions affected by this are
|
|
DH_check_ex() and EVP_PKEY_param_check().
|
|
|
|
CVE-2023-3446
|
|
|
|
Reviewed-by: Paul Dale <pauli@openssl.org>
|
|
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
|
|
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
|
|
Reviewed-by: Tomas Mraz <tomas@openssl.org>
|
|
(Merged from https://github.com/openssl/openssl/pull/21451)
|
|
|
|
(cherry picked from commit 9e0094e2aa1b3428a12d5095132f133c078d3c3d)
|
|
---
|
|
crypto/dh/dh_check.c | 6 ++++++
|
|
include/openssl/dh.h | 6 +++++-
|
|
2 files changed, 11 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/crypto/dh/dh_check.c b/crypto/dh/dh_check.c
|
|
index 0b391910d6b3..84a926998e9b 100644
|
|
--- a/crypto/dh/dh_check.c
|
|
+++ b/crypto/dh/dh_check.c
|
|
@@ -152,6 +152,12 @@ int DH_check(const DH *dh, int *ret)
|
|
if (nid != NID_undef)
|
|
return 1;
|
|
|
|
+ /* Don't do any checks at all with an excessively large modulus */
|
|
+ if (BN_num_bits(dh->params.p) > OPENSSL_DH_CHECK_MAX_MODULUS_BITS) {
|
|
+ ERR_raise(ERR_LIB_DH, DH_R_MODULUS_TOO_LARGE);
|
|
+ return 0;
|
|
+ }
|
|
+
|
|
if (!DH_check_params(dh, ret))
|
|
return 0;
|
|
|
|
diff --git a/include/openssl/dh.h b/include/openssl/dh.h
|
|
index ec5a493da129..499f9f7109dd 100644
|
|
--- a/include/openssl/dh.h
|
|
+++ b/include/openssl/dh.h
|
|
@@ -92,7 +92,11 @@ int EVP_PKEY_CTX_get0_dh_kdf_ukm(EVP_PKEY_CTX *ctx, unsigned char **ukm);
|
|
# include <openssl/dherr.h>
|
|
|
|
# ifndef OPENSSL_DH_MAX_MODULUS_BITS
|
|
-# define OPENSSL_DH_MAX_MODULUS_BITS 10000
|
|
+# define OPENSSL_DH_MAX_MODULUS_BITS 10000
|
|
+# endif
|
|
+
|
|
+# ifndef OPENSSL_DH_CHECK_MAX_MODULUS_BITS
|
|
+# define OPENSSL_DH_CHECK_MAX_MODULUS_BITS 32768
|
|
# endif
|
|
|
|
# define OPENSSL_DH_FIPS_MIN_MODULUS_BITS 1024
|