Skip to contentSkip to conversation

pull-request: mac80211 2017-10-16

PATCH Applied Johannes Berg 5 participants 7 messages Oct 16, 2017 – Oct 18, 2017 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi Dave,

Here's a fix, for a small part of the "KRACK" announced today (krackattacks.com).

Please pull and let me know if there's any problem.

Thanks,
johannes

The following changes since commit c0576e3975084d4699b7bfef578613fb8e1144f6:

net: call cgroup_sk_alloc() earlier in sk_clone_lock() (2017-10-10 20:24:29 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git tags/mac80211-for-davem-2017-10-16

for you to fetch changes up to fdf7cb4185b60c68e1a75e61691c4afdc15dea0e:

mac80211: accept key reinstall without changing anything (2017-10-16 13:02:03 +0200)

----------------------------------------------------------------
Just a single fix, for a WoWLAN-related part of CVE-2017-13080.

----------------------------------------------------------------
Johannes Berg (1):
mac80211: accept key reinstall without changing anything

 net/mac80211/key.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)
maintainer
#1 lore raw

From: Johannes Berg <[email protected]>
Date: Mon, 16 Oct 2017 15:46:17 +0200

Quoted 4 lines

Here's a fix, for a small part of the "KRACK" announced today (krackattacks.com).

Please pull and let me know if there's any problem.

Pulled.

A message that is not in the archive (sent off-list or not yet received): CAHmME9rHMMAgJs3uQYpt15V8eh-PjDqioqURA3KPKEhc2a9OEg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#4 lore raw
Quoted 3 lines · Jason A. Donenfeld

Mobile phone right now, so not able to write patch, but you probably should be using crypto_memneq for comparing those two keys, not memcmp.

I know that's a gut instinct, but I really don't see the point.

If you actually get this to evaluate to "equal", you're already being attacked, and the attacker already knows they're trying to get the same key to be installed again. If it's not equal, you execute so much code beneath, going to the driver etc., that I'd think this particular time is in the noise.

Also, this isn't something that the attacker can directly observe anyway, and if they can, then surely the fact that we *skip* a large amount of code when returning 0 is also observable.

Besides, the only thing that can observe the timing is hostapd or wpa_supplicant, which obviously know the key (and in the fixed versions will already have done the comparison themselves).

And lastly, if you wanted to use this as an oracle to get the key back from the kernel, then you already have admin permissions (in your network namespace), and can just sniff netlink traffic anyway.

johannes

#5 lore raw
Quoted 3 lines · Johannes Berg

If it's not equal, you execute so much code
beneath, going to the driver etc., that I'd think this particular time is in the noise.

Usually presumptions like this get you in trouble when some crafty academic has a smart idea about that noise. I'll send a patch.

A message that is not in the archive (sent off-list or not yet received): CAHmME9qd_m-FDj1E+eiBYWKvnMBvr0tWVcJ4ph2tr=Y1d_tb1g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#7 lore raw

PATCH 1/1 mac80211: use constant time comparison with keys

Otherwise we risk leaking information via timing side channel.

Fixes fdf7cb4185b6 ("mac80211: accept key reinstall without changing anything")
---
 net/mac80211/key.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac80211/key.c +2 -1
index ae995c8480db..035d16fe926e 100644
@@ -19,6 +19,7 @@
 #include <linux/slab.h>
 #include <linux/export.h>
 #include <net/mac80211.h>
+#include <crypto/algapi.h>
 #include <asm/unaligned.h>
 #include "ieee80211_i.h"
 #include "driver-ops.h"
@@ -635,7 +636,7 @@ int ieee80211_key_link(struct ieee80211_key *key,
 	 * 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)) {
+	    !crypto_memneq(key->conf.key, old_key->conf.key, key->conf.keylen)) {
 		ieee80211_key_free_unused(key);
 		ret = 0;
 		goto out;
Signature · 1 line
2.14.2
maintainer Applied
#8 lore raw

Re: [PATCH] mac80211: use constant time comparison with keys

Quoted 2 lines · Jason A. Donenfeld

Otherwise we risk leaking information via timing side channel.

Applied.

johannes