Operating System:

[FreeBSD]

Published:

03 October 2003

Protect yourself against future threats.

-----BEGIN PGP SIGNED MESSAGE-----

===========================================================================
             AUSCERT External Security Bulletin Redistribution

                ESB-2003.0699 -- FreeBSD-SA-03:16.filedesc
                       file descriptor leak in readv
                              03 October 2003

===========================================================================

        AusCERT Security Bulletin Summary
        ---------------------------------

Product:                readv(2)
Publisher:              FreeBSD
Operating System:       FreeBSD 4.3-RELEASE through 4.8-RELEASE
                        4-STABLE and prior
Impact:                 Denial of Service
                        Increased Privileges
Access Required:        Existing Account

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

- -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

=============================================================================
FreeBSD-SA-03:16.filedesc                                   Security Advisory
                                                          The FreeBSD Project

Topic:          file descriptor leak in readv

Category:       core
Module:         kernel
Announced:      2003-10-02
Credits:        Joost Pol <joost@pine.nl>
Affects:        FreeBSD 4.3-RELEASE through 4.8-RELEASE
                4-STABLE prior to the correction date
Corrected:      2003-10-02 15:08:01 UTC (RELENG_4, 4.9-RC)
                2003-10-02 15:54:48 UTC (RELENG_4_8, 4.8-RELEASE-p11)
                2003-10-02 15:55:54 UTC (RELENG_4_7, 4.7-RELEASE-p21)
                2003-10-02 15:56:56 UTC (RELENG_4_6, 4.6-RELEASE-p24)
                2003-10-02 15:57:48 UTC (RELENG_4_5, 4.5-RELEASE-p35)
                2003-10-02 15:58:53 UTC (RELENG_4_4, 4.4-RELEASE-p45)
                2003-10-02 16:05:44 UTC (RELENG_4_3, 4.3-RELEASE-p41)
FreeBSD only:   YES

For general information regarding FreeBSD Security Advisories,
including descriptions of the fields above, security branches, and the
following sections, please visit
<URL:http://www.freebsd.org/security/>.

I.   Background

The readv(2) system call performs a scatter read: it reads from the
input file descriptor and stores the data into multiple buffers as
instructed by the caller.

II.  Problem Description

A programming error in the readv system call can result in the given
file descriptor's reference count being erroneously incremented.

III. Impact

A local attacker may cause the operating system to crash by repeatedly
calling readv on a file descriptor until the reference count wraps to
a negative value, and then calling close on that file descriptor.

Similarly, it may be possible to cause a file descriptor to reference
unallocated kernel memory, but remain valid.  If a new file is later
opened and the kernel allocates the new file structure at the same
memory location, then an attacker may be able to gain read or write
access to that file.  This may in turn lead to privilege escalation.

IV.  Workaround

There is no workaround.

V.   Solution

The following patch has been verified to apply to FreeBSD 4.3, 4.4,
4.5, 4.6, 4.7, and 4.8 systems.

a) Download the relevant patch from the location below, and verify the
detached PGP signature using your PGP utility.

# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:16/filedesc.patch
# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:16/filedesc.patch.asc

b) Apply the patch.

# cd /usr/src
# patch < /path/to/patch

c) Recompile your kernel as described in
<URL:http://www.freebsd.org/handbook/kernelconfig.html> and reboot the
system.

VI.  Correction details

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

Branch                                                           Revision
  Path
- - -------------------------------------------------------------------------
RELENG_4
  src/sys/kern/sys_generic.c                                    1.55.2.11
RELENG_4_8
  src/UPDATING                                             1.73.2.80.2.13
  src/sys/conf/newvers.sh                                  1.44.2.29.2.12
  src/sys/kern/sys_generic.c                               1.55.2.10.12.1
RELENG_4_7
  src/UPDATING                                             1.73.2.74.2.24
  src/sys/conf/newvers.sh                                  1.44.2.26.2.23
  src/sys/kern/sys_generic.c                               1.55.2.10.10.1
RELENG_4_6
  src/UPDATING                                             1.73.2.68.2.53
  src/sys/conf/newvers.sh                                  1.44.2.23.2.41
  src/sys/kern/sys_generic.c                                1.55.2.10.8.1
RELENG_4_5
  src/UPDATING                                             1.73.2.50.2.52
  src/sys/conf/newvers.sh                                  1.44.2.20.2.36
  src/sys/kern/sys_generic.c                                1.55.2.10.6.1
RELENG_4_4
  src/UPDATING                                             1.73.2.43.2.53
  src/sys/conf/newvers.sh                                  1.44.2.17.2.44
  src/sys/kern/sys_generic.c                                1.55.2.10.4.1
RELENG_4_3
  src/UPDATING                                             1.73.2.28.2.40
  src/sys/conf/newvers.sh                                  1.44.2.14.2.30
  src/sys/kern/sys_generic.c                                1.55.2.10.2.1
- - -------------------------------------------------------------------------

VII. References

<URL:http://www.pine.nl/press/pine-cert-20030901.txt>
- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (FreeBSD)

iD8DBQE/fGDRFdaIBMps37IRAnkpAKCFM8MrujjJN1tc4lZwii573usNvgCfdBeP
APcFpW5FsH+sLkWczgjj6eE=
=6zO7
- -----END PGP SIGNATURE-----

- --------------------------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 follow or act on information or advice
contained in this security bulletin is the responsibility of each user or
organisation, and should be considered in accordance with your organisation's
site policies and procedures. AusCERT takes no responsibility for consequences
which may arise from following or acting on information or advice contained in
this security bulletin.

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 author's website 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:

        http://www.auscert.org.au/render.html?cid=1980

If you believe that your computer system has been compromised or attacked in 
any way, we encourage you to let us know by completing the secure National IT 
Incident Reporting Form at:

        http://www.auscert.org.au/render.html?it=3192

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.
-----BEGIN PGP SIGNATURE-----
Comment: http://www.auscert.org.au/render.html?it=1967

iQCVAwUBP3zvzSh9+71yA2DNAQHe9wP+OHklFCevqFiNnUj99YW+xJv5oPxf3ncQ
WIAv8stTI+rN+FgSCRKBgbYF7JlkVoSSOfmF3xFmlpC3zFSVi2xTFmilYe44jw9u
RbEJ/mnmQF1DybNMHt/k1VNJdrk+uyr63Gp43dhvF+pV9IM/iGtxhGNu7VBLx25C
9DnfQg4x8ME=
=RQvc
-----END PGP SIGNATURE-----