NetBSD/sys/netinet6
maxv 71ad96023a Fix a buffer overflow in ip6_get_prevhdr. Doing
mtod(m, char *) + len

is wrong, an option is allowed to be located in another mbuf of the chain.
If the offset of an option within the chain is bigger than the length of
the first mbuf in that chain, we are reading/writing one byte of packet-
controlled data beyond the end of the first mbuf.

The length of this first mbuf depends on the layout the network driver
chose. In the most difficult case, it will allocate a 2KB cluster, which
is bigger than the Ethernet MTU.

But there is at least one way of exploiting this case: by sending a
special combination of nested IPv6 fragments, the packet can control a
good bunch of 'len'. By luck, the memory pool containing clusters does not
embed the pool header in front of the items, so it is not straightforward
to predict what is located at 'mtod(m, char *) + len'.

However, by sending offending fragments in a loop, it is possible to
crash the kernel - at some point we will hit important data structures.

As far as I can tell, PF protects against this difficult case, because
it kicks nested fragments. NPF does not protect against this. IPF I don't
know.

Then there are the more easy cases, if the MTU is bigger than a cluster,
or if the network driver did not allocate a cluster, or perhaps if the
fragments are received via a tunnel; I haven't investigated these cases.

Change ip6_get_prevhdr so that it returns an offset in the chain, and
always use IP6_EXTHDR_GET to get a writable pointer. IP6_EXTHDR_GET
leaves M_PKTHDR untouched.

This place is still fragile.
2018-01-30 14:49:25 +00:00
..
dccp6_usrreq.c
dccp6_var.h
dest6.c Fix the calculation of the ICMP6 error pointer. It is not correct to use 2018-01-23 15:13:56 +00:00
files.netinet6
frag6.c Fix a buffer overflow in ip6_get_prevhdr. Doing 2018-01-30 14:49:25 +00:00
icmp6_private.h
icmp6.c Style, localify, remove XXX when there's no issue, and switch 'extra' 2018-01-23 10:55:38 +00:00
in6_cksum.c
in6_gif.c apply in{,6}_tunnel_validate() to gif(4). 2018-01-10 11:13:26 +00:00
in6_gif.h preserve gif(4) configs by psref(9) like vlan(4) and l2tp(4). 2017-11-27 05:02:22 +00:00
in6_ifattach.c Fix constraint violation of pserialize in in6_ifattach 2018-01-24 03:44:10 +00:00
in6_ifattach.h
in6_l2tp.c Several fixes in L2TP: 2018-01-26 07:49:15 +00:00
in6_l2tp.h
in6_offload.c
in6_offload.h
in6_pcb.c Add missing curlwp_bindx 2017-12-22 09:53:06 +00:00
in6_pcb.h
in6_print.c
in6_proto.c Take softnet_lock on pr_input properly if NET_MPSAFE 2017-09-27 10:05:04 +00:00
in6_src.c Treat unvalidated addresses as deprecated in rule 3. 2017-12-06 14:17:42 +00:00
in6_var.h
in6.c Suppress noisy debugging outputs 2018-01-19 08:01:05 +00:00
in6.h add ipsec(4) interface, which is used for route-based VPN. 2018-01-10 10:56:30 +00:00
ip6_etherip.c A few fixes: 2018-01-26 14:47:41 +00:00
ip6_etherip.h
ip6_flow.c Style, and use __cacheline_aligned. 2018-01-29 08:27:10 +00:00
ip6_forward.c style 2018-01-29 08:17:18 +00:00
ip6_id.c
ip6_input.c Fix a buffer overflow in ip6_get_prevhdr. Doing 2018-01-30 14:49:25 +00:00
ip6_mroute.c
ip6_mroute.h
ip6_output.c Ensure to call if_mcast_op with holding IFNET_LOCK 2017-12-15 04:03:46 +00:00
ip6_private.h
ip6_var.h Fix a buffer overflow in ip6_get_prevhdr. Doing 2018-01-30 14:49:25 +00:00
ip6protosw.h Take softnet_lock on pr_input properly if NET_MPSAFE 2017-09-27 10:05:04 +00:00
ipsec.h
Makefile
mld6_var.h
mld6.c Provide macros for softnet_lock and KERNEL_LOCK hiding NET_MPSAFE switch 2017-11-17 07:37:12 +00:00
nd6_nbr.c Make DAD destructions (MP-)safe with callout_stop 2018-01-16 08:13:47 +00:00
nd6_rtr.c Get rid of unnecessary splsoftnet (redo) 2018-01-26 06:49:02 +00:00
nd6.c more cleanup (don't allow oldlenp == NULL) 2018-01-29 19:51:15 +00:00
nd6.h
pim6_var.h
pim6.h
raw_ip6.c Fix a buffer overflow in ip6_get_prevhdr. Doing 2018-01-30 14:49:25 +00:00
raw_ip6.h
route6.c
scope6_var.h
scope6.c
sctp6_usrreq.c Make SCTP work when IPSEC is also defined. 2017-10-17 19:23:42 +00:00
sctp6_var.h
udp6_output.c
udp6_private.h
udp6_usrreq.c
udp6_var.h
udp6.h