Operating System:


07 August 2002

Protect yourself against future threats.


             AUSCERT External Security Bulletin Redistribution

                   ESB-2002.399 -- FreeBSD-SA-02:35.ffs
   local users may read and write arbitrary blocks on an FFS filesystem
                               7 August 2002


        AusCERT Security Bulletin Summary

Product:                kernel
Vendor:                 FreeBSD
Operating System:       FreeBSD 4.6.1-RELEASE-p4 and prior
Impact:                 Root Compromise
                        Denial of Service
Access Required:        Existing Account

- --------------------------BEGIN INCLUDED TEXT--------------------


FreeBSD-SA-02:35.ffs                                        Security Advisory
                                                          The FreeBSD Project

Topic:          local users may read and write arbitrary blocks on
                an FFS filesystem

Category:       core
Module:         kernel
Announced:      2002-08-05
Credits:        Matt Dillon <dillon@FreeBSD.org>,
                Ian Dowse <iedowse@FreeBSD.org>,
                Tor Egge <tegge@FreeBSD.org>
Affects:        All releases of FreeBSD up to and including 4.6.1-RELEASE-p4
                4.6-STABLE prior to the correction date
Corrected:      2002-06-23 22:34:52 UTC (RELENG_4)
                2002-07-31 17:55:22 UTC (RELENG_4_6)
                2002-07-31 17:55:11 UTC (RELENG_4_5)
                2002-07-31 17:54:57 UTC (RELENG_4_4)
FreeBSD only:   YES

I.   Background

The Berkeley Fast File System (FFS) is the default filesystem used by

II.  Problem Description

A bug in the calculation of the maximum permitted FFS file size
allows users to create files that are larger than FreeBSD's virtual
memory system can handle. The integer overflows that result when such
files are accessed may map filesystem metadata into the user file,
permitting access to arbitrary filesystem blocks.

The bug is encountered only on FFS filesystems with a block size of
16k or greater on the i386 architecture, or 32k or greater on the
alpha architecture.  Also, the filesystem must have at least 6 blocks
of free space, and the user must have write access to at least one
file in the filesystem.

The default FreeBSD FFS filesystem block size was changed from 8k to
16k on all architectures just before 4.5-RELEASE.

III. Impact

Local attackers may cause a denial of service by simply corrupting the
filesystem.  A local attacker may also be able to read and write
arbitrary files on local filesystems, allowing them to gain superuser

FFS filesystems with a block size less than 16k (on the i386
architecture) or 32k (on the alpha architecture), such as those
created using the default FFS filesystem block size prior to
4.5-RELEASE, are not vulnerable.

The following command can be used to determine the block size
used on a given filesystem:

  # dumpfs /some/filesystem | grep '^bsize'

IV.  Workaround

On filesystems with 16k blocks, the bug cannot be exploited when a
process has a file size resource limit (RLIMIT_FSIZE) of 63 MB or
less.  This can be most easily accomplished by modifying
/etc/login.conf so that the appropriate login classes (typically
`default') contain a field entry such as the following:


After editing /etc/login.conf, the corresponding capability database
must be rebuilt with the following command:

   # cap_mkdb /etc/login.conf

Please see login.conf(5) for details.  Note that this will not affect
currently running processes, nor new processes started by users who
are already logged in.

The corresponding limit appropriate for filesystems with 32k or larger
blocks is not known at this time, and might be smaller or larger than
63 MB.

It is the responsibility of applications such as `login' and `sshd' to
read and honor login.conf.  Be aware that 3rd party applications that
provide login functionality may or may not honor login.conf.

V.   Solution

1) Upgrade your vulnerable system to 4.6-STABLE; or to any of the
RELENG_4_6 (4.6.1-RELEASE-p5), RELENG_4_5 (4.5-RELEASE-p14), or
RELENG_4_4 (4.4-RELEASE-p21) security branches dated after the
respective correction dates.

2) To patch your present system:

a) Download the relevant patch from the location below, and verify the
detached PGP signature using your PGP utility.  The following patch
has been tested to apply to all FreeBSD 4.x releases.

# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-02:35/ffs.patch
# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-02:35/ffs.patch.asc

b) Recompile your kernel as described in
http://www.freebsd.org/handbook/kernelconfig.html and reboot the

VI.  Correction details

The following list contains the revision numbers of each file that was
corrected in FreeBSD.

Path                                                             Revision
- - -------------------------------------------------------------------------
- - -------------------------------------------------------------------------

Version: GnuPG v1.0.7 (FreeBSD)

- --------------------------END INCLUDED TEXT--------------------

You have received this e-mail bulletin as a result of your organisation's
registration with AusCERT. The mailing list you are subscribed to is
maintained within your organisation, so if you do not wish to continue
receiving these bulletins you should contact your local IT manager. If
you do not know who that is, please send an email to auscert@auscert.org.au
and we will forward your request to the appropriate person.

This security bulletin is provided as a service to AusCERT's members.  As
AusCERT did not write the document quoted above, AusCERT has had no control
over its content.  The decision to use any or all of this information is
the responsibility of each user or organisation, and should be done so in
accordance with site policies and procedures.

NOTE: This is only the original release of the security bulletin.  It may
not be updated when updates to the original are made.  If downloading at
a later date, it is recommended that the bulletin is retrieved directly
from the original authors to ensure that the information is still current.

Contact information for the authors of the original document is included
in the Security Bulletin above.  If you have any questions or need further
information, please contact them directly.

Previous advisories and external security bulletins can be retrieved from:


If you believe that your system has been compromised, contact AusCERT or
your representative in FIRST (Forum of Incident Response and Security

Internet Email: auscert@auscert.org.au
Facsimile:      (07) 3365 7031
Telephone:      (07) 3365 4417 (International: +61 7 3365 4417)
                AusCERT personnel answer during Queensland business 
                hours which are GMT+10:00 (AEST).  On call after hours 
                for member emergencies only.

Version: 2.6.3i
Charset: noconv
Comment: ftp://ftp.auscert.org.au/pub/auscert/AUSCERT_PGP.key