Subject: NetBSD Security Advisory 2003-014: Insufficient argument checking in sysctl(2)
To: None <tech-security@NetBSD.org, current-users@NetBSD.org>
From: NetBSD Security Officer <security-officer@NetBSD.org>
Date: 09/18/2003 01:39:56
-----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
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
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.
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 188.8.131.52 2003/08/27
netbsd-1-5 184.108.40.206 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 /
2003-09-17 Initial release
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
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
-----END PGP SIGNATURE-----