From: Narpat Mali <[email protected]> CVE-2023-2975: AES-SIV implementation ignores empty associated data entries https://nvd.nist.gov/vuln/detail/CVE-2023-2975
CVE-2023-3446: Excessive time spent checking DH keys and parameters https://nvd.nist.gov/vuln/detail/CVE-2023-3446 Have also tested openssl ptest with both the CVE patches and it has been successfully passed. Signed-off-by: Narpat Mali <[email protected]> --- .../openssl/openssl/CVE-2023-2975.patch | 62 +++++++++++++++ .../openssl/openssl/CVE-2023-3446.patch | 79 +++++++++++++++++++ .../openssl/openssl_3.0.9.bb | 2 + 3 files changed, 143 insertions(+) create mode 100644 meta/recipes-connectivity/openssl/openssl/CVE-2023-2975.patch create mode 100644 meta/recipes-connectivity/openssl/openssl/CVE-2023-3446.patch diff --git a/meta/recipes-connectivity/openssl/openssl/CVE-2023-2975.patch b/meta/recipes-connectivity/openssl/openssl/CVE-2023-2975.patch new file mode 100644 index 0000000000..b1c72de111 --- /dev/null +++ b/meta/recipes-connectivity/openssl/openssl/CVE-2023-2975.patch @@ -0,0 +1,62 @@ +From 00e2f5eea29994d19293ec4e8c8775ba73678598 Mon Sep 17 00:00:00 2001 +From: Tomas Mraz <[email protected]> +Date: Tue, 4 Jul 2023 17:30:35 +0200 +Subject: [PATCH] Do not ignore empty associated data with AES-SIV mode + +The AES-SIV mode allows for multiple associated data items +authenticated separately with any of these being 0 length. + +The provided implementation ignores such empty associated data +which is incorrect in regards to the RFC 5297 and is also +a security issue because such empty associated data then become +unauthenticated if an application expects to authenticate them. + +Fixes CVE-2023-2975 + +Reviewed-by: Matt Caswell <[email protected]> +Reviewed-by: Paul Dale <[email protected]> +(Merged from https://github.com/openssl/openssl/pull/21384) + +(cherry picked from commit c426c281cfc23ab182f7d7d7a35229e7db1494d9) + +CVE: CVE-2023-2975 + +Upstream-Status: Backport [https://github.com/openssl/openssl/commit/00e2f5eea29994d19293ec4e8c8775ba73678598] + +Signed-off-by: Narpat Mali <[email protected]> +--- + .../implementations/ciphers/cipher_aes_siv.c | 18 +++++++++++------- + 1 file changed, 11 insertions(+), 7 deletions(-) + +diff --git a/providers/implementations/ciphers/cipher_aes_siv.c b/providers/implementations/ciphers/cipher_aes_siv.c +index 45010b90db..b396c8651a 100644 +--- a/providers/implementations/ciphers/cipher_aes_siv.c ++++ b/providers/implementations/ciphers/cipher_aes_siv.c +@@ -120,14 +120,18 @@ static int siv_cipher(void *vctx, unsigned char *out, size_t *outl, + if (!ossl_prov_is_running()) + return 0; + +- if (inl == 0) { +- *outl = 0; +- return 1; +- } ++ /* Ignore just empty encryption/decryption call and not AAD. */ ++ if (out != NULL) { ++ if (inl == 0) { ++ if (outl != NULL) ++ *outl = 0; ++ return 1; ++ } + +- if (outsize < inl) { +- ERR_raise(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL); +- return 0; ++ if (outsize < inl) { ++ ERR_raise(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL); ++ return 0; ++ } + } + + if (ctx->hw->cipher(ctx, out, in, inl) <= 0) +-- +2.40.0 diff --git a/meta/recipes-connectivity/openssl/openssl/CVE-2023-3446.patch b/meta/recipes-connectivity/openssl/openssl/CVE-2023-3446.patch new file mode 100644 index 0000000000..c34b19a649 --- /dev/null +++ b/meta/recipes-connectivity/openssl/openssl/CVE-2023-3446.patch @@ -0,0 +1,79 @@ +From 1fa20cf2f506113c761777127a38bce5068740eb Mon Sep 17 00:00:00 2001 +From: Matt Caswell <[email protected]> +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 <[email protected]> +Reviewed-by: Tom Cosgrove <[email protected]> +Reviewed-by: Bernd Edlinger <[email protected]> +Reviewed-by: Tomas Mraz <[email protected]> +(Merged from https://github.com/openssl/openssl/pull/21451) + +(cherry picked from commit 9e0094e2aa1b3428a12d5095132f133c078d3c3d) + +CVE: CVE-2023-3446 + +Upstream-Status: Backport [https://github.com/openssl/openssl/commit/1fa20cf2f506113c761777127a38bce5068740eb] + +Signed-off-by: Narpat Mali <[email protected]> +--- + 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 0b391910d6..84a926998e 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 b97871eca7..36420f51d8 100644 +--- a/include/openssl/dh.h ++++ b/include/openssl/dh.h +@@ -89,7 +89,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 +-- +2.40.0 diff --git a/meta/recipes-connectivity/openssl/openssl_3.0.9.bb b/meta/recipes-connectivity/openssl/openssl_3.0.9.bb index 849bd7e5a6..82e393da4b 100644 --- a/meta/recipes-connectivity/openssl/openssl_3.0.9.bb +++ b/meta/recipes-connectivity/openssl/openssl_3.0.9.bb @@ -12,6 +12,8 @@ SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \ file://0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch \ file://afalg.patch \ file://0001-Configure-do-not-tweak-mips-cflags.patch \ + file://CVE-2023-2975.patch \ + file://CVE-2023-3446.patch \ " SRC_URI:append:class-nativesdk = " \ -- 2.40.0
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#185254): https://lists.openembedded.org/g/openembedded-core/message/185254 Mute This Topic: https://lists.openembedded.org/mt/100486982/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
