Original issue date: May 27, 1992<BR>
Last revised: September 19, 1997<BR>
Attached copyright statement 

<P>A complete revision history is at the end of this file.

<P>The Computer Emergency Response Team/Coordination Center (CERT/CC)
has received information concerning a vulnerability involving
environment variables and setuid/setgid programs under Sun
Microsystems Computer Corporation SunOS.  This vulnerability exists on
all Sun architectures running SunOS 4.0 and higher.

<P>In-house and third-party software can also be impacted by this
vulnerability.  For example, the current versions of rnews, sudo,
smount, and npasswd are known to be vulnerable under SunOS.  See the
Description section of this advisory for details of how to identify
software which may be vulnerable.

<P>The workaround detailed in this advisory can be used to protect
vulnerable software on SunOS operating system versions for which
patches are unavailable, or for local or third party software which
may be vulnerable.

<P>Sun has provided patches for SunOS 4.1, 4.1.1, and 4.1.2 programs
which are known to be impacted by this vulnerability.  They are
available through your local Sun Answer Center as well as through
anonymous ftp from the ftp.uu.net (137.39.1.9) system in the
/systems/sun/sun-dist directory.

<PRE>
Fix                     PatchID        Filename            Checksum
login and su            100630-01      100630-01.tar.Z     36269    39
sendmail                100377-04      100377-04.tar.Z     14692   311
</PRE>
Note: PatchID 100630-01 contains the international version of
/usr/bin/login.  PatchID 100631-01 contains the domestic version
of /usr/bin/login and is only available from Sun Answer Centers for 
sites that use the US Encryption Kit.

<P>Please note that Sun will occasionally update patch files.  If you
find that the checksum is different please contact Sun or the CERT/CC
for verification.

<P>
<HR>

<H2>I. Description</H2>

<P>A security vulnerability exists if a set-user-id program changes
its real and effective user ids to be the same (but not to the
invoker's id), and subsequently causes a dynamically-linked program to
be exec'd.  A similar vulnerability exists for set-group-id programs.

<P>In particular, SunOS /usr/lib/sendmail, /usr/bin/login,
/usr/bin/su, and /usr/5bin/su are vulnerable to this problem.

<H2>II. Impact</H2>

<P>Local users can gain unauthorized privileged access to the system.

<H2>III. Solution</H2>

<H3>A.  Obtain and install the patches from Sun or from ftp.uu.net
following the provided instructions.</H3>

<H3>B.  The following workaround can be used to protect vulnerable
binaries for which patches are unavailable for your SunOS version, or
for local or third party software which may be vulnerable. </H3>

The example given is a workaround for /usr/lib/sendmail.  

<OL><LI>  As root, rename the existing version of /usr/lib/sendmail

and modify the permissions to prevent misuse.

<PRE>
             # mv /usr/lib/sendmail /usr/lib/sendmail.dist
             # chmod 755 /usr/lib/sendmail.dist
</PRE>
<Li>  In an empty temporary directory, create a file wrapper.c

containing the following C program source (remember to
strip any leading white-space characters from the #define lines).
<PRE>
/* Start of C program source */

/* Change the next line to reflect the full pathname of the file to be protected by the wrapper code   */

            #define COMMAND &quot;/usr/lib/sendmail.dist&quot;
            #define VAR_NAME &quot;LD_&quot;

             main(argc,argv,envp)
             int argc;
             char **argv;
             char **envp;
             {
                     register char  **cpp;
                     register char  **xpp;
register char   *cp;

                     for (cpp = envp; cp = *cpp;) {
if (strncmp(cp, VAR_NAME, strlen(VAR_NAME))==0) {
for (xpp = cpp; xpp[0] = xpp[1]; xpp++);
                                     /* void */ ;
                             }
                             ee {<BR>
                                     cpp++;<BR>
                             }<BR>
}
<BR>
                     execv(COMMAND, argv);<BR>
                     perror(COMMAND);<BR>
                     <I>exit(1)</I>;<BR>
             }<BR>
/* End of C program source */
</PRE>

<LI>As root, compile the C program source for the wrapper and

install the resulting binary.
 
<PRE>
             # make wrapper
             # mv ./wrapper /usr/lib/sendmail
             # chown root /usr/lib/sendmail
             # chmod 4711 /usr/lib/sendmail

</PRE>
<LI>Steps 1 through 3 should be repeated for other vulnerable

programs with the appropriate substitution of pathnames and file
names. The &quot;COMMAND&quot; C preprocessor variable within the C program
source should also be changed to reflect the appropriate renamed
system binary.
</OL>

<HR>

<P>The CERT/CC wishes to thank the following for their assistance:
CIAC, PCERT, and in particular Wietse Venema of Eindhoven University,
The Netherlands, for his support in the analysis of and a workaround
for this problem.  We also wish to thank Sun Microsystems Computer
Corporation for their prompt response to this vulnerability.

<P>
<!--#include virtual="/include/footer_nocopyright.html" -->
<P>Copyright 1992 Carnegie Mellon University.</P>

<HR>

Revision History
<PRE>
September 19,1997  Attached copyright statement
</PRE>