SUMMARY: Unauthorized user(s) can gain root priviledges

From: Wojciech Mikanik (
Date: Wed Jun 11 1997 - 05:20:22 CDT

this is summary of answers I received for my query related to using
/bin/eject to gain root priviledges.
It is organized as follows:
1. Original message
2. Some information about the program
3. Solutions
4. Sources of additional information
4. *Thanks*
1. Original message
  We have SPARCClassic with Solaris 2.5.1 (installed a couple days
ago). There is a very simple program (about 60-70 lines of C code),
which allow any user to change his/her effective id to root (uid and
gid stays the same). It does execl with three arguments:
"/bin/eject", "eject" and the third one.
I would be very grateful for every piece of information which help me
to make my system more secure.
It is rather urgent matter."
2.Some information about the program
It seems that everybody has known the hole, exept me.

This is Sun bug #4038903. It was posted to the bugtraq mailing-list
in March by Christian Schipor and announced in

The hole with eject is a buffer overflow condition. Basically what
happens is eject doesn't do proper bounds checking on its arguments,
so if you overrun the buffer, it will copy data to the stack. The
tricky part is to do it so that the pc register (program counter, ie
next executed instruction) gets filled with a pointer to the code you
want to execute (ie a shell). since eject is running SUID-root, you
get a root shell.
3. Solutions
a)The quick fix is to take suid off of /bin/eject:
chmod 0555 /usr/bin/eject, or chmod u-s /usr/bin/eject

b) The following patches fix the problem:
101331-07: SunOS 5.3: fixes for package utilities
101907-14: SunOS 5.4: fixes to volume management
101908-14: SunOS 5.4_x86: fixes to volume management
103024-02: SunOS 5.5: libvolmgt patch
103044-02: SunOS 5.5_x86: libvolmgt patch
104776-01: SunOS 5.5.1: libvolmgt patch
104777-01: SunOS 5.5.1_x86: libvolmgt patch
Released between April 1st and April 17th.

c) Install recommended patches for Solaris 2.5.1 from

d)Install sudo, a program which allows defined users to execute
defined programs
with root privileges:
4. Sources of additional information (about this hole and many others)

a) This bug was posted to the bugtraq mailing-list in March by
Christian Schipor. You can find his original posting with his
suggested fix at
Caspar Diks answer is archived there as

b) Here is an official bulletin announcing the eject command's buffer

c) The AUS-CERT has an advisory out which describes the
   vulnerability and also workarounds:

d) There is a web site dealing with "buffer overflow" exploit

d) BUGTRAQ mailing list:
   The URL for the BUGTRAQ WWW server is :
   There are instructions there on how to get onto the list,
   apparently, BUGTRAQ hit 10000 subscribers the otherday. There is
   also a TRAQ list, NTBUGTRAQ.

e) FIRST, the Forum of Incident Response and Security Teams.
   For more information about FIRST, visit the FIRST web site
   at "".

f) Other security-advisories can be found at the German CERT:
   or at the US-CERT:
4. Thanks
I would like to thank all who replied:
Chad L. Cook <>
James Fifield <>
Parthiv Shah <>
Ian MacPhedran <Ian_MacPhedran@engr.USask.Ca>
Casper Dik <casper@holland.Sun.COM>
Gary Franczyk <>
Tom Vayda <> (Dieter Gobbers )
Hans Schaechl <> (Brett)
David Fetrow <>
Jason Keltz <>
Matt Reynolds <>
Craig Raskin <>
Cagri Yucel <>
Liew.Chee.Wah <>
Tony C. Wu <>
Gnuchev Fedor <>
Martin Trampler <>

Wojciech Mikanik

Silesia University of Technology
Institute of Computer Science
Akademicka 16
44-100 Gliwice, Poland
Phone: +48-32-37-27-05
Fax: + 48-32-37-27-33

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:11:56 CDT