aboutsummaryrefslogtreecommitdiff
path: root/sbin/fsck_ffs/fsck_ffs.8
diff options
context:
space:
mode:
authorKirk McKusick <mckusick@FreeBSD.org>2019-05-03 21:54:14 +0000
committerKirk McKusick <mckusick@FreeBSD.org>2019-05-03 21:54:14 +0000
commit0061238fb0365ac840d1e039f2391ed24fcad2d1 (patch)
treea2bcca44eefacac2f8c00f836f1152dcaf47090f /sbin/fsck_ffs/fsck_ffs.8
parentc2b4cedd787798c3a572b635ada5bbaed179fe81 (diff)
downloadsrc-0061238fb0365ac840d1e039f2391ed24fcad2d1.tar.gz
src-0061238fb0365ac840d1e039f2391ed24fcad2d1.zip
This update eliminates a kernel stack disclosure bug in UFS/FFS
directory entries that is caused by uninitialized directory entry padding written to the disk. It can be viewed by any user with read access to that directory. Up to 3 bytes of kernel stack are disclosed per file entry, depending on the the amount of padding the kernel needs to pad out the entry to a 32 bit boundry. The offset in the kernel stack that is disclosed is a function of the filename size. Furthermore, if the user can create files in a directory, this 3 byte window can be expanded 3 bytes at a time to a 254 byte window with 75% of the data in that window exposed. The additional exposure is done by removing the entry, creating a new entry with a 4-byte longer name, extracting 3 more bytes by reading the directory, and repeating until a 252 byte name is created. This exploit works in part because the area of the kernel stack that is being disclosed is in an area that typically doesn't change that often (perhaps a few times a second on a lightly loaded system), and these file creates and unlinks themselves don't overwrite the area of kernel stack being disclosed. It appears that this bug originated with the creation of the Fast File System in 4.1b-BSD (Circa 1982, more than 36 years ago!), and is likely present in every Unix or Unix-like system that uses UFS/FFS. Amazingly, nobody noticed until now. This update also adds the -z flag to fsck_ffs to have it scrub the leaked information in the name padding of existing directories. It only needs to be run once on each UFS/FFS filesystem after a patched kernel is installed and running. Submitted by: David G. Lawrence <dg@dglawrence.com> Reviewed by: kib MFC after: 1 week
Notes
Notes: svn path=/head/; revision=347066
Diffstat (limited to 'sbin/fsck_ffs/fsck_ffs.8')
-rw-r--r--sbin/fsck_ffs/fsck_ffs.87
1 files changed, 5 insertions, 2 deletions
diff --git a/sbin/fsck_ffs/fsck_ffs.8 b/sbin/fsck_ffs/fsck_ffs.8
index a1b2cdda70a3..f8d6beb51b49 100644
--- a/sbin/fsck_ffs/fsck_ffs.8
+++ b/sbin/fsck_ffs/fsck_ffs.8
@@ -29,7 +29,7 @@
.\" @(#)fsck.8 8.4 (Berkeley) 5/9/95
.\" $FreeBSD$
.\"
-.Dd January 13, 2018
+.Dd May 3, 2019
.Dt FSCK_FFS 8
.Os
.Sh NAME
@@ -38,7 +38,7 @@
.Nd file system consistency check and interactive repair
.Sh SYNOPSIS
.Nm
-.Op Fl BCdEFfnpRrSyZ
+.Op Fl BCdEFfnpRrSyZz
.Op Fl b Ar block
.Op Fl c Ar level
.Op Fl m Ar mode
@@ -301,6 +301,9 @@ If both
and
.Fl Z
are specified, blocks are first zeroed and then erased.
+.It Fl z
+Clear unused directory space.
+The cleared space includes deleted file names and name padding.
.El
.Pp
Inconsistencies checked are as follows: