[linux] 01/02: mac80211: accept key reinstall without changing anything (CVE-2017-13080)

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Thu Nov 16 14:23:58 UTC 2017


This is an automated email from the git hooks/post-receive script.

carnil pushed a commit to branch sid
in repository linux.

commit 5d9e74ced8d8ded0e830f09be2e93b8d0d2b5157
Author: Salvatore Bonaccorso <carnil at debian.org>
Date:   Thu Nov 16 15:17:25 2017 +0100

    mac80211: accept key reinstall without changing anything (CVE-2017-13080)
---
 debian/changelog                                   |  1 +
 ...cept-key-reinstall-without-changing-anyth.patch | 82 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 84 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 096d892..e28565f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -85,6 +85,7 @@ linux (4.13.12-1) UNRELEASED; urgency=medium
 
   [ Salvatore Bonaccorso ]
   * netfilter: nft_set_hash: disable fast_ops for 2-len keys (Closes: #880145)
+  * mac80211: accept key reinstall without changing anything (CVE-2017-13080)
 
   [ Ben Hutchings ]
   * linux-image: Recommend apparmor, as systemd units with an AppArmor
diff --git a/debian/patches/bugfix/all/mac80211-accept-key-reinstall-without-changing-anyth.patch b/debian/patches/bugfix/all/mac80211-accept-key-reinstall-without-changing-anyth.patch
new file mode 100644
index 0000000..1f236ad
--- /dev/null
+++ b/debian/patches/bugfix/all/mac80211-accept-key-reinstall-without-changing-anyth.patch
@@ -0,0 +1,82 @@
+From: Johannes Berg <johannes.berg at intel.com>
+Date: Tue, 5 Sep 2017 14:54:54 +0200
+Subject: mac80211: accept key reinstall without changing anything
+Origin: https://git.kernel.org/linus/fdf7cb4185b60c68e1a75e61691c4afdc15dea0e
+Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2017-13080
+
+When a key is reinstalled we can reset the replay counters
+etc. which can lead to nonce reuse and/or replay detection
+being impossible, breaking security properties, as described
+in the "KRACK attacks".
+
+In particular, CVE-2017-13080 applies to GTK rekeying that
+happened in firmware while the host is in D3, with the second
+part of the attack being done after the host wakes up. In
+this case, the wpa_supplicant mitigation isn't sufficient
+since wpa_supplicant doesn't know the GTK material.
+
+In case this happens, simply silently accept the new key
+coming from userspace but don't take any action on it since
+it's the same key; this keeps the PN replay counters intact.
+
+Signed-off-by: Johannes Berg <johannes.berg at intel.com>
+---
+ net/mac80211/key.c | 21 +++++++++++++++++----
+ 1 file changed, 17 insertions(+), 4 deletions(-)
+
+diff --git a/net/mac80211/key.c b/net/mac80211/key.c
+index a98fc2b5e0dc..ae995c8480db 100644
+--- a/net/mac80211/key.c
++++ b/net/mac80211/key.c
+@@ -4,7 +4,7 @@
+  * Copyright 2006-2007	Jiri Benc <jbenc at suse.cz>
+  * Copyright 2007-2008	Johannes Berg <johannes at sipsolutions.net>
+  * Copyright 2013-2014  Intel Mobile Communications GmbH
+- * Copyright 2015	Intel Deutschland GmbH
++ * Copyright 2015-2017	Intel Deutschland GmbH
+  *
+  * This program is free software; you can redistribute it and/or modify
+  * it under the terms of the GNU General Public License version 2 as
+@@ -620,9 +620,6 @@ int ieee80211_key_link(struct ieee80211_key *key,
+ 
+ 	pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE;
+ 	idx = key->conf.keyidx;
+-	key->local = sdata->local;
+-	key->sdata = sdata;
+-	key->sta = sta;
+ 
+ 	mutex_lock(&sdata->local->key_mtx);
+ 
+@@ -633,6 +630,21 @@ int ieee80211_key_link(struct ieee80211_key *key,
+ 	else
+ 		old_key = key_mtx_dereference(sdata->local, sdata->keys[idx]);
+ 
++	/*
++	 * Silently accept key re-installation without really installing the
++	 * new version of the key to avoid nonce reuse or replay issues.
++	 */
++	if (old_key && key->conf.keylen == old_key->conf.keylen &&
++	    !memcmp(key->conf.key, old_key->conf.key, key->conf.keylen)) {
++		ieee80211_key_free_unused(key);
++		ret = 0;
++		goto out;
++	}
++
++	key->local = sdata->local;
++	key->sdata = sdata;
++	key->sta = sta;
++
+ 	increment_tailroom_need_count(sdata);
+ 
+ 	ieee80211_key_replace(sdata, sta, pairwise, old_key, key);
+@@ -648,6 +660,7 @@ int ieee80211_key_link(struct ieee80211_key *key,
+ 		ret = 0;
+ 	}
+ 
++ out:
+ 	mutex_unlock(&sdata->local->key_mtx);
+ 
+ 	return ret;
+-- 
+2.15.0
+
diff --git a/debian/patches/series b/debian/patches/series
index f7e0a40..a10d1fb 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -114,6 +114,7 @@ features/all/lockdown/arm64-add-kernel-config-option-to-lock-down-when.patch
 
 # Security fixes
 debian/i386-686-pae-pci-set-pci-nobios-by-default.patch
+bugfix/all/mac80211-accept-key-reinstall-without-changing-anyth.patch
 
 # Fix exported symbol versions
 bugfix/alpha/alpha-restore-symbol-versions-for-symbols-exported-f.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux.git



More information about the Kernel-svn-changes mailing list