History

ipv6: add option to drop unicast encapsulated in L2 multicast

In order to solve a problem with 802.11, the so-called hole-196 attack, add an option (sysctl) called "drop_unicast_in_l2_multicast" which, if enabled, causes the stack to drop IPv6 unicast packets encapsulated in link-layer multi- or broadcast frames. Such frames can (as an attack) be created by any member of the same wireless network and transmitted as valid encrypted frames since the symmetric key for broadcast frames is shared between all stations.

Johannes Berg committed 10 years ago

Commit abbc3041 parent 97daf335 files · +26 −0Browse files

Unified · Split

5 files
  1. Documentation/networking/ip-sysctl.txt +6 −0
  2. include/linux/ipv6.h +1 −0
  3. include/uapi/linux/ipv6.h +1 −0
  4. net/ipv6/addrconf.c +8 −0
  5. net/ipv6/ip6_input.c +10 −0
Documentation/networking/ip-sysctl.txt+6−0
@@ -1674,6 +1674,12 @@ stable_secret - IPv6 address · 1673 unmodified lines
16741674
16751675 By default the stable secret is unset.
16761676
1677+drop_unicast_in_l2_multicast - BOOLEAN
1678+ Drop any unicast IPv6 packets that are received in link-layer
1679+ multicast (or broadcast) frames.
1680+
1681+ By default this is turned off.
1682+
16771683 icmp/*:
16781684 ratelimit - INTEGER
16791685 Limit the maximal rates for sending ICMPv6 packets.
include/linux/ipv6.h+1−0
@@ -50,6 +50,7 @@ struct ipv6_devconf { · 49 unmodified lines
5050 __s32 mc_forwarding;
5151 #endif
5252 __s32 disable_ipv6;
53+ __s32 drop_unicast_in_l2_multicast;
5354 __s32 accept_dad;
5455 __s32 force_tllao;
5556 __s32 ndisc_notify;
include/uapi/linux/ipv6.h+1−0
@@ -174,6 +174,7 @@ enum { · 173 unmodified lines
174174 DEVCONF_USE_OIF_ADDRS_ONLY,
175175 DEVCONF_ACCEPT_RA_MIN_HOP_LIMIT,
176176 DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN,
177+ DEVCONF_DROP_UNICAST_IN_L2_MULTICAST,
177178 DEVCONF_MAX
178179 };
179180
net/ipv6/addrconf.c+8−0
@@ -4711,6 +4711,7 @@ static inline void ipv6_store_devconf(struct ipv6_devconf *cnf, · 4710 unmodified lines
47114711 array[DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN] = cnf->ignore_routes_with_linkdown;
47124712 /* we omit DEVCONF_STABLE_SECRET for now */
47134713 array[DEVCONF_USE_OIF_ADDRS_ONLY] = cnf->use_oif_addrs_only;
4714+ array[DEVCONF_DROP_UNICAST_IN_L2_MULTICAST] = cnf->drop_unicast_in_l2_multicast;
47144715 }
47154716
47164717 static inline size_t inet6_ifla6_size(void)
@@ -5784,6 +5785,13 @@ static struct addrconf_sysctl_table · 1067 unmodified lines
57845785 .mode = 0644,
57855786 .proc_handler = addrconf_sysctl_ignore_routes_with_linkdown,
57865787 },
5788+ {
5789+ .procname = "drop_unicast_in_l2_multicast",
5790+ .data = &ipv6_devconf.drop_unicast_in_l2_multicast,
5791+ .maxlen = sizeof(int),
5792+ .mode = 0644,
5793+ .proc_handler = proc_dointvec,
5794+ },
57875795 {
57885796 /* sentinel */
57895797 }
net/ipv6/ip6_input.c+10−0
@@ -134,6 +134,16 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt · 133 unmodified lines
134134 IPV6_ADDR_MC_SCOPE(&hdr->daddr) == 1)
135135 goto err;
136136
137+ /* If enabled, drop unicast packets that were encapsulated in link-layer
138+ * multicast or broadcast to protected against the so-called "hole-196"
139+ * attack in 802.11 wireless.
140+ */
141+ if (!ipv6_addr_is_multicast(&hdr->daddr) &&
142+ (skb->pkt_type == PACKET_BROADCAST ||
143+ skb->pkt_type == PACKET_MULTICAST) &&
144+ idev->cnf.drop_unicast_in_l2_multicast)
145+ goto err;
146+
137147 /* RFC4291 2.7
138148 * Nodes must not originate a packet to a multicast address whose scope
139149 * field contains the reserved value 0; if such a packet is received, it

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t