From security-officer@NetBSD.org Thu Sep 18 04:52:01 2003 From: NetBSD Security Officer To: full-disclosure@lists.netsys.com Date: Thu, 18 Sep 2003 01:43:55 -0400 Subject: [Full-Disclosure] NetBSD Security Advisory 2003-014: Insufficient argument checking in sysctl(2) -----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----- _______________________________________________ Full-Disclosure - We believe in it. Charter: http://lists.netsys.com/full-disclosure-charter.html