deadsimple BSD Security Advisories and Announcements

NetBSD Security Advisory 2016-004: Multiple vulnerabilities in the compatibility layers

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.


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:


And running the following command to unload them:

	# modunload compat_${NAME}

The modules have dependencies, so you need to unload them in the proper

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
- ----  ----  --------  --------  ------------ ----------
      1.21  N/A

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
	# ./ 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:

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

Information about NetBSD and NetBSD security can be found at and .

Copyright 2016, The NetBSD Foundation, Inc.  All Rights Reserved.
Redistribution permitted only in full, unmodified form.

Version: GnuPG v1