[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
NetBSD Security Advisory 2021-002: Incorrect permissions in kernfs
-----BEGIN PGP SIGNED MESSAGE-----
NetBSD Security Advisory 2021-002
Topic: Incorrect permissions in kernfs
Version: NetBSD-current: affected between March 3, 2020 and July 6, 2021
NetBSD 9.2: affected
NetBSD 9.1: affected
NetBSD 9.0: affected
NetBSD 8.*: not affected
Severity: Local user may read any file on the root volume
Fixed: NetBSD-current: July 6, 2021
NetBSD-9 branch: July 6, 2021
Please note that NetBSD releases prior to 8.0 are no longer supported.
It is recommended that all users upgrade to a supported release.
The /kern file system contains references to the device the root
volume was mounted from. It was discovered that the permissions were
incorrect and allow any local user to read the device, thus allowing
any local user to read any file on the root volume.
The files /kern/rootdev and /kern/rrootdev are internally-generated
device special files that refer to the device the root volume was
mounted from. Until July 6, 2021 they were presented as mode 444
(readable to all users). Prior to February 3, 2020 (February 12 on the
NetBSD-9 branch, then at 9.0_RC2) this was harmless because these
device special files did not actually work; however, that problem was
corrected without noticing that the permissions were unsafe.
Solutions and Workarounds
Immediate workaround: unmount /kern and mark it "noauto" in
/etc/fstab. This will work (without impacting system functionality)
for all systems other than Xen DOM0. Unfortunately Xen requires access
to other elements in kernfs.
Note that while chmod on the offending files appears to succeed, it
does not take and is not an adequate workaround.
To fix the underlying problem, update the kernel.
To apply a fixed version from a releng build, fetch a fitting
kern-GENERIC.tar.xz, kern-GENERIC_KASLR.tar.xz, kern-XEN3_DOM0.tar.xz,
or kern-XEN3_DOMU.tar.xz (depending on which kernel you are using;
uname -v will show, among other things, the name of the running
kernel) from nycdn.NetBSD.org and extract the fixed binaries:
ftp https://nycdn.NetBSD.org/pub/NetBSD-daily/REL/BUILD/ARCH/binary/sets/kern-GENERIC.tar.xz (or whichever)
tar xzpf /var/tmp/kern-GENERIC.tar.xz
with the following replacements:
REL = the release version you are using
BUILD = the source date of the build. 202107060400Z and later will fit
ARCH = your system's architecture
The following instructions describe how to upgrade your kernel by
updating your source tree and rebuilding and installing a new version.
For affected NetBSD versions, you need to obtain fixed kernel sources,
rebuild and install the new kernel, and reboot the system.
The fixed source may be obtained from the NetBSD CVS repository.
The following instructions briefly summarise how to upgrade your
kernel. In these instructions, replace:
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 sys/miscfs/kernfs/kernfs_vnops.c
# ./build.sh kernel=KERNCONF
# mv /netbsd /netbsd.old
# cp sys/arch/ARCH/compile/obj/KERNCONF/netbsd /netbsd
# shutdown -r now
For more information on how to do this, see:
David A. Holland
Jonathan A. Kollasch
2021-07-14 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 2021, The NetBSD Foundation, Inc. All Rights Reserved.
Redistribution permitted only in full, unmodified form.
$NetBSD: NetBSD-SA2021-002.txt,v 1.1 2021/07/14 17:48:26 christos Exp $
-----BEGIN PGP SIGNATURE-----
-----END PGP SIGNATURE-----
Main Index |
Thread Index |