Date: Thu, 2 Oct 2003 18:38:27 +0200
From: Joost Pol <[email protected]>
To: [email protected]Subject: PINE-CERT-20030901: Integer Overflow in FreeBSD Kernel [fhold]
Cc: [email protected]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
- -------------------------------------------------------------------------------
Pine Digital Security Advisory
- -------------------------------------------------------------------------------
Advisory ID : PINE-CERT-20030901
Authors : Joost Pol
Vendor Informed : 2003-23-09
Issue date : 2003-01-10
Application : kernel / fhold
Version(s) : All 4.X versions since 4.3
Platforms : FreeBSD
Availability : http://www.pine.nl/press/pine-cert-20030901.txt
References : http://www.pine.nl/press/pine-cert-20030101.txt
- -------------------------------------------------------------------------------
Synopsis
While performing an audit for a customer, Pine Digital Security
encountered an integer overflow condition which could lead to
a denial of service attack or privilege escalation.
This vulnerability is similar to the fpathconf vulnerability:
http://www.pine.nl/press/pine-cert-20030101.txt
Versions
FreeBSD RELENG_4.X: All versions >= 4.3 are vulnerable.
FreeBSD RELENG_5.X: Not vulnerable.
Impact
Serious.
Local users can exploit this vulnerability to cause a system
panic (denial of service) or potentially escalate their
privileges.
Description
Inside the readv(2) system call we spotted a condition where a
call to fdrop() is missing. When issueing a readv(2) call with
an oversized iovcnt parameter the function will return without
releasing the outstanding file reference.
Due to the missing fdrop() call inside the readv(2) system call
is it possible to overflow the reference counter of the file
structure (int f_count).
Quoting PINE-CERT-20030101:
Inside the FreeBSD kernel each file (socket, device or regular
file) opened is represented by a file structure (sys/file.h).
Amongst other members this structure holds a reference counter
(int f_count). This reference counter is increased by the fhold()
function and decreased by the fdrop() function. (both in sys/file.h)
For example, when a file is open(2)ed or dup(2)ed the reference
counter is increased and when the file is close(2)ed again the
reference counter is decreased. Once the reference counter reaches
zero, the file structure itself is deallocated.
Most system calls which perform (blocking) operations on a file
will issue a fhold() call to prevent the file from being closed
in the middle of an operation. Once the operation is finished the
(extra) reference will be released again by issuing a fdrop() call.
Exploitability
On most vulnerable systems this vulnerability can be reliably
exploited by local users to escalate their privileges or cause
an effective denial of service attack.
Refer to PINE-CERT-20030101 for more information.
Disclaimer
Pine Digital Security does not release exploits.
Patches
The FreeBSD Project has updated their CVS repositories.
References
FreeBSD-SA-03:16.filedesc
http://www.pine.nl/press/pine-cert-20030901.txt
file://usr/include/sys/file.h
file://usr/src/sys/kern/kern_descrip.c
file://usr/src/sys/kern/vfs_syscalls.c
file://usr/src/sys/kern/sys_generic.c
- --
Service Provider :: Pine Digital Security :| www.pine.nl || +31 (0)70 311 10 10
:: PGP id 0xF360BB93 fpr ABED 303C 0120 E057 633A 1CB1 D236 C82A F360 BB93 ::
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (SunOS)
iEYEARECAAYFAj98VIEACgkQ0jbIKvNgu5OzXwCgoq7PyTz244habUO+IT3ds4Mo
yIcAnRljCDAH35lg/Tvny2vBx7GacDJx
=y/bU
-----END PGP SIGNATURE-----