OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
FreeBSD Security Advisory FreeBSD-SA-03:16.filedesc

From: FreeBSD Security Advisories (security-advisoriesfreebsd.org)
Date: Thu Oct 02 2003 - 12:37:38 CDT


-----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 <joostpine.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-----