NetBSD Security Advisory 2014-012: Memory leak in the setsockopt system call
9 September, 2014 by security-officer@NetBSD.org | netbsd
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 NetBSD Security Advisory 2014-012 ================================= Topic: Memory leak in the setsockopt system call Version: NetBSD-current: source prior to Sat, Aug 16th 2014 NetBSD 6.1 - 6.1.4: affected NetBSD 6.0 - 6.0.5: affected NetBSD 5.1 - 5.1.4: affected NetBSD 5.2 - 5.2.2: affected Severity: Local DoS Fixed: NetBSD-current: Sat, Aug 16th 2014 NetBSD-7 branch: Sun, Aug 24th 2014 NetBSD-6-0 branch: Wed, Aug 27th 2014 NetBSD-6-1 branch: Wed, Aug 27th 2014 NetBSD-6 branch: Wed, Aug 27th 2014 NetBSD-5.2 branch: Wed, Aug 27th 2014 NetBSD-5.1 branch: Wed, Aug 27th 2014 NetBSD-5 branch: Wed, Aug 27th 2014 Teeny versions released later than the fix date will contain the fix. Please note that NetBSD releases prior to 5.1 are no longer supported. It is recommended that all users upgrade to a supported release. Abstract ======== A memory leak in the kernel could allow a local user to use up kernel memory via repeated calls to the setsockopt system call, and thus to freeze - or eventually panic - the system. Technical Details ================= When calling the setsockopt system call on an ipv6 socket with specific arguments, a kernel buffer allocated to temporarily hold the socket option data was not freed. Performing such a call in a loop would cause the kernel to run out of memory and eventually panic. Solutions and Workarounds ========================= 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), KERNCONF with the name of your kernel configuration file and VERSION with the file version below File versions containing the fixes: FILE HEAD netbsd-7 netbsd-6 netbsd-6-1 netbsd-6-0 ---- ---- -------- -------- ---------- ---------- sys/netinet6/ip6_output.c 1.158 1.157.2.1 1.145.2.1 1.145.8.1 1.145.6.1 FILE netbsd-5 netbsd-5-2 netbsd-5-1 ---- -------- ---------- ---------- sys/netinet6/ip6_output.c 1.135.2.2 1.135.2.1.10.1 1.135.2.1.6.1 To update from CVS, re-build, and re-install the kernel: # cd src # cvs update -d -P -r VERSION sys/netinet6/ip6_output.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/guide/en/chap-kernel.html Thanks To ========= Thanks to Maxime Villard for developing a code scanner which detected the issue, and Ryota Ozaki for helping in developing a fix. Revision History ================ 2014-09-08 Initial release More Information ================ Advisories may be updated as new information becomes available. The most recent version of this advisory (PGP signed) can be found at http://ftp.NetBSD.org/pub/NetBSD/security/advisories/NetBSD-SA2014-012.txt.asc Information about NetBSD and NetBSD security can be found at http://www.NetBSD.org/ and http://www.NetBSD.org/Security/ . Copyright 2014, The NetBSD Foundation, Inc. All Rights Reserved. Redistribution permitted only in full, unmodified form. $NetBSD: NetBSD-SA2014-012.txt,v 1.1 2014/09/08 21:18:53 tonnerre Exp $ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJUDh1JAAoJEAZJc6xMSnBuHwUP/3OPLYDozc7WuD+zFjhQaSzr 82ClbsCHvjTz+DdJ/jOXsQLK9GQI61jfqWxdB8uwUl5S+bel/Tcz/DUgtFdhOxT0 +xQ2AwgNnkMz4fnfobdVnUT6GSa+U4UJPjVytTqstTMdJLik8EawJookLL7hAFdc l7usjjWkM0Gemzu6js1RGPFynvyFkSYBTXJGr5pJQbnpZkC0HtKqe/svquJYFe3a TxddHAOMkxfNSrf0Wn8vBWeaTQ7Vc70ZJ/ZuxiczZsE/5Voq+ois73u0uAknCCu+ 6lk2Tm3OmkK0mE25Q4iXRtPw0ogOmRa5RfyzYSWLvQ5cD5S0GrqQYrYAFAdHxaGV LUSP4FmWTKYi/JOjTlgUKjFpysQANbY6o6NTCJeKnNfkcZBQZpe3xIC74mQaSGgv fAhZ7s//ZY+jeusl/GAbA00rQLG3BPFXjSFyfL8NW//sWsZqd6YXV51YLJMTIVVm Up2j7EUCszWKQWqIQjRtnl09ZaWBdr3i+3tpOa78elg5v1zuCFohQK0uB3v+klEU xSsuvgwqzVnVjBniG3NNk+RSnaaTE8JGwgtAo8wGdjpLNkye6xQEzZW/3F7S9fXW qX+Rm4aXspf9hINChCjOSzs/576ffmpsypE8PvDYPgbV6EjRC2pO4wq3IbuZGI4R C7h9rpPfO6GxW3oKjMOb =RKxi -----END PGP SIGNATURE-----