lkundrak / rpms / hostapd

Forked from rpms/hostapd 4 years ago
Clone
John W. Linville aeb7fa6
From d63edfa90243e9a7de6ae5c275032f2cc79fef95 Mon Sep 17 00:00:00 2001
John W. Linville aeb7fa6
From: Mathy Vanhoef <mathy.vanhoef@nyu.edu>
John W. Linville aeb7fa6
Date: Sun, 31 Mar 2019 17:26:01 +0200
John W. Linville aeb7fa6
Subject: [PATCH 12/14] EAP-pwd server: Detect reflection attacks
John W. Linville aeb7fa6
John W. Linville aeb7fa6
When processing an EAP-pwd Commit frame, verify that the peer's scalar
John W. Linville aeb7fa6
and elliptic curve element differ from the one sent by the server. This
John W. Linville aeb7fa6
prevents reflection attacks where the adversary reflects the scalar and
John W. Linville aeb7fa6
element sent by the server. (CVE-2019-9497)
John W. Linville aeb7fa6
John W. Linville aeb7fa6
The vulnerability allows an adversary to complete the EAP-pwd handshake
John W. Linville aeb7fa6
as any user. However, the adversary does not learn the negotiated
John W. Linville aeb7fa6
session key, meaning the subsequent 4-way handshake would fail. As a
John W. Linville aeb7fa6
result, this cannot be abused to bypass authentication unless EAP-pwd is
John W. Linville aeb7fa6
used in non-WLAN cases without any following key exchange that would
John W. Linville aeb7fa6
require the attacker to learn the MSK.
John W. Linville aeb7fa6
John W. Linville aeb7fa6
Signed-off-by: Mathy Vanhoef <mathy.vanhoef@nyu.edu>
John W. Linville aeb7fa6
---
John W. Linville aeb7fa6
 src/eap_server/eap_server_pwd.c | 9 +++++++++
John W. Linville aeb7fa6
 1 file changed, 9 insertions(+)
John W. Linville aeb7fa6
John W. Linville aeb7fa6
diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
John W. Linville aeb7fa6
index 74979da..16057e9 100644
John W. Linville aeb7fa6
--- a/src/eap_server/eap_server_pwd.c
John W. Linville aeb7fa6
+++ b/src/eap_server/eap_server_pwd.c
John W. Linville aeb7fa6
@@ -753,6 +753,15 @@ eap_pwd_process_commit_resp(struct eap_sm *sm, struct eap_pwd_data *data,
John W. Linville aeb7fa6
 		}
John W. Linville aeb7fa6
 	}
John W. Linville aeb7fa6
 
John W. Linville aeb7fa6
+	/* detect reflection attacks */
John W. Linville aeb7fa6
+	if (crypto_bignum_cmp(data->my_scalar, data->peer_scalar) == 0 ||
John W. Linville aeb7fa6
+	    crypto_ec_point_cmp(data->grp->group, data->my_element,
John W. Linville aeb7fa6
+				data->peer_element) == 0) {
John W. Linville aeb7fa6
+		wpa_printf(MSG_INFO,
John W. Linville aeb7fa6
+			   "EAP-PWD (server): detected reflection attack!");
John W. Linville aeb7fa6
+		goto fin;
John W. Linville aeb7fa6
+	}
John W. Linville aeb7fa6
+
John W. Linville aeb7fa6
 	/* compute the shared key, k */
John W. Linville aeb7fa6
 	if ((crypto_ec_point_mul(data->grp->group, data->grp->pwe,
John W. Linville aeb7fa6
 				 data->peer_scalar, K) < 0) ||
John W. Linville aeb7fa6
-- 
John W. Linville aeb7fa6
2.7.4
John W. Linville aeb7fa6