From security-officer@NETBSD.ORG Wed Jul 12 23:48:51 2000 From: NetBSD Security Officer To: BUGTRAQ@SECURITYFOCUS.COM Date: Sun, 28 May 2000 23:46:30 -0400 Subject: NetBSD Security Advisory 2000-004 -----BEGIN PGP SIGNED MESSAGE----- NetBSD Security Advisory 2000-004 ================================= Topic: SysV semaphore denial-of-service Version: all prior to 2000/05/27 Severity: minor (local denial of service to programs using the rarely-used semaphore facility) Abstract ======== An undocumented system call permits any user process to lock up the entire semaphore subsystem, preventing processes using semaphores from locking or unlocking them, and preventing processes holding semaphores from exiting. Note: FreeBSD-SA-00:19 describes a similar, but significantly more severe problem affecting FreeBSD, and notes that NetBSD is also affected. The impact of the problem on NetBSD is much less, because NetBSD's semaphore implementation was fixed (in 1994) so that only semaphore-using processes would be blocked at exit time. Technical Details ================= The undocumented semconfig(2) system call is used by ipcs(1) to "freeze" the state of semaphores so that a self-consistant snapshot could be displayed. However, this could then be abused to lock the semaphore system, preventing all semaphore operations from progressing, and leave it locked until the locking process exited. The fix is to disable this unnecessary locking; other comparable /dev/kmem-reading programs such as ps(1) and netstat(1) have never needed this sort of locking. Solutions and Workarounds ========================= Only programs which make use of semaphores are affected by this problem. If you are unsure if any applications use semaphores, use the ipcs(1) command; if it displays more than simple column headers, there is active use of semaphores on your system. For example: % ipcs -s Semaphores: T ID KEY MODE OWNER GROUP s 524288 -1 --rw------- wes wheel Note that this test is not 100% conclusive; however, use of System V semaphores is extremely rare. If you determine that your system may run programs which use semaphore you should patch your kernel as follows: For formal NetBSD releases, you should to download the appropriate source patch listed below, apply it to your kernel source tree using the patch(1) command. For NetBSD-current, you should update your source tree (with either sup or anonymous CVS). In both cases, you then need to rebuild, install the newly built kernel, and reboot. For more information on how to do this, see: http://www.netbsd.org/Documentation/kernel/#building_a_kernel For NetBSD 1.4, 1.4.1, and 1.4.2: A patch is available in ftp://ftp.NetBSD.ORG/pub/NetBSD/misc/security/patches/20000527-sysvsem For NetBSD-current: NetBSD-current since 20000527 contains all the fixes, and is not vulnerable. Users of NetBSD-current should upgrade to a source tree dated 20000527 or later. Thanks To ========= The FreeBSD security officer, for bringing the problem to our attention. Bill Sommerfeld for coding and testing the fix. Revision History ================ 2000/05/27 - initial version. More Information ================ Information about NetBSD and NetBSD security can be found at http://www.NetBSD.ORG/ and http://www.NetBSD.ORG/Security/. Copyright 2000, The NetBSD Foundation, Inc. All Rights Reserved. $NetBSD: NetBSD-SA2000-004.txt,v 1.3 2000/05/29 01:01:11 sommerfeld Exp $ -----BEGIN PGP SIGNATURE----- Version: 2.6.3ia Charset: noconv iQCVAwUBOTHBbD5Ru2/4N2IFAQG1zQP+LYnjsZzLPKKSur1ywCsZQN+kqt3wpVa+ qP3pTcCTDbrh7QbwwTibzkGo5h7dnbwVGYHP0yGSDpVmRN//q+sOo5g92NMqC5Bn iodYJPyE5pu3IJrKtSCQOIddUV49TKRV7NnQVHTJIEfxxbgRWRjlbNAwLS7qscV3 Gc8JOKs0ev0= =KhiA -----END PGP SIGNATURE-----