Users login

Create an account »


Users login

Home » Hacking News » FreeBSD Security Advisory FreeBSD-SA-02:44.filedesc

FreeBSD Security Advisory FreeBSD-SA-02:44.filedesc

by Nikola Strahija on January 8th, 2003 A programming error in the fpathconf system call can result in the given file descriptor's reference count being erroneously incremented.

Category: core
Module: kernel
Announced: 2003-01-07
Credits: Joost Pol
Affects: FreeBSD 4.3-RELEASE and later versions
Corrected: 2002-11-11 01:43:31 UTC (RELENG_4)
2003-01-06 12:37:52 UTC (RELENG_4_7)
2003-01-06 12:38:21 UTC (RELENG_4_6)
2003-01-07 15:17:16 UTC (RELENG_4_5)
2003-01-07 15:17:40 UTC (RELENG_4_4)
2003-01-06 21:20:54 UTC (RELENG_5_0)
FreeBSD only: YES

0. Revision History

2003-01-06 v1.0 Initial release.
2003-01-07 v1.1 Added information regarding bug in FreeBSD 5.x.
Added correction details for RELENG_4_5, RELENG_4_4.

I. Background

The fpathconf system call provides a method for applications to
determine the current value of a configurable system limit or option
variable associated with a pathname or file descriptor.

II. Problem Description

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

A similar problem exists in the developer preview versions of FreeBSD
5.0, affecting the lseek(2), dup(2), and other system calls.

III. Impact

A local attacker may cause the operating system to crash by repeatedly
calling fpathconf 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.4, 4.5,
4.6, and 4.7 systems.

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

# fetch
# fetch

b) Apply the patch.

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

c) Recompile your kernel as described in
; and reboot the

VI. Correction details

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

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

VII. References

Version: GnuPG v1.2.1 (FreeBSD)


Newsletter signup

Signup to our monthly newsletter and stay in touch with IT news!

Free E-books

We've got ebooks! But they're not online. :( Please give us a few days to bring downloads back.


Have something to say or just wanna drop us a line? Please keep this in mind: to spam, we reply with spam.

Contact us »