-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
NetBSD Security Advisory 2015-004
=================================
Topic: Two vulnerabilities in the compatibility layers
Version: NetBSD-current: source prior to Fri, Oct 10th 2014
NetBSD 6.1 - 6.1.5: affected
NetBSD 6.0 - 6.0.5: affected
NetBSD 5.1 - 5.1.5: affected
NetBSD 5.2 - 5.2.3: affected
Severity: Local DoS
Fixed: NetBSD-current: Fri, 10 Oct 2014
NetBSD-6-0 branch: Sun, 19 Oct 2014
NetBSD-6-1 branch: Sun, 19 Oct 2014
NetBSD-6 branch: Sun, 19 Oct 2014
NetBSD-5-2 branch: Mon, 27 Oct 2014
NetBSD-5-1 branch: Mon, 27 Oct 2014
NetBSD-5 branch: Mon, 27 Oct 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
========
Two compatibility layers are affected by two vulnerabilities:
1) FreeBSD compatibility: Unsanitized userland pointer
2) NetBSD 32-bit compatibility: Zero-sized memory allocation
Each of them allows a local user to crash the system.
COMPAT_FREEBSD is available on amd64, i386 and xen, and default-on
for the i386 GENERIC, XEN3_DOM0 and XEN3_DOMU kernels.
COMPAT_NETBSD32 is available and usually default-on on 64bit ports.
Technical Details
=================
For more clarity the two layers affected will be referred to as
COMPAT_xx, where xx is the emulated system.
1) Due to a missing input validation check in COMPAT_FREEBSD's sysctl
system call, the kernel could read memory pointed to by an unsanitized
userland pointer. Attempting to read an unmapped page will cause the
kernel to crash.
2) Due to a missing input validation check in COMPAT_NETBSD32's getdents
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 FreeBSD module
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-6 netbsd-6-1 netbsd-6-0 netbsd-5 netbsd-5-2 netbsd-5-1
---- ---- -------- ---------- ---------- -------- ---------- ----------
src/sys/compat/freebsd/freebsd_sysctl.c
1.17 1.15.22.1 1.15.36.1 1.15.28.1 1.14.10.1 1.14.20.1 1.14.16.1
src/sys/compat/netbsd32/netbsd32_compat_30.c
1.31 1.30.14.1 1.30.28.1 1.30.20.1 n/a n/a n/a
To update from CVS, re-build, and re-install the kernel:
# cd src
# cvs update -d -P -r VERSION sys/compat/freebsd/freebsd_sysctl.c
# cvs update -d -P -r VERSION sys/compat/netbsd32/netbsd32_compat_30.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
================
2015-03-17 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-SA2015-004.txt.asc
Information about NetBSD and NetBSD security can be found at
http://www.NetBSD.org/ and http://www.NetBSD.org/Security/ .
Copyright 2015, The NetBSD Foundation, Inc. All Rights Reserved.
Redistribution permitted only in full, unmodified form.
$NetBSD: NetBSD-SA2015-004.txt,v 1.1 2015/03/17 06:58:44 spz Exp $
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAEBAgAGBQJVCweDAAoJEAZJc6xMSnBudSoQAKzXCgzM755Y7TqPYit+cTB5
vjm9T/a9MHBQuDbGFhFRby8kyhUBVkgKZEa/XnW46Gq0ViLVBHzQrTxXy6nY2jHB
blGcQuP//0i3wef4KXIh4MLuuj2pLpJizChvZduTWO1o8S9JrEKK/e0cuK2EUbXe
Tqr3jd6C8JWyF2sRj1t4og+jma45+7rNwGUP5OlJ6G7Vk/RrW4YdOno9/j2ITDE3
gzysh5n4rqc4WpZbAXmjIsH5Jmq1NC/w5S1P/dnRkvawpMR3zEZetXukfDsfgKj+
FHX3kHkBYPTaAhhUK9TGT0Jptx8WNIJ5/oCcKe3rGFGqx65i3GCTtYasHhl5ZNpf
mYxqk06fjJN2kTrBCJgeo+e/NAfld96rs2nrdnTns+DybttuAalYfa9Z2+Nszub4
lNJKJBoEX2or8jiYR6dk1zqDDkC015g/Yzh6riRP/qVE1DD+xUC6N2IdjldG/od9
S8qUdea9YaWXNmjTTStOha26UT5G7Kv/VrKLEI3Ae8Hktnw/SQ5tivSAJvUiKl3W
ItpTIZwgdkYdKkMYAAxQ9fpbJYgKZNisvXWYOnlaek1XewFx86aVBEHBj3FsrGbO
7IAOiY0YxU61BZr5ZaALz6cD5IuLb7XNxCyLh5U4Z8AKaRlSyuH3OAmfRnfSXHMF
n/x29Cpg2RAC1KGD5Big
=SeEW
-----END PGP SIGNATURE-----