diff --git a/libreswan-4.15-CVE-2026-50721.patch b/libreswan-4.15-CVE-2026-50721.patch new file mode 100644 index 0000000000000000000000000000000000000000..fa95367c8366bd594843efa3b3760ff4bbec46bf --- /dev/null +++ b/libreswan-4.15-CVE-2026-50721.patch @@ -0,0 +1,81 @@ +From e06415f5c66bfaba5c43c04b7e312f57912cb1cc Mon Sep 17 00:00:00 2001 +From: Andrew Cagney +Date: Thu, 9 Apr 2026 21:02:51 -0400 +Subject: [PATCH] crypto: in RSA_authenticate_hash_signature_raw_rsa() use + PK11_Verify() + +--- + lib/libswan/pubkey_rsa.c | 51 +++++----------------------------------- + 1 file changed, 6 insertions(+), 45 deletions(-) + +Adapted-by: PkgAgent/deepseek-v4 (modified to adapt to opencloudos-stream) + +diff --git a/lib/libswan/pubkey_rsa.c b/lib/libswan/pubkey_rsa.c +index 38b44ab..0de17c2 100644 +--- a/lib/libswan/pubkey_rsa.c ++++ b/lib/libswan/pubkey_rsa.c +@@ -402,58 +402,19 @@ static bool RSA_authenticate_signature_raw_rsa(const struct crypt_mac *expected_ + *expected_hash); + } + +- /* +- * Use the same space used by the out going hash. +- */ +- +- SECItem decrypted_signature = { +- .type = siBuffer, +- }; +- +- if (SECITEM_AllocItem(NULL, &decrypted_signature, signature.len) == NULL) { +- llog_nss_error(RC_LOG, logger, "allocating space for decrypted RSA signature"); +- return false; +- } +- + /* NSS doesn't do const */ +- const SECItem encrypted_signature = { +- .type = siBuffer, +- .data = DISCARD_CONST(unsigned char *, signature.ptr), +- .len = signature.len, +- }; ++ const SECItem signature_secitem = ++ same_shunk_as_secitem(signature, siBuffer); ++ const SECItem expected_hash_secitem = ++ same_shunk_as_secitem(HUNK_AS_SHUNK(*expected_hash), siBuffer); + +- if (PK11_VerifyRecover(seckey_public, &encrypted_signature, &decrypted_signature, +- lsw_nss_get_password_context(logger)) != SECSuccess) { +- SECITEM_FreeItem(&decrypted_signature, PR_FALSE/*not-pointer*/); ++ if (PK11_Verify(seckey_public, &signature_secitem, &expected_hash_secitem, ++ lsw_nss_get_password_context(logger)) != SECSuccess) { + dbg("NSS RSA verify: decrypting signature is failed"); + *fatal_diag = NULL; + return false; + } + +- if (DBGP(DBG_CRYPT)) { +- LLOG_JAMBUF(DEBUG_STREAM, logger, buf) { +- jam_string(buf, "NSS RSA verify: decrypted sig: "); +- jam_nss_secitem(buf, &decrypted_signature); +- } +- } +- +- /* +- * Expect the matching hash to appear at the end. See above +- * for length check. It may, or may not, be prefixed by a +- * PKCS#1 1.5 RSA ASN.1 blob. +- */ +- passert(decrypted_signature.len >= expected_hash->len); +- uint8_t *start = (decrypted_signature.data +- + decrypted_signature.len +- - expected_hash->len); +- if (!memeq(start, expected_hash->ptr, expected_hash->len)) { +- dbg("RSA Signature NOT verified"); +- SECITEM_FreeItem(&decrypted_signature, PR_FALSE/*not-pointer*/); +- *fatal_diag = NULL; +- return false; +- } +- +- SECITEM_FreeItem(&decrypted_signature, PR_FALSE/*not-pointer*/); + *fatal_diag = NULL; + return true; + } diff --git a/libreswan.spec b/libreswan.spec index 449a641b8b397b109423e49bb37dd945ae0dc4b5..35b14a63090cf682a20b2391b60575b3a2665df6 100644 --- a/libreswan.spec +++ b/libreswan.spec @@ -24,7 +24,7 @@ Summary: Internet Key Exchange (IKEv1 and IKEv2) implementation for IPsec Name: libreswan Version: 4.15 -Release: 5%{?dist} +Release: 6%{?dist} License: GPL-2.0-or-later Url: https://github.com/libreswan/libreswan Source0: %{url}/archive/refs/tags/v%{version}.tar.gz @@ -38,6 +38,7 @@ Source4: 50-libreswan.conf # Security fixes Patch0001: libreswan-4.15-CVE-2026-12413.patch +Patch0002: libreswan-4.15-CVE-2026-50721.patch BuildRequires: audit-libs-devel bison curl-devel flex gcc gnupg2 hostname ldns-devel BuildRequires: libcap-ng-devel libevent-devel libseccomp-devel libselinux-devel make @@ -163,6 +164,10 @@ certutil -N -d sql:$tmpdir --empty-password %doc %{_mandir}/*/* %changelog +* Tue Aug 04 2026 PkgAgent Robot - 4.15-6 +- [Type] security +- [DESC] Fix CVE-2026-50721: insufficient hash length validation in RSA_authenticate_hash_signature_raw_rsa() leads to signature forgery/DoS + * Mon Jul 06 2026 PkgAgent Robot - 4.15-5 - [Type] security - [DESC] Fix CVE-2026-12413: off-by-one error in reassemble_v2_incoming_fragments() causes denial of service