summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRanjitsinh Rathod <ranjitsinh.rathod@kpit.com>2022-02-11 15:20:58 +0530
committerArmin Kuster <akuster808@gmail.com>2022-02-13 10:47:05 -0800
commit93a315f96f90915382532717cb2c356f995d66b2 (patch)
treeb2ce7a97767a53133a08a923eedb6ac7a32a9017
parentec978232732edbdd875ac367b5a9c04b881f2e19 (diff)
downloadmeta-openembedded-93a315f96f90915382532717cb2c356f995d66b2.tar.gz
strongswan: Add fix of CVE-2021-45079
Add a patch to fix CVE-2021-45079 Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com> Signed-off-by: Ranjitsinh Rathod <ranjitsinhrathod1991@gmail.com> Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--meta-networking/recipes-support/strongswan/files/CVE-2021-45079.patch156
-rw-r--r--meta-networking/recipes-support/strongswan/strongswan_5.8.4.bb1
2 files changed, 157 insertions, 0 deletions
diff --git a/meta-networking/recipes-support/strongswan/files/CVE-2021-45079.patch b/meta-networking/recipes-support/strongswan/files/CVE-2021-45079.patch
new file mode 100644
index 0000000000..97aa6a0efc
--- /dev/null
+++ b/meta-networking/recipes-support/strongswan/files/CVE-2021-45079.patch
@@ -0,0 +1,156 @@
1From 76968cdd6b79f6ae40d674554e902ced192fd33e Mon Sep 17 00:00:00 2001
2From: Tobias Brunner <tobias@strongswan.org>
3Date: Tue, 14 Dec 2021 10:51:35 +0100
4Subject: [PATCH] eap-authenticator: Enforce failure if MSK generation fails
5
6Without this, the authentication succeeded if the server sent an early
7EAP-Success message for mutual, key-generating EAP methods like EAP-TLS,
8which may be used in EAP-only scenarios but would complete without server
9or client authentication. For clients configured for such EAP-only
10scenarios, a rogue server could capture traffic after the tunnel is
11established or even access hosts behind the client. For non-mutual EAP
12methods, public key server authentication has been enforced for a while.
13
14A server previously could also crash a client by sending an EAP-Success
15immediately without initiating an actual EAP method.
16
17Fixes: 0706c39cda52 ("added support for EAP methods not establishing an MSK")
18Fixes: CVE-2021-45079
19
20Upstream-Status: Backport [https://download.strongswan.org/security/CVE-2021-45079/strongswan-5.5.0-5.9.4_eap_success.patch]
21CVE: CVE-2021-45079
22Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com>
23
24---
25 src/libcharon/plugins/eap_gtc/eap_gtc.c | 2 +-
26 src/libcharon/plugins/eap_md5/eap_md5.c | 2 +-
27 src/libcharon/plugins/eap_radius/eap_radius.c | 4 ++-
28 src/libcharon/sa/eap/eap_method.h | 8 ++++-
29 .../ikev2/authenticators/eap_authenticator.c | 32 ++++++++++++++++---
30 5 files changed, 40 insertions(+), 8 deletions(-)
31
32diff --git a/src/libcharon/plugins/eap_gtc/eap_gtc.c b/src/libcharon/plugins/eap_gtc/eap_gtc.c
33index 95ba090b79ce..cffb6222c2f8 100644
34--- a/src/libcharon/plugins/eap_gtc/eap_gtc.c
35+++ b/src/libcharon/plugins/eap_gtc/eap_gtc.c
36@@ -195,7 +195,7 @@ METHOD(eap_method_t, get_type, eap_type_t,
37 METHOD(eap_method_t, get_msk, status_t,
38 private_eap_gtc_t *this, chunk_t *msk)
39 {
40- return FAILED;
41+ return NOT_SUPPORTED;
42 }
43
44 METHOD(eap_method_t, get_identifier, uint8_t,
45diff --git a/src/libcharon/plugins/eap_md5/eap_md5.c b/src/libcharon/plugins/eap_md5/eap_md5.c
46index ab5f7ff6a823..3a92ad7c0a04 100644
47--- a/src/libcharon/plugins/eap_md5/eap_md5.c
48+++ b/src/libcharon/plugins/eap_md5/eap_md5.c
49@@ -213,7 +213,7 @@ METHOD(eap_method_t, get_type, eap_type_t,
50 METHOD(eap_method_t, get_msk, status_t,
51 private_eap_md5_t *this, chunk_t *msk)
52 {
53- return FAILED;
54+ return NOT_SUPPORTED;
55 }
56
57 METHOD(eap_method_t, is_mutual, bool,
58diff --git a/src/libcharon/plugins/eap_radius/eap_radius.c b/src/libcharon/plugins/eap_radius/eap_radius.c
59index 2dc7a423e702..5336dead13d9 100644
60--- a/src/libcharon/plugins/eap_radius/eap_radius.c
61+++ b/src/libcharon/plugins/eap_radius/eap_radius.c
62@@ -733,7 +733,9 @@ METHOD(eap_method_t, get_msk, status_t,
63 *out = msk;
64 return SUCCESS;
65 }
66- return FAILED;
67+ /* we assume the selected method did not establish an MSK, if it failed
68+ * to establish one, process() would have failed */
69+ return NOT_SUPPORTED;
70 }
71
72 METHOD(eap_method_t, get_identifier, uint8_t,
73diff --git a/src/libcharon/sa/eap/eap_method.h b/src/libcharon/sa/eap/eap_method.h
74index 0b5218dfec15..33564831f86e 100644
75--- a/src/libcharon/sa/eap/eap_method.h
76+++ b/src/libcharon/sa/eap/eap_method.h
77@@ -114,10 +114,16 @@ struct eap_method_t {
78 * Not all EAP methods establish a shared secret. For implementations of
79 * the EAP-Identity method, get_msk() returns the received identity.
80 *
81+ * @note Returning NOT_SUPPORTED is important for implementations of EAP
82+ * methods that don't establish an MSK. In particular as client because
83+ * key-generating EAP methods MUST fail to process EAP-Success messages if
84+ * no MSK is established.
85+ *
86 * @param msk chunk receiving internal stored MSK
87 * @return
88- * - SUCCESS, or
89+ * - SUCCESS, if MSK is established
90 * - FAILED, if MSK not established (yet)
91+ * - NOT_SUPPORTED, for non-MSK-establishing methods
92 */
93 status_t (*get_msk) (eap_method_t *this, chunk_t *msk);
94
95diff --git a/src/libcharon/sa/ikev2/authenticators/eap_authenticator.c b/src/libcharon/sa/ikev2/authenticators/eap_authenticator.c
96index e1e6cd7ee6f3..87548fc471a6 100644
97--- a/src/libcharon/sa/ikev2/authenticators/eap_authenticator.c
98+++ b/src/libcharon/sa/ikev2/authenticators/eap_authenticator.c
99@@ -305,9 +305,17 @@ static eap_payload_t* server_process_eap(private_eap_authenticator_t *this,
100 this->method->destroy(this->method);
101 return server_initiate_eap(this, FALSE);
102 }
103- if (this->method->get_msk(this->method, &this->msk) == SUCCESS)
104+ switch (this->method->get_msk(this->method, &this->msk))
105 {
106- this->msk = chunk_clone(this->msk);
107+ case SUCCESS:
108+ this->msk = chunk_clone(this->msk);
109+ break;
110+ case NOT_SUPPORTED:
111+ break;
112+ case FAILED:
113+ default:
114+ DBG1(DBG_IKE, "failed to establish MSK");
115+ goto failure;
116 }
117 if (vendor)
118 {
119@@ -326,6 +334,7 @@ static eap_payload_t* server_process_eap(private_eap_authenticator_t *this,
120 return eap_payload_create_code(EAP_SUCCESS, in->get_identifier(in));
121 case FAILED:
122 default:
123+failure:
124 /* type might have changed for virtual methods */
125 type = this->method->get_type(this->method, &vendor);
126 if (vendor)
127@@ -661,9 +670,24 @@ METHOD(authenticator_t, process_client, status_t,
128 uint32_t vendor;
129 auth_cfg_t *cfg;
130
131- if (this->method->get_msk(this->method, &this->msk) == SUCCESS)
132+ if (!this->method)
133 {
134- this->msk = chunk_clone(this->msk);
135+ DBG1(DBG_IKE, "received unexpected %N",
136+ eap_code_names, eap_payload->get_code(eap_payload));
137+ return FAILED;
138+ }
139+ switch (this->method->get_msk(this->method, &this->msk))
140+ {
141+ case SUCCESS:
142+ this->msk = chunk_clone(this->msk);
143+ break;
144+ case NOT_SUPPORTED:
145+ break;
146+ case FAILED:
147+ default:
148+ DBG1(DBG_IKE, "received %N but failed to establish MSK",
149+ eap_code_names, eap_payload->get_code(eap_payload));
150+ return FAILED;
151 }
152 type = this->method->get_type(this->method, &vendor);
153 if (vendor)
154--
1552.25.1
156
diff --git a/meta-networking/recipes-support/strongswan/strongswan_5.8.4.bb b/meta-networking/recipes-support/strongswan/strongswan_5.8.4.bb
index b45b8074c4..8a5855fb87 100644
--- a/meta-networking/recipes-support/strongswan/strongswan_5.8.4.bb
+++ b/meta-networking/recipes-support/strongswan/strongswan_5.8.4.bb
@@ -13,6 +13,7 @@ SRC_URI = "http://download.strongswan.org/strongswan-${PV}.tar.bz2 \
13 file://0001-Remove-obsolete-setting-regarding-the-Standard-Outpu.patch \ 13 file://0001-Remove-obsolete-setting-regarding-the-Standard-Outpu.patch \
14 file://CVE-2021-41990.patch \ 14 file://CVE-2021-41990.patch \
15 file://CVE-2021-41991.patch \ 15 file://CVE-2021-41991.patch \
16 file://CVE-2021-45079.patch \
16 " 17 "
17 18
18SRC_URI[md5sum] = "0634e7f40591bd3f6770e583c3f27d29" 19SRC_URI[md5sum] = "0634e7f40591bd3f6770e583c3f27d29"