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

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

            ESB-2003.0657 -- NetBSD Security Advisory 2003-014
                Insufficient argument checking in sysctl(2)
                             19 September 2003

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

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

Product:                sysctl
Publisher:              NetBSD
Operating System:       NetBSD-current prior to August 25, 2003
                        NetBSD 1.6.1
                        NetBSD 1.6
                        NetBSD-1.5.3
                        NetBSD-1.5.2
                        NetBSD-1.5.1
                        NetBSD-1.5
Impact:                 Denial of Service
                        Access Privileged Data
Access Required:        Existing Account

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

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


		 NetBSD Security Advisory 2003-014
		 =================================

Topic:		Insufficient argument checking in sysctl(2)

Version:	NetBSD-current:	source prior to August 25, 2003
		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 DOS, read protected kernel memory

Fixed:		NetBSD-current:		August 25, 2003
		NetBSD-1.6 branch:	August 28, 2003 (1.6.2 will include the fix)
		NetBSD-1.5 branch:	August 28, 2003


Abstract
========

Three unrelated problems with inappropriate argument handling were
found in the kernel sysctl(2) code, which could be exploited by
malicious local user:

  Some sysctl nodes could cause the kernel to dereference a NULL
  pointer, resulting in a panic.

  Passing the process id of a zombie process could cause the kernel to
  dereference invalid process data, and panic.

  Other sysctl nodes had an insufficient range check, which could be
  abused to read arbitrary locations in kernel memory space.


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

There are three unrelated problems, found during an effort to rewrite
the present sysctl(2) infrastructure.

1) A pointer variable was used both for pointing user-level address
   (sysctl(2) argument) and kernel address, and there was a chance for
   a local user to set NULL pointer to the variable.

2) The proc.* sysctl tree could be invoked on a zombie process, but
   made assumptions that the processes were in a valid state, and so
   could attempt to reference process information that is invalid or
   non-existent for zombies.  This is no longer possible.

3) Under the proc.curproc.rlimit subtree are a number of nodes
   representing the process resource limits, soft and hard. The sysctl
   helper used to manipulate these values had an insufficient range
   check, and could be used to read values outside of the working copy
   of the rlimit structure.  Writes were checked more thoroughly, and
   could not abuse this problem.


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

To correct this problem, upgrade of the kernel (and reboot) is
required.  There is no practical work-around for systems running the
vulnerable code in the kernel.

The fixes for all of these issues are contained in the one file,
sys/kern/kern_sysctl.c. The following table lists the fixed revisions
and dates of this file for each branch:

  CVS branch     revision     date
  -------------  -----------  ----------------
  HEAD           1.143        2003/08/24
  netbsd-1-6     1.108.4.3    2003/08/27
  netbsd-1-5     1.73.2.7     2003/08/27

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 (from the above table)
  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/kern/kern_sysctl.c
	# cd sys/ARCH/conf
	# config KERNCONF
	# cd ../compile/KERNCONF
	# make depend;make
	# mv /netbsd /netbsd.old
	# cp netbsd /
	# reboot


Thanks To
=========

Andrew Brown


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

	2003-09-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 
  ftp://ftp.NetBSD.org/pub/NetBSD/security/advisories/NetBSD-SA2003-014.txt.asc

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


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

$NetBSD: NetBSD-SA2003-014.txt,v 1.12 2003/09/17 02:49:00 david Exp $

- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (NetBSD)
Comment: For info see http://www.gnupg.org

iQCVAwUBP2fWKz5Ru2/4N2IFAQGEnAQAw5QkAzSr6lTP3wH3e8pvrSVWb9jhMxCi
+P96ZYsxkDJNqkU33xtCIIN72GKom2uFOeswNX1qK8QEhfplX03/peOjqRZ4L4Kk
f0ECf0xIIr54Kn1JYp/PeUsOPyAAT+I6CCRplB7ZtvPjQ7l7YtYid5smO6szAQjG
I92V/aNY/fs=
=Ch3/
- -----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.

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

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

iQCVAwUBP2qSAih9+71yA2DNAQFy4AP/cAd9CRN1f06LWFdBkY7Co0NvruvalJBv
oGb5OowiVc+1fMYOPPJYW53aBkW6CkuB6ngp8y4CpiiDrLZHoRzZU0BlchKYBAn2
AWXPToEIHXa56Y24FxTWQiOuXuyS8Az6mkcJupRez8QYxMlAFdSsAQuWOdBU4vEK
gizYza8cheY=
=PQXx
-----END PGP SIGNATURE-----