NetBSD Security Advisory 2020-002: Specific ICMPv6 error message packet can crash the system
11 March, 2020 by security-officer@netbsd.org | netbsd
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 NetBSD Security Advisory 2020-002 ================================= Topic: Specific ICMPv6 error message packet can crash the system Version: NetBSD-current: affected untill January 23, 2020 NetBSD 9.0: not affected NetBSD 8.1: affected NetBSD 7.x: not affected Severity: Remote packets can crash the machine Fixed: NetBSD-current: January 23, 2020 NetBSD-9 branch: January 23, 2020 NetBSD-8 branch: January 23, 2020 NetBSD-7 branch: not affected Please note that NetBSD releases prior to 7.1 are no longer supported. It is recommended that all users upgrade to a supported release. Abstract ======== Due to a mistake in IP-IP tunnel packet processing, a malicious ICMPv6 error message packet whose payload is an IP-IP tunnel packet can cause incorrect resource freeing leading to a system crash. This is a remote DoS, that affects all systems that have IPv6 enabled. Technical Details ================= NetBSD-7 is not affected since it does not use the resource that is erroneously being freed. Solutions and Workarounds ========================= 1. Filter out ICMPv6 'packet too big'-type packets using NPF. Here's an example npf.conf file, assuming wm0 is the interface to be protected: $int_if = ifaddrs(wm0) group default { block in final on $int_if family inet6 proto ipv6-icmp icmp-type 2 all pass in on $int_if all pass out on $int_if all } Note that this workaround disables reception of packet-too-big icmp6 messages which are necessary for the host to perform pmtu discovery. If a remote host is on a network with a smaller MTU, IPv6 communication may not work properly. 2. Update the kernel to a fixed version and reboot. To apply a fixed version from a releng build, fetch a fitting kern-GENERIC.tgz from nyftp.netbsd.org and extract the fixed binaries: cd /var/tmp ftp https://nycdn.NetBSD.org/pub/NetBSD-daily/REL/latest/ARCH/binary/sets/kern-GENERIC.tgz cd / tar xzpf /var/tmp/kern-GENERIC.tgz with the following replacements: REL = the release version you are using ARCH = your system's architecture The following instructions describe how to upgrade your kernel by updating your source tree and rebuilding and installing a new version. For all NetBSD versions, you need to obtain fixed kernel sources, rebuild and install the new kernel, and reboot the system. The fixed source may be obtained from the NetBSD CVS repository. The following instructions briefly summarise how to upgrade your kernel. In these instructions, replace: ARCH with your architecture (from uname -m), and KERNCONF with the name of your kernel configuration file. To update from CVS, re-build, and re-install the kernel: # cd src # cvs update -d -P src/sys/netinet/ip_encap.c # ./build.sh kernel=KERNCONF # mv /netbsd /netbsd.old # cp sys/arch/ARCH/compile/obj/KERNCONF/netbsd /netbsd # shutdown -r now For more information on how to do this, see: http://www.NetBSD.org/docs/guide/en/chap-kernel.html The patches can be obtained from NetBSD-current with the following command: cvs rdiff -u -r1.71 -r1.72 src/sys/netinet/ip_encap.c Thanks To ========= Yasuhiro Ohishi for pointing out the problem. Kengo Nakahara for providing the fix. More Information ================ Advisories may be updated as new information becomes available. The most recent version of this advisory (PGP signed) can be found at https://ftp.NetBSD.org/pub/NetBSD/security/advisories/NetBSD-SA2020-002.txt.asc Information about NetBSD and NetBSD security can be found at https://www.NetBSD.org/ https://www.NetBSD.org/Security/ Copyright 2020, The NetBSD Foundation, Inc. All Rights Reserved. Redistribution permitted only in full, unmodified form. $NetBSD: NetBSD-SA2020-002.txt.asc,v 1.3 2020/03/11 02:33:04 christos Exp $ -----BEGIN PGP SIGNATURE----- iQIcBAEBAgAGBQJeaE2fAAoJEIkmHhf170n/3FsP/00Wnw3rg9ykFcVZMO0B86eK VUWT1G3a+cDSAyUWlpXmNRTqIzsHBZYCjb+OMiI79Gwsa2IqED9QGiJRL5zaOzhk 3XhDzo3/ibIR2c+4F970At+t+C37EAVCbpQrQpIgFjM78M+Y9CiZXq2jvDqCzC/W XKhZ8t9EvwUdygQ5lT1IJXZb/uHpbewhNTwcqEbzdlXtNoSFaPmixJODGF82nhSa SW/AobdEv9GeHjNCBAtVpcvBTy4o/wbYxDmF5gH+5X6360abvOBRWCbTjjiL+ecK uQA9rDd1CDNaR+g4tjs1TtEFFdg1DfYOwtXyrgpa4t/EF9X3HaOGqlXxGyzjn4fJ SQbKvSYY4k/RFa7rQ7ACztuimjSswDvoGd0V1AmtkMflBXnUPsnN60DrueWjws0c Bab+kKXfnwVrrMoSqqHH1uVCJHxjsIUbsqo/gJP9mDskg6t1lmIrne2eIWh+MJ9b CPkas5i1vPRjj7+1w5vslQEaENPwN4gVAXtT45orRW5f0VNdFs79mvq9Xmqtd/xD rIrQu19oOMIEdswVQurkwvTJ1F3ul+mOVhrfSw/QS/RX++2upQ+q5ZEWKym7+9TQ MG+FFl410sob/jFIrExOIQU5YTdIdIs6XVAJzOgliirc221eAVnxOWo9qV03VqdW +DlHwc4pXmWep7qW8jGX =YhmF -----END PGP SIGNATURE-----