-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

===========================================================================
             AUSCERT External Security Bulletin Redistribution

                               ESB-2016.1014
           Multiple vulnerabilities in the compatibility layers
                               22 April 2016

===========================================================================

        AusCERT Security Bulletin Summary
        ---------------------------------

Product:           NetBSD
Publisher:         NetBSD
Operating System:  NetBSD
Impact/Access:     Denial of Service -- Existing Account
Resolution:        Patch/Upgrade

Original Bulletin: 
   http://ftp.NetBSD.org/pub/NetBSD/security/advisories/NetBSD-SA2016-004.txt.asc

- --------------------------BEGIN INCLUDED TEXT--------------------

- -----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-----

- --------------------------END INCLUDED TEXT--------------------

You have received this e-mail bulletin as a result of your organisation's
registration with AusCERT. The mailing list you are subscribed to is
maintained within your organisation, so if you do not wish to continue
receiving these bulletins you should contact your local IT manager. If
you do not know who that is, please send an email to auscert@auscert.org.au
and we will forward your request to the appropriate person.

NOTE: Third Party Rights
This security bulletin is provided as a service to AusCERT's members.  As
AusCERT did not write the document quoted above, AusCERT has had no control
over its content. The decision to follow or act on information or advice
contained in this security bulletin is the responsibility of each user or
organisation, and should be considered in accordance with your organisation's
site policies and procedures. AusCERT takes no responsibility for consequences
which may arise from following or acting on information or advice contained in
this security bulletin.

NOTE: This is only the original release of the security bulletin.  It may
not be updated when updates to the original are made.  If downloading at
a later date, it is recommended that the bulletin is retrieved directly
from the author's website to ensure that the information is still current.

Contact information for the authors of the original document is included
in the Security Bulletin above.  If you have any questions or need further
information, please contact them directly.

Previous advisories and external security bulletins can be retrieved from:

        http://www.auscert.org.au/render.html?cid=1980

===========================================================================
Australian Computer Emergency Response Team
The University of Queensland
Brisbane
Qld 4072

Internet Email: auscert@auscert.org.au
Facsimile:      (07) 3365 7031
Telephone:      (07) 3365 4417 (International: +61 7 3365 4417)
                AusCERT personnel answer during Queensland business hours
                which are GMT+10:00 (AEST).
                On call after hours for member emergencies only.
===========================================================================
-----BEGIN PGP SIGNATURE-----
Comment: http://www.auscert.org.au/render.html?it=1967

iQIVAwUBVxl2nn6ZAP0PgtI9AQJQPxAAowhBpXzAIaq0zURplTXokSSrU0Abik7y
4TexhbqGXs7IBdlrnSG/mTE24g3Dkq3MJoSkQZHbNxRuVKMSms8hf6jBM8L0SsMS
he3VdzIszfAIG9By0zwfD1VcpnCwaeQkuNu6fHBXxPY5T9poUEB3Ggnq05VgEA/z
rDDAoC9NLCk/IRTimFf86pHVTTNox69uXVh9L8lhAIRuWX9V1o3SdIqLewvg4dCp
hiuCAezo8UBaoPOeOK6rGmoYyTlueczxprEzZWbH4xTYvBNLR8LgtqNhqVtNWt/i
9+enY/RrD871lsfZ0FxUvt70AjfHCknIFD+biQ4vF3h4H3GMDakUnkr1F+3D+tcV
2QGDjkvO8RRUsUXvEyRNjDPMLgBBNd89hhisWanp123I2/7YzMrBAF4RKo7/ymst
PRaAcbk6FWCwJxdRRWgOKf1T7LiIWX2g93BVUOGrGJm6UTdsYpS4qinhZvD8y6SP
k55wib4v+9QwHm4aksYkIpIl50TxUVfmINtx4G6auN3VnTPm2utRmYUplEApohIF
CZjiGTUUsI0Tka+l3mitLfQXVplISG2KlJtz14FlHWl5e5Qbbn4q1HLAEniThns8
tgpblzo0vhX/RQtB4UrZOxeyqBmi4jQbz9p4kYuIvjv8MWZlxaDq7CaJsmDzgpC2
9oxEmEHAYBQ=
=V0jn
-----END PGP SIGNATURE-----