From 5da941882fcb0f8721e001030d934210f3b04567 Mon Sep 17 00:00:00 2001 From: songkai Date: Wed, 5 Jun 2024 20:57:16 +0800 Subject: [PATCH] Fix CVE-2024-2357 --- libreswan-4.12-ikev2-auth-delete-state.patch | 54 ++++++++++++++++++++ libreswan.spec | 6 ++- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 libreswan-4.12-ikev2-auth-delete-state.patch diff --git a/libreswan-4.12-ikev2-auth-delete-state.patch b/libreswan-4.12-ikev2-auth-delete-state.patch new file mode 100644 index 0000000..c17b457 --- /dev/null +++ b/libreswan-4.12-ikev2-auth-delete-state.patch @@ -0,0 +1,54 @@ +From 2ec448884a7467743699803f8a36ee28d237666c Mon Sep 17 00:00:00 2001 +From: Andrew Cagney +Date: Wed, 28 Feb 2024 08:29:53 -0500 +Subject: [PATCH] ikev2: return STF_FATAL when initiator fails to emit AUTH + packet + +--- + programs/pluto/ikev2_ike_auth.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/programs/pluto/ikev2_ike_auth.c b/programs/pluto/ikev2_ike_auth.c +index 192eb1b3b6..a54a109699 100644 +--- a/programs/pluto/ikev2_ike_auth.c ++++ b/programs/pluto/ikev2_ike_auth.c +@@ -1267,7 +1267,7 @@ static stf_status process_v2_IKE_AUTH_request_auth_signature_continue(struct ike + /* now send AUTH payload */ + + if (!emit_local_v2AUTH(ike, auth_sig, &ike->sa.st_v2_id_payload.mac, response.pbs)) { +- return STF_INTERNAL_ERROR; ++ return STF_FATAL; + } + ike->sa.st_v2_ike_intermediate.used = false; + +-- +2.44.0 + +From 16272f2475d25baab58fbed2af7c67cfb459137f Mon Sep 17 00:00:00 2001 +From: Andrew Cagney +Date: Thu, 29 Feb 2024 12:19:20 -0500 +Subject: [PATCH] ikev2: always return STF_FATAL if emitting AUTH fails + +Fix: + ikev2: return STF_FATAL when initiator fails to emit AUTH packet +which really fixed the responder. +--- + programs/pluto/ikev2_ike_auth.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/programs/pluto/ikev2_ike_auth.c b/programs/pluto/ikev2_ike_auth.c +index a54a109699..491053fb10 100644 +--- a/programs/pluto/ikev2_ike_auth.c ++++ b/programs/pluto/ikev2_ike_auth.c +@@ -397,7 +397,7 @@ stf_status initiate_v2_IKE_AUTH_request_signature_continue(struct ike_sa *ike, + /* send out the AUTH payload */ + + if (!emit_local_v2AUTH(ike, auth_sig, &ike->sa.st_v2_id_payload.mac, request.pbs)) { +- return STF_INTERNAL_ERROR; ++ return STF_FATAL; + } + + if (LIN(POLICY_MOBIKE, ike->sa.st_connection->policy)) { +-- +2.44.0 + diff --git a/libreswan.spec b/libreswan.spec index c0039f0..b6b836e 100644 --- a/libreswan.spec +++ b/libreswan.spec @@ -1,4 +1,4 @@ -%define anolis_release 1 +%define anolis_release 2 %global _hardened_build 1 # These are rpm macros and are 0 or 1 @@ -43,6 +43,7 @@ Source3: https://download.libreswan.org/cavs/ikev2.fax.bz2 %endif Patch1001: 1001-Fix-the-error-that-the-variable-is-not-defined.patch +Patch1002: libreswan-4.12-ikev2-auth-delete-state.patch BuildRequires: audit-libs-devel BuildRequires: bison @@ -199,6 +200,9 @@ certutil -N -d sql:$tmpdir --empty-password %doc docs/*.* %changelog +* Wed Jun 05 2024 Kai Song - 4.12-2 +- Fix CVE-2024-2357 + * Sat Oct 07 2023 Xiaoping Liu - 4.12-1 - Update to 4.12 for CVE-2023-38710, CVE-2023-38711 and CVE-2023-38712 -- Gitee