-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 NetBSD Security Advisory 2013-013 ================================= Topic: Memory leak when trying to execute bogus ELF binaries Version: NetBSD-current: affected prior to 2013-12-18 NetBSD 6.1*: affected NetBSD 6.0: affected NetBSD 5.2*: not affected NetBSD 5.1*: not affected Severity: Local user denial of service Fixed: NetBSD-current: December 17, 2013 NetBSD-6-0 branch: December 17, 2013 NetBSD-6-1 branch: December 17, 2013 NetBSD-6 branch: December 17, 2013 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 ======== Due to a kernel bug a buffer was not freed when probing a binary for execution if the "interpreter" of that binary did not exist, an authenticated attacker can exhaust kernel memory by running binaries with non-existent ELF interpreter paths. On systems with the standard toolchain installed, creating such bogus binaries is very easy. Technical Details ================= When trying to execute a binary (or script), the kernel looks up the corresponding "interpreter" (in case of native dynamic ELF binaries: the dynamic linker ld.elf_so). If this interpreter does not exist, the path buffer memory allocated for that interpreter during the probe was not freed. If a standard toolchain is installed, a local user can easily create such broken binaries by passing the -dynamic-linker switch to the linker. Trying to execute such a broken binary in a loop would cause the kernel to run out of memory and eventually crash. 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), and KERNCONF with the name of your kernel configuration file. VERSION with the file version below File versions containing the fix: branch VERSION HEAD 1.45 netbsd-6 1.44.14.1 netbsd-6-1 1.44.28.1 netbsd-6-0 1.44.20.1 To update from CVS, re-build, and re-install the kernel: # cd src # cvs update -d -P -r VERSION src/sys/compat/common/compat_util.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 ========= Maxime Villard for notifying us of the issue and providing a patch. Revision History ================ 2013-12-19 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-SA2013-013.txt.asc Information about NetBSD and NetBSD security can be found at http://www.NetBSD.org/ and http://www.NetBSD.org/Security/ . Copyright 2013, The NetBSD Foundation, Inc. All Rights Reserved. Redistribution permitted only in full, unmodified form. $NetBSD: NetBSD-SA2013-013.txt,v 1.1 2013/12/19 20:36:48 tonnerre Exp $ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (NetBSD) iQIcBAEBAgAGBQJSs1kBAAoJEAZJc6xMSnBuCUMQALlDcmhWdLfFxZucUt13cjQm 25R+dObjr5TLUIslkO4nxo4er+1s6rLhZdYaflJXh9JCfa/7e9k89S8vrgocDm3n MpePW8cxy+TEqAaSEEL4UOwKg6FEJ5m3D/5oYL7u73WcltrIP+Q7I4pGUBpVf4w8 qjpixRcL77sTtnjG+6BqB3V+YvwrKcNu1yFMbZZt/lf4PyUM7uPIrNsPej7G3nBR Kbdbl0MjYVWStBtYuZ4+31CkrgrRiZbZJmjSOiphvBkzn6u9FPhJQ7j8QcK03G2h JIGsGp9X0lYK6b0pDplhIG3sGeHtImt/Qo5DQpQ2VChnvYAEbs9ysIfuZX2Qx+Ft lD6fiO+m8JNEFbU7Y0+UDwdz7ITr5IHz1uGk+qtwNAV1InAHhzwoxo88VqM64SaH tzt9fdHrZ6/GEW0PLZw2FOMRtl05goEURLZcNome/9ljXqUm4UZt6MuKS2Fd7tBC Mmfr3ydPlZ43S30QmhYcpFYRQi7BI/VmDiydXSeHjrzVDS6CsUHr38Jz6Og0SIjQ f3m6m5lHbpA2OlkVvuRWhrmcdAEo0hDKuRz1lZ4bpMwFalunaAcrYsQSdJ6gKfu8 YtCYn85GWFvl6KmWZt0MajTwqfjfaCNKdSdSi5LvCEAyVJZr/zXx7FOjfYcWDymk nvaLUa0l/q8SIcFz6ADm =c3Hq -----END PGP SIGNATURE-----