-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 NetBSD Security Advisory 2016-004 ================================= Topic: Multiple vulnerabilities in the compatibility layers Version: NetBSD current: source prior to Sat, Aug 8th 2015 NetBSD 7.0: affected NetBSD 6.1 - 6.1.4: affected NetBSD 6.0 - 6.0.5: affected Severity: Local DoS / Kernel execution redirection Fixed: NetBSD-current: Sat, Aug 8th 2015 NetBSD-7.0: source prior to Sun, Aug 2nd 2015 NetBSD-6-0 branch: source prior to Thu, Apr 21st 2016 NetBSD-6-1 branch: source prior to Thu, Apr 21st 2016 NetBSD-6 branch: source prior to Thu, Apr 21st 2016 Teeny versions released later than the fix date will contain the fix. Please note that NetBSD releases prior to 6.0 are no longer supported. It is recommended that all users upgrade to a supported release. Abstract ======== Several compatibility layers are affected by several vulnerabilities: 1) NetBSD 32bit compatibility: Memory leak in sendmsg 2) NetBSD 32bit compatibility: Buffer Overflow in ioctl 3) Digital UNIX (formerly OSF/1) compatibility: Zero-sized memory allocation Each of them allows a local user to crash the system. Technical Details ================= For more clarity the layers affected will be referred to as COMPAT_xx, where xx is the emulated system. 1) A memory leak COMPAT_NETBSD32's sendmsg system call could allow a local unprivileged user to make the kernel run out of memory, and eventually panic. 2) An inverted logic in COMPAT_NETBSD32's ioctl system call could allow a local unprivileged user to control the size given to a memcpy on the kernel side, thereby allowing that user to overwrite kernel heap. 3) Due to a missing input validation check in COMPAT_OSF1's sendmsg system call, a user could cause the kernel to perform a zero-sized memory allocation, resulting in a crash. Solutions and Workarounds ========================= - - Disable the compability modules - --------------------------------- You can achieve this with the modunload(8) tool. Please read the appropriate manual page. For example, you can disable the Linux modules by moving the kernel object files out of the way. These are located in: /stand/${MACHINE_ARCH}/${KERNEL_VERSION}/modules/compat_${NAME}/compat_${NAME}.kmod And running the following command to unload them: # modunload compat_${NAME} The modules have dependencies, so you need to unload them in the proper order. You can also disable these modules by rebuilding your kernel without the COMPAT_${NAME} options. Note however that it is to be considered as a temporary workaround, and you are strongly advised to fix your system from source. - - Fix from source - ----------------- 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 - ---- ---- -------- -------- ------------ ---------- src/sys/compat/netbsd32/netbsd32_socket.c 1.42 1.41.14.1 1.39.2.3 1.39.2.2.6.1 1.39.2.2.4.1 src/sys/compat/netbsd32/netbsd32_ioctl.c 1.82 1.69.4.1 1.64.8.2 1.64.14.1 1.64.12.1 src/sys/compat/osf1/osf1_socket.c 1.21 N/A 1.20.14.1 1.20.28.1 1.20.20.1 To update from CVS, re-build, and re-install the kernel: # cd src # cvs update -d -P -r VERSION sys/compat/netbsd32/netbsd32_socket.c # cvs update -d -P -r VERSION sys/compat/netbsd32/netbsd32_ioctl.c # cvs update -d -P -r VERSION sys/compat/osf1/osf1_socket.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 finding and fixing these issues. Revision History ================ 2016-04-21 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-SA2016-004.txt.asc Information about NetBSD and NetBSD security can be found at http://www.NetBSD.org/ and http://www.NetBSD.org/Security/ . Copyright 2016, The NetBSD Foundation, Inc. All Rights Reserved. Redistribution permitted only in full, unmodified form. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXGPy7AAoJEAZJc6xMSnBul38QAK9ThlsobI/VoOCoq9FqF+cQ 9NHFv2Q4GqS52JFcDTm/GN+Qcs32rjAvsSKjO78L5t6JOrmjxvTJJCUAHe6iB44q gbNssQzGjE8TWewVpKe5SBlexYHrWe2M7uZoygnSISJevZDV5AMpFNNZrRmlNtwb CRMmBDe9qfZou0IJi33gg5zs18xP9GDoD8mgPCYAACTnEjMruwhq+ctEZU8l2lg0 3BxHYTA029vBVH4BL3OA4pqEh6mJtkqtxNLr8S+3A2CIMH1zCEX4aFp5Nd1dnWD/ w4DN94mhLyVsoghXYw+UPVMEJ3WjCmb4YBnp/bqcUc5hR0BbeHK7Zl2+Ji3qda4l XQNxa5nmSfz/gwiHcjgCCMERj8JgGnH6HyRhWPl+BbSUGaxViPQ2z4pr06c09/C+ XJzCp1dlygrVxLAz8X3ZDBMzF+5QNMCaYi1w3DNj+8ZCxCdVmH54LSupzRRd8Hhe 0Few6+j7pvvC9hcYcHYE0NJcwZavp2euJVUWez3nCvvb4HSkN3lt2lqv5bNFizpL ktwhuOwiRYLZ0SniHRbjqonELepdnM7MteGUdBnd0dKQRe5gqkS3c3uJWj/U4WT2 7K1lVuZEzffIEnIS9ptrj6aLKHtq9Pb3R2BhL6oQeXqX4eC8YFgxLsVBHP8jIcMC RtLYR3zpSOgZJk8+D6YY =VJG3 -----END PGP SIGNATURE-----