-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
iDEFENSE Security Advisory 02.10.04
XFree86 Font Information File Buffer Overflow
http://www.idefense.com/application/poi/display?id=3D72
February 10, 2004
I. BACKGROUND
In short, XFree86 is an open source X11-based desktop infrastructure.
XFree86, provides a client/server interface between display hardware=20
(the mouse, keyboard, and video displays) and the desktop environment=20
while also providing both the windowing infrastructure and a=20
standardized application interface (API). XFree86 is platform=20
independent, network-transparent and extensible.
II. DESCRIPTION
Exploitation of a buffer overflow in The XFree86 Project Inc.'s XFree86=20
X Window System allows local attackers to gain root privileges.
The problem specifically exists in the parsing of the 'font.alias' file.
The X server (running as root) fails to check the length of user=20
provided input. A malicious user may craft a malformed 'font.alias'=20
file causing a buffer overflow upon parsing, eventually leading to the=20
execution of arbitrary code.
- - - From XFree86-4.2.1/xc/lib/font/fontfile/dirfile.c:=20
ReadFontAlias(char *directory, Bool isFile, FontDirectoryPtr *pdir)
{
char alias[MAXFONTNAMELEN];=20
The above code sets up the buffer that will be exploited directly in=20
front of the frame pointer and return address.=20
while (status =3D=3D Successful) {
token =3D lexAlias(file, &lexToken);=20
lexAlias() reads an arbitrary length token from file, and returns a=20
pointer to it in &lexToken, without performing any bounds checking.=20
It then returns NAME when it reaches whitespace.=20
switch (token) {
case NAME:
strcpy(alias, lexToken);=20
If lexToken is longer than MAXFONTNAMELEN (1024 chars) an overflow=20
occurs.=20
To reproduce the overflow on the command line:=20
# cat > fonts.dir <<EOF=20
1
word.bdf -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1
EOF
# perl -e 'print "0" x 1024 . "A" x 96 . "\n"' > fonts.alias
# X :0 -fp $PWD=20
{Some output removed}=20
Caught signal 11.
Server aborting...
eip: 41414141 eflags: 00003282
{Some output removed}=20
Code: Segmentation fault (core dumped)
#=20
III. ANALYSIS
Successful exploitation requires that an attacker be able to execute=20
commands in the X11 subsystem. This can be done either by having console
access to the target or through a remote exploit against any X client=20
program such as a web-browser, mail-reader or game. Successful=20
exploitation yields root access.
IV. DETECTION
iDEFENSE has confirmed the existence of this vulnerability in XFree86=20
versions 4.1.0 to the current version 4.3.0. It is suspected that=20
earlier versions are vulnerable as well.
V. VENDOR RESPONSE
The patch for the problem is at=20
ftp://ftp.xfree86.org/pub/XFree86/4..../fontfile.diff and
it is applicable to all affected XFree86 versions.
The change log entry is:
794. Fix font alias overrun.
See also http://www.xfree86.org/cvs/changes/ for changelog extracts for
the trunk and several branches. The patch has been applied to the
trunk and all of the 4.x release branches.
VI. CVE INFORMATION
The Mitre Corp.'s Common Vulnerabilities and Exposures (CVE) Project=20
has assigned CAN-2004-0083 to this issue.
VII. DISCLOSURE TIMELINE
January 9, 2004 Exploit acquired by iDEFENSE
February 3, 2004 Vendor notified
February 3, 2004 Response received from David Dawes at XFree86.org
February 4, 2004 iDEFENSE clients notified
February 10, 2004 Public disclosure
VIII. CREDIT
Greg MacManus (iDEFENSE Labs) is credited with the discovery of this=20
vulnerability.
-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0.3
iQA/AwUBQCkyufrkky7kqW5PEQLonACfXr39VTFMM0siQ9qQG4ujRX KSTggAoLKi
gdS6+/EbfSpKM3TX1tzCsNfX
=3DF0Tw
-----END PGP SIGNATURE-----

Likes:

Quote