From nobody Sat May 18 10:15:17 2024 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VhKTL1NB8z5KVCj; Sat, 18 May 2024 10:15:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VhKTL0pvxz4kdn; Sat, 18 May 2024 10:15:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716027318; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iA5rA63SJFPNu4I8B178ObhtJBmiCCP3pw1bJhohtY8=; b=haW3NPjPCsgXMVsra63+V+QqYK2JiCjP4vxxXcrClI66HQ24wj9Cmu9eCLn7r6F6wHY6qN RCHLn939isPdsGcfXeglKAY66EQG+IVFqC4VHPWuiq3hesY1rzVt708n6Zs0cQo1+Mbm+J fIRossa5F+X16vJM0D3Xte1O7ytCO3SeXSMGA6uCTPivhZi3vwPY5r2EMfAbOS/ou+6uX4 h6Zr3ZbX9BCkT28v6Fs+fFJrWVUHNPcv7IzHOy/Y3XWHN7usLn2TVVVjOAM2NBwk/7AGxT MmTT+U3AtR1H1z7G/kJxalJPcJrfi6TL/flok14/zsfxzaCarA5U9/iakWSjCg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1716027318; a=rsa-sha256; cv=none; b=GNrOGCKP2GH5jbz5Wvkqj84ar91259gxCJqbdb8XSZX3Lmje/9mpiir5kpWRLm5HpmgOQC tGZCBS2aLfRYHb+sgVJBe0yWf23WOBTHzYSqgYC2qJo64BkSojtKR3OiZQHdhbzK8Luy/h OK8V3ZCr65rqpgnqDB+nUoGIm+vApy2Rqq1Ebm/wGqR/nGpZ0lBRvyR8DYL6qLvrlQ0RfZ Tdu7G41W9yPm8gCWdADAVuDtK262TOvDAMZkKREIpdPsML/qreh+jt1xCzxlzG+yh5UHeR wrz8zrA1zDKL6BdyjZ+REu6WRJmPxOi8yfbed1muBdNNZDOGptn3WM3P21CI3Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716027318; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iA5rA63SJFPNu4I8B178ObhtJBmiCCP3pw1bJhohtY8=; b=EK4Ll3fIS4sQdd0R3MeEoIk3F1+xZ1R77X5iyFUlfHVGyGjxugWrlnT0le2YdAsRheXjpT mqZYdLLuVJOsH/69OMZwPDRpV/0hqS+tt2t3ebGBQhfi28WCRR0ERX2rcYirpTabsTM1Ic C83Rdbq/ypcFWUgN5yOmUjYh4E3nZBEwOyiV8H1ZZGGYcu2TjaKIwtq920292WnBL3du0z RUPcbstAs+uSuon4vPlnfU/zCYpOqHQCnXquJVTDqZsk8ByNXyqwYzzXqGwTq3/CE6B7Ly WXH/SIXqprS2L6kI88K4Fdvr0Fno9Iv5RbLUzl7n6a+CJpNa5K7zeuEpnqQneg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VhKTL0PzLzMZ8; Sat, 18 May 2024 10:15:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44IAFHCF091363; Sat, 18 May 2024 10:15:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44IAFHOC091360; Sat, 18 May 2024 10:15:17 GMT (envelope-from git) Date: Sat, 18 May 2024 10:15:17 GMT Message-Id: <202405181015.44IAFHOC091360@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Bernard Spil Subject: git: c5d51635a0f7 - main - security/openssl31: Security update for CVE-2024-4603 List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-ports-main@freebsd.org Sender: owner-dev-commits-ports-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brnrd X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c5d51635a0f7fa8bdc45fd8f5ffaf20c473b2fb8 Auto-Submitted: auto-generated The branch main has been updated by brnrd: URL: https://cgit.FreeBSD.org/ports/commit/?id=c5d51635a0f7fa8bdc45fd8f5ffaf20c473b2fb8 commit c5d51635a0f7fa8bdc45fd8f5ffaf20c473b2fb8 Author: Bernard Spil AuthorDate: 2024-05-18 10:15:00 +0000 Commit: Bernard Spil CommitDate: 2024-05-18 10:15:00 +0000 security/openssl31: Security update for CVE-2024-4603 Security: b88aa380-1442-11ef-a490-84a93843eb75 MFH: 2024Q2 --- security/openssl31/Makefile | 2 +- security/openssl31/files/patch-CVE-2024-4603 | 172 +++++++++++++++++++++++++++ 2 files changed, 173 insertions(+), 1 deletion(-) diff --git a/security/openssl31/Makefile b/security/openssl31/Makefile index 7e91b88065a6..68f694872cf7 100644 --- a/security/openssl31/Makefile +++ b/security/openssl31/Makefile @@ -1,6 +1,6 @@ PORTNAME= openssl PORTVERSION= 3.1.5 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= security devel MASTER_SITES= https://www.openssl.org/source/ \ ftp://ftp.cert.dfn.de/pub/tools/net/openssl/source/ diff --git a/security/openssl31/files/patch-CVE-2024-4603 b/security/openssl31/files/patch-CVE-2024-4603 new file mode 100644 index 000000000000..2994ec6c13a6 --- /dev/null +++ b/security/openssl31/files/patch-CVE-2024-4603 @@ -0,0 +1,172 @@ +From 9c39b3858091c152f52513c066ff2c5a47969f0d Mon Sep 17 00:00:00 2001 +From: Tomas Mraz +Date: Wed, 8 May 2024 15:23:45 +0200 +Subject: [PATCH] Check DSA parameters for excessive sizes before validating + +This avoids overly long computation of various validation +checks. + +Fixes CVE-2024-4603 + +Reviewed-by: Paul Dale +Reviewed-by: Matt Caswell +Reviewed-by: Neil Horman +Reviewed-by: Shane Lontis +(Merged from https://github.com/openssl/openssl/pull/24346) + +(cherry picked from commit 85ccbab216da245cf9a6503dd327072f21950d9b) +--- + CHANGES.md | 17 ++++++ + crypto/dsa/dsa_check.c | 44 ++++++++++++-- + .../invalid/p10240_q256_too_big.pem | 57 +++++++++++++++++++ + 3 files changed, 114 insertions(+), 4 deletions(-) + create mode 100644 test/recipes/15-test_dsaparam_data/invalid/p10240_q256_too_big.pem + +diff --git a/crypto/dsa/dsa_check.c b/crypto/dsa/dsa_check.c +index fb0e9129a2956..122449a7bf087 100644 +--- crypto/dsa/dsa_check.c.orig ++++ crypto/dsa/dsa_check.c +@@ -19,8 +19,34 @@ + #include "dsa_local.h" + #include "crypto/dsa.h" + ++static int dsa_precheck_params(const DSA *dsa, int *ret) ++{ ++ if (dsa->params.p == NULL || dsa->params.q == NULL) { ++ ERR_raise(ERR_LIB_DSA, DSA_R_BAD_FFC_PARAMETERS); ++ *ret = FFC_CHECK_INVALID_PQ; ++ return 0; ++ } ++ ++ if (BN_num_bits(dsa->params.p) > OPENSSL_DSA_MAX_MODULUS_BITS) { ++ ERR_raise(ERR_LIB_DSA, DSA_R_MODULUS_TOO_LARGE); ++ *ret = FFC_CHECK_INVALID_PQ; ++ return 0; ++ } ++ ++ if (BN_num_bits(dsa->params.q) >= BN_num_bits(dsa->params.p)) { ++ ERR_raise(ERR_LIB_DSA, DSA_R_BAD_Q_VALUE); ++ *ret = FFC_CHECK_INVALID_PQ; ++ return 0; ++ } ++ ++ return 1; ++} ++ + int ossl_dsa_check_params(const DSA *dsa, int checktype, int *ret) + { ++ if (!dsa_precheck_params(dsa, ret)) ++ return 0; ++ + if (checktype == OSSL_KEYMGMT_VALIDATE_QUICK_CHECK) + return ossl_ffc_params_simple_validate(dsa->libctx, &dsa->params, + FFC_PARAM_TYPE_DSA, ret); +@@ -39,6 +65,9 @@ int ossl_dsa_check_params(const DSA *dsa, int checktype, int *ret) + */ + int ossl_dsa_check_pub_key(const DSA *dsa, const BIGNUM *pub_key, int *ret) + { ++ if (!dsa_precheck_params(dsa, ret)) ++ return 0; ++ + return ossl_ffc_validate_public_key(&dsa->params, pub_key, ret) + && *ret == 0; + } +@@ -50,6 +79,9 @@ int ossl_dsa_check_pub_key(const DSA *dsa, const BIGNUM *pub_key, int *ret) + */ + int ossl_dsa_check_pub_key_partial(const DSA *dsa, const BIGNUM *pub_key, int *ret) + { ++ if (!dsa_precheck_params(dsa, ret)) ++ return 0; ++ + return ossl_ffc_validate_public_key_partial(&dsa->params, pub_key, ret) + && *ret == 0; + } +@@ -58,8 +90,10 @@ int ossl_dsa_check_priv_key(const DSA *dsa, const BIGNUM *priv_key, int *ret) + { + *ret = 0; + +- return (dsa->params.q != NULL +- && ossl_ffc_validate_private_key(dsa->params.q, priv_key, ret)); ++ if (!dsa_precheck_params(dsa, ret)) ++ return 0; ++ ++ return ossl_ffc_validate_private_key(dsa->params.q, priv_key, ret); + } + + /* +@@ -72,8 +106,10 @@ int ossl_dsa_check_pairwise(const DSA *dsa) + BN_CTX *ctx = NULL; + BIGNUM *pub_key = NULL; + +- if (dsa->params.p == NULL +- || dsa->params.g == NULL ++ if (!dsa_precheck_params(dsa, &ret)) ++ return 0; ++ ++ if (dsa->params.g == NULL + || dsa->priv_key == NULL + || dsa->pub_key == NULL) + return 0; +diff --git a/test/recipes/15-test_dsaparam_data/invalid/p10240_q256_too_big.pem b/test/recipes/15-test_dsaparam_data/invalid/p10240_q256_too_big.pem +new file mode 100644 +index 0000000000000..e85e2953b7a24 +--- /dev/null ++++ test/recipes/15-test_dsaparam_data/invalid/p10240_q256_too_big.pem +@@ -0,0 +1,57 @@ ++-----BEGIN DSA PARAMETERS----- ++MIIKLAKCBQEAym47LzPFZdbz16WvjczLKuzLtsP8yRk/exxL4bBthJhP1qOwctja ++p1586SF7gDxCMn7yWVEYdfRbFefGoq0gj1XOE917XqlbnkmZhMgxut2KbNJo/xil ++XNFUjGvKs3F413U9rAodC8f07cWHP1iTcWL+vPe6u2yilKWYYfnLWHQH+Z6aPrrF ++x/R08LI6DZ6nEsIo+hxaQnEtx+iqNTJC6Q1RIjWDqxQkFVTkJ0Y7miRDXmRdneWk ++oLrMZRpaXr5l5tSjEghh1pBgJcdyOv0lh4dlDy/alAiqE2Qlb667yHl6A9dDPlpW ++dAntpffy4LwOxfbuEhISvKjjQoBwIvYE4TBPqL0Q6bC6HgQ4+tqd9b44pQjdIQjb ++Xcjc6azheITSnPEex3OdKtKoQeRq01qCeLBpMXu1c+CTf4ApKArZvT3vZSg0hM1O ++pR71bRZrEEegDj0LH2HCgI5W6H3blOS9A0kUTddCoQXr2lsVdiPtRbPKH1gcd9FQ ++P8cGrvbakpTiC0dCczOMDaCteM1QNILlkM7ZoV6VghsKvDnFPxFsiIr5GgjasXP5 ++hhbn3g7sDoq1LiTEo+IKQY28pBWx7etSOSRuXW/spnvC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