Date: Thu, 18 Mar 1999 00:03:40 +1100 From: matthew green To: BUGTRAQ@netspace.org Subject: NetBSD Security Advisory 1999-006 -----BEGIN PGP SIGNED MESSAGE----- NetBSD Security Advisory 1999-006 ================================= Topic: Security hole in umapfs Version: NetBSD 1.3.3 and prior; NetBSD-current until 19990312 Severity: Local users can gain root privileges Abstract ======== Insufficient kernel checking in the umapfs virtual file system allows local users to remap their user id to any other user including the root user. umapfs is enabled in the default (GENERIC) kernel for the following ports: amiga, arm32, atari, bebox, i386, mac68k, macppc, newsmips, next68k, next68k, ofppc, pmax, sparc, sparc64, vax, x68k. The alpha, hp300, mvme68k, pc532 and sun3 ports do not include umapfs by default. Technical Details ================= umapfs creates a null layer, duplicating a sub-tree of the file system name space under another part of the global file system, with uid/gid remapping. The uid and gid mappings are described in two files supplied by the user to mount_umap(8). When a umapfs mount is attempted, no additional checks are done in the kernel other than the usual checks: the user must be root, or have read access of the target and be owner of the mount point. The only permission checks made were erroneously placed in the mount_umap(8) command. A malicious user can compile their own mount_umap binary that does not include these checks. With this modified mount_umap a user can mount any directory on another directory they have write access to with their uid mapped to 0. They will then have be able to create and modify root owned files in the source directory, including the ability to create setuid root binaries. Solution and Workarounds ========================= A patch is available for the NetBSD 1.3.3 which restricts umapfs mounts to root and fixes the above problem. You may find this patch on the NetBSD ftp server: ftp://ftp.NetBSD.ORG/pub/NetBSD/misc/security/patches/19990311-umapfs NetBSD-current since 19990312 is not vulnerable. Users of NetBSD-current should upgrade to a source tree later than 19990312. If neither of the above can be performed, a simple work around is to remove umapfs from your kernel configuration and rebuild a kernel. For this you need to remove or comment out the line: file-system UMAPFS # NULLFS + uid and gid remapping in the configuration file. See these URL's for documentation building a NetBSD kernel: http://www.NetBSD.ORG/Documentation/kernel/index.html#downloading_kernel_source http://www.NetBSD.ORG/Documentation/kernel/index.html#building_a_kernel Thanks To ========= Thanks go to Manuel Bouyer for the discovery and solution for this problem. Revision History ================ 1999/03/17 - 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 1999, The NetBSD Foundation, Inc. All Rights Reserved. $NetBSD: NetBSD-SA1999-006.txt,v 1.5 1999/03/17 12:15:13 mrg Exp $ -----BEGIN PGP SIGNATURE----- Version: 2.6.3ia Charset: noconv iQCVAwUBNu+dHj5Ru2/4N2IFAQFN0QP/Sh1Mhp0ArrA+t8MZCk1GknizFM0CFgWC TUv0aO/P7OueAcHVCFM6j8gHvECBvwRh4Gxli0iRRGA1NfmW0Z5Kt8CKdaZ5d4JO KUAmZeL8Jd95vr3j8bxUHM3ZSsWHOd5U3B3AZIlhvVacs9FjmMd/DhKYAnY+N+3P oWslFh5Cgnk= =QQZM -----END PGP SIGNATURE-----