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

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

            ESB-2004.0789 -- NetBSD Security Advisory 2004-010
              Insufficient argument validation in compat code
                             17 December 2004

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

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

Product:           Kernel
Publisher:         NetBSD
Operating System:  NetBSD 1.6.2 and prior
Impact:            Root Compromise
                   Denial of Service
Access:            Existing Account

Original Bulletin: ftp://ftp.NetBSD.org/pub/NetBSD/security/advisories/NetBSD-SA2004-010.txt.asc

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

- -----BEGIN PGP SIGNED MESSAGE-----


		 NetBSD Security Advisory 2004-010
		 =================================

Topic:		Insufficient argument validation in compat code

Version:	NetBSD-current:	source prior to Oct 27, 2004
		NetBSD 2.0:	not affected
		NetBSD 1.6.2:	affected
		NetBSD 1.6.1:	affected
		NetBSD 1.6:	affected
		NetBSD 1.5.3:	affected
		NetBSD 1.5.2:	affected
		NetBSD 1.5.1:	affected
		NetBSD 1.5:	affected

Severity:	Local Denial of Service
		possible Local Privilege Escalation

Fixed:		NetBSD-current:		Oct 28, 2004
		NetBSD-2.0 branch:	Nov 13, 2004 (2.0 includes the fix)
		NetBSD-1.6 branch:	Dec 17, 2004 (1.6.3 will include the fix)


Abstract
========

Kernel syscall implementations must perform appropriate sanity checks on
data passed from userland. The native system calls perform appropriate
checks.

Some of the functions in /usr/src/sys/compat/* which implement execution
of foreign binaries (such as Linux, FreeBSD, IRIX, OSF1, SVR4, HPUX, and
ULTRIX) used argument data in unsafe ways prior to calling the kernel
syscall.

This issue was reported by Evgeny Demidov.


Technical Details
=================

The compat subsystem, in /usr/src/sys/compat/*, allows NetBSD users to
run binaries compiled for other operating systems which run on the same
CPU architecture as the NetBSD host.

Typically, the foreign OS supports a set of system calls which are very
similar to NetBSD's. Native instructions do not need to be translated,
but calls to the operating system do.

A binary's native OS is determined at exec() time. The kernel maps the
syscall table for the native OS so that each syscall is delivered to a
foreign OS -> NetBSD translation function, if needed.

These translation functions reorder arguments, reformat them, perform
mapping of constants (such as signal(3) IDs) and call the appropriate
native NetBSD system call to service the application's needs.

Some of the translation functions performed unsafe operations using the
syscall arguments, and were exploitable to cause kernel traps. Some of
the flaws may be exploitable and result in privilege escalation.

All of these attacks require local access to the system. A system with
only trusted user accounts is not immediately at risk.

A system running a custom kernel with all 'options COMPAT_' commented
out is not at risk.


See also Evgeny Demidov's advisory:

http://gleg.net/advisory_netbsd2.shtml


Solutions and Workarounds
=========================


The NetBSD 2.0 release already includes the fixes for this
vulnerability.

Since the NetBSD-1-5 branch has reached End of Life, updating to
NetBSD-1-6 or NetBSD-2-0 is recommended.


netbsd-1-6, netbsd-2-0 (pre-release), netbsd-current:

*** Patching from sources:

The fix for this issue is contained in changes to several files, all
within the subdirectory:

	sys/compat

The following instructions describe how to upgrade your kernel
binaries by updating your source tree and rebuilding and installing a
new version of the kernel. In these instructions, replace:

  BRANCH   with the appropriate CVS branch (netbsd-1-6,
		  netbsd-2-0, HEAD)
  ARCH     with your architecture (from uname -m), and
  KERNCONF with the name of your kernel configuration file.

To update from CVS, re-build and re-install the kernel:

        # cd src
        # cvs update -d -P -r BRANCH sys/compat
        # cd sys/arch/ARCH/conf
        # config KERNCONF
        # cd ../compile/KERNCONF
        # make depend; make
        # mv /netbsd /netbsd.old
        # cp netbsd /
        # shutdown -fr now




Thanks To
=========

Evgeny Demidov for notification, review of patches, and considerable patience.

Christos Zoulas, David Maxwell, and Simon Burge for patches and review.


Revision History
================

	2004-12-16	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 
  ftp://ftp.NetBSD.org/pub/NetBSD/security/advisories/NetBSD-SA2004-010.txt.asc

Information about NetBSD and NetBSD security can be found at
http://www.NetBSD.org/ and http://www.NetBSD.org/Security/.


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

$NetBSD: NetBSD-SA2004-010.txt,v 1.3 2004/12/16 16:12:27 david Exp $

- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (NetBSD)

iQCVAwUBQcG0RT5Ru2/4N2IFAQGEsAQAolCepbv3R/7v5AEpv2o6yuULRnSIqpzR
efeKgmi/pSx3Nqxyb1SnW7C7gdvhIzqrhwZV0Hw/iiWo/A7SSQ8+Oht7wdADT1PO
YOBLu3+7zwBsY4Hgh/v5e6khzTqLrMzUg52G2ulrUAjrrCKIZwO3J0YKEEkeO/7q
43+wG6nEH9M=
=KnM+
- -----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

If you believe that your computer system has been compromised or attacked in 
any way, we encourage you to let us know by completing the secure National IT 
Incident Reporting Form at:

        http://www.auscert.org.au/render.html?it=3192

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

iQCVAwUBQcJ1gSh9+71yA2DNAQLjlAQAnXRYKWoRx0Dx43TMsooKX9bmwFpZum3j
Xh317jqdbFf7bG+X0Ga5BGMejisvevf3Jm0x1a3ht4hqVVlnC5jiKhzX4xpddcX7
rQkzJRAXTlAvLym9+owBF0Ii63rrwfOwLY1U3I0zRDS3N0lzf48TXnyuGpNz4rlv
mfpx7f0gI3k=
=EAkR
-----END PGP SIGNATURE-----