]> git.baikalelectronics.ru Git - kernel.git/commit
ipv6: make exception cache less predictible
authorEric Dumazet <edumazet@google.com>
Sun, 29 Aug 2021 22:16:14 +0000 (15:16 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 30 Aug 2021 11:21:38 +0000 (12:21 +0100)
commit3f3f6face63c55f67858e6aab30d649d718ec7b7
tree0bf30781380505edb5bb38f83d5b1c84dd83bed1
parentfeba5bf506435ee2ab84fef92b547fef23f91d86
ipv6: make exception cache less predictible

Even after commit f2458775b74d ("ipv6: use siphash in rt6_exception_hash()"),
an attacker can still use brute force to learn some secrets from a victim
linux host.

One way to defeat these attacks is to make the max depth of the hash
table bucket a random value.

Before this patch, each bucket of the hash table used to store exceptions
could contain 6 items under attack.

After the patch, each bucket would contains a random number of items,
between 6 and 10. The attacker can no longer infer secrets.

This is slightly increasing memory size used by the hash table,
we do not expect this to be a problem.

Following patch is dealing with the same issue in IPv4.

Fixes: 1070a04a91f8 ("ipv6: introduce a hash table to store dst cache")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Keyu Man <kman001@ucr.edu>
Cc: Wei Wang <weiwan@google.com>
Cc: Martin KaFai Lau <kafai@fb.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/route.c