From 09748a352729762dacb8e6171752aaa6d03df85d Mon Sep 17 00:00:00 2001 From: Leo Famulari Date: Mon, 16 Oct 2017 14:15:08 -0400 Subject: gnu: wpa-supplicant: Fix "KRACK" key reinstallation attacks [security fixes]. Fixes CVE-2017-{13078,13079,13080,13081,13082,13087,13088}. See these announcements for more information: https://w1.fi/security/2017-1/wpa-packet-number-reuse-with-replayed-messages.txt https://www.krackattacks.com/ * gnu/packages/patches/wpa-supplicant-CVE-2017-13082.patch, gnu/packages/patches/wpa-supplicant-fix-key-reuse.patch, gnu/packages/patches/wpa-supplicant-fix-nonce-reuse.patch gnu/packages/patches/wpa-supplicant-fix-zeroed-keys.patch, gnu/packages/patches/wpa-supplicant-krack-followups.patch: New files. * gnu/packages/admin.scm (wpa-supplicant-minimal)[source]: Use them. * gnu/local.mk (dist_patch_DATA): Add them. --- .../patches/wpa-supplicant-fix-nonce-reuse.patch | 72 ++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 gnu/packages/patches/wpa-supplicant-fix-nonce-reuse.patch (limited to 'gnu/packages/patches/wpa-supplicant-fix-nonce-reuse.patch') diff --git a/gnu/packages/patches/wpa-supplicant-fix-nonce-reuse.patch b/gnu/packages/patches/wpa-supplicant-fix-nonce-reuse.patch new file mode 100644 index 0000000000..d8dd9cd204 --- /dev/null +++ b/gnu/packages/patches/wpa-supplicant-fix-nonce-reuse.patch @@ -0,0 +1,72 @@ +Fix a nonce re-use bug: + +https://w1.fi/security/2017-1/wpa-packet-number-reuse-with-replayed-messages.txt + +Patch copied from upstream: + +https://w1.fi/security/2017-1/rebased-v2.6-0005-Fix-PTK-rekeying-to-generate-a-new-ANonce.patch + +From 12fac09b437a1dc8a0f253e265934a8aaf4d2f8b Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Sun, 1 Oct 2017 12:32:57 +0300 +Subject: [PATCH 5/8] Fix PTK rekeying to generate a new ANonce + +The Authenticator state machine path for PTK rekeying ended up bypassing +the AUTHENTICATION2 state where a new ANonce is generated when going +directly to the PTKSTART state since there is no need to try to +determine the PMK again in such a case. This is far from ideal since the +new PTK would depend on a new nonce only from the supplicant. + +Fix this by generating a new ANonce when moving to the PTKSTART state +for the purpose of starting new 4-way handshake to rekey PTK. + +Signed-off-by: Jouni Malinen +--- + src/ap/wpa_auth.c | 24 +++++++++++++++++++++--- + 1 file changed, 21 insertions(+), 3 deletions(-) + +diff --git a/src/ap/wpa_auth.c b/src/ap/wpa_auth.c +index 707971d..bf10cc1 100644 +--- a/src/ap/wpa_auth.c ++++ b/src/ap/wpa_auth.c +@@ -1901,6 +1901,21 @@ SM_STATE(WPA_PTK, AUTHENTICATION2) + } + + ++static int wpa_auth_sm_ptk_update(struct wpa_state_machine *sm) ++{ ++ if (random_get_bytes(sm->ANonce, WPA_NONCE_LEN)) { ++ wpa_printf(MSG_ERROR, ++ "WPA: Failed to get random data for ANonce"); ++ sm->Disconnect = TRUE; ++ return -1; ++ } ++ wpa_hexdump(MSG_DEBUG, "WPA: Assign new ANonce", sm->ANonce, ++ WPA_NONCE_LEN); ++ sm->TimeoutCtr = 0; ++ return 0; ++} ++ ++ + SM_STATE(WPA_PTK, INITPMK) + { + u8 msk[2 * PMK_LEN]; +@@ -2458,9 +2473,12 @@ SM_STEP(WPA_PTK) + SM_ENTER(WPA_PTK, AUTHENTICATION); + else if (sm->ReAuthenticationRequest) + SM_ENTER(WPA_PTK, AUTHENTICATION2); +- else if (sm->PTKRequest) +- SM_ENTER(WPA_PTK, PTKSTART); +- else switch (sm->wpa_ptk_state) { ++ else if (sm->PTKRequest) { ++ if (wpa_auth_sm_ptk_update(sm) < 0) ++ SM_ENTER(WPA_PTK, DISCONNECTED); ++ else ++ SM_ENTER(WPA_PTK, PTKSTART); ++ } else switch (sm->wpa_ptk_state) { + case WPA_PTK_INITIALIZE: + break; + case WPA_PTK_DISCONNECT: +-- +2.7.4 + -- cgit v1.2.3