-----BEGIN PGP SIGNED MESSAGE-----

===========================================================================
              AUSCERT External Security Bulletin Redistribution

                             
                 ESB-97.070 -- Sun Security Bulletin #00141
		        Vulnerability in getopt(3)
                               5 June 1997

===========================================================================

Sun Microsystems, Inc. has released the following advisory concerning a
vulnerability in getopt.  This vulnerability may allow local users to gain
root access.

The following security bulletin is provided as a service to AUSCERT's
members.  As AUSCERT did not write this document, AUSCERT has had no
control over its content.  As such, the decision to use any or all of this
information is the responsibility of each user or organisation, and should
be done so in accordance with site policies and procedures.

Contact information for Sun Microsystems, Inc. is included in the Security
Bulletin below.  If you have any questions or need further information,
please contact them directly.

Previous advisories and external security bulletins can be retrieved from:

	http://www.auscert.org.au/information/advisories.html

If you believe that your system has been compromised, contact AUSCERT or your
representative in FIRST (Forum of Incident Response and Security Teams).

Internet Email: auscert@auscert.org.au
Facsimile:      (07) 3365 4477
Telephone:      (07) 3365 4417 (International: +61 7 3365 4417)
	AUSCERT personnel answer during Queensland business hours
	which are GMT+10:00 (AEST).
	On call after hours for emergencies.


- --------------------------BEGIN INCLUDED TEXT--------------------

- ------------------------------------------------------------------------------
 		   Sun Microsystems, Inc. Security Bulletin
 		
Bulletin Number:	#00141
Date: 			4 June 1997
Cross-Ref:		
Title:			Vulnerability in getopt(3)

- ------------------------------------------------------------------------------
Permission is granted for the redistribution of this Bulletin, so long as 
the Bulletin is not edited and is attributed to Sun Microsystems. Portions 
may also be excerpted for re-use in other security advisories so long as 
proper attribution is included.

Any other use of this information without the express written consent of 
Sun Microsystems is prohibited. Sun Microsystems expressly disclaims all 
liability for any misuse of this information by any third party.
- ------------------------------------------------------------------------------

1.  Bulletins Topics

    Sun announces the release of patches for Solaris 2.5.1, 2.5, and 2.4 
    (SunOS 5.5.1, 5.5, and 5.4) that relate to a vulnerability with the 
    getopt(3) function in the libc library. Any privileged program (setuid 
    or setgid) that uses getopt(3) may exploit the vulnerability to gain root 
    access.
     
    Sun estimates the release of patches for Solaris 2.4_x86 and 2.3 (SunOS 
    5.4_x86 and 5.3) that relate to the same vulnerability will be available 
    within 1 week and 3 weeks respectively of the date of this bulletin. 
    
    Sun strongly recommends that you:
    
    a. install the patches listed in section 5 immediately on every system 
       running SunOS 5.5.1, 5.5.1_x86, 5.5, 5.5_x86, or 5.4
    b. apply the workarounds specified in section 4 immediately on every system 
       running SunOS 5.4_x86 or 5.3.
    
2.  Who is Affected
	
       Vulnerable:	SunOS versions 5.5.1, 5.5.1_x86, 5.5, 5.5_x86, 
                                       5.4, 5.4_x86, and 5.3.
      
       Not vulnerable:	All other supported versions of SunOS
     		 
       This vulnerability is fixed in the upcoming release of Solaris.
     
3.  Understanding the Vulnerability

    The getopt(3) function parses options from a program's command list.
    Due to insufficient bounds checking by getopt(3) while processing command 
    line arguments, it is possible to overwrite the internal stack space of 
    programs that use getopt(3). This may allow users to cause programs using 
    getopt(3) to execute arbitrary commands by supplying carefully crafted 
    arguments to these programs. If these programs are setuid or setgid, then 
    these commands may be run with those privileges. 

    Any dynamically or statically linked setuid or setgid program that uses 
    getopt(3) may be vulnerable.
    
4.  Workarounds

4.1 Dynamically linked programs

    The vulnerability can be exploited by using getopt(3) to print error 
    messages when an invalid option is discovered. These messages can be 
    suppressed by setting "opterr" (a global libc variable) to zero by doing 
    the following:

    As root, execute the following command:

      # adb -w /lib/libc.so.1
      
    Type the following:
    
      opterr?W0
      
    The system will respond with:
    			                
      opterr:         0x1             =       0x0

    Type Control-D to exit adb.

    Note that this workaround will suppress getopt(3) error messages from 
    all dynamically linked executables.

4.2 Statically linked programs

    The workaround in 4.1 cannot be applied to statically linked setuid or
    setgid programs. Other than /usr/sbin/static/rcp, Sun is not aware of any 
    other statically linked executable that uses getopt(3). The vulnerability
    in the rcp program can be closed by removing the setuid bit with a command
    such as the following:
    
       chmod 555 /usr/sbin/static/rcp
    
    The rcp program is typically run as root during system boot or recovery
    only.

5.  The vulnerability relating to getopt(3) is fixed by the following patches:

	OS version		Patch ID
	----------		--------
	SunOS 5.5.1		103612-23
	SunOS 5.5.1_x86         103613-23
     	SunOS 5.5		103187-25
     	SunOS 5.5_x86           103188-25
     	SunOS 5.4               101945-49	
	SunOS 5.4_x86           101946-43	(to be released in 1 week)
     	SunOS 5.3               101318-87	(to be released in 3 weeks)

6.  Checksum Table

    The checksum table below shows the BSD checksums (SunOS 5.x: /usr/ucb/sum),
    SVR4 checksums (SunOS 5.x: /usr/bin/sum), and the MD5 digital signatures 
    for the above-mentioned patches that are available from:
     
     	ftp://sunsolve1.sun.com/pub/patches/patches.html
     	
    These checksums may not apply if you obtain patches from your answer
    centers. 

File Name	  BSD	       SVR4	    MD5
- ---------------   ---------    ---------    --------------------------------
103612-23.tar.Z   58756 3133   30630 6266   80BFC84479DAED881141250D924C6B1A
103613-23.tar.Z   25868 2829   1295 5657    5AE2770752A17D853029B539EF94B783
103187-25.tar.Z   64511 3195   17448 6389   36120E6EB91C100EB302CE2FEE96739A
103188-25.tar.Z   07195 2880   23176 5760   6707EAB1BD10B845F535E131836F8DC5
101945-49.tar.Z   25995 10899  19660 21798  D67A5744C87BAD1A31D87AED6DC3C362

- ------------------------------------------------------------------------------
Sun acknowledges with thanks AUSCERT, CERT/CC, and DFNCERT for their assistance 
in the preparation of this bulletin.

Sun, AUSCERT, CERT/CC, and DFNCERT are members of FIRST, the Forum of Incident 
Response and Security Teams. For more information about FIRST, visit the FIRST 
web site at "http://www.first.org/".
- ------------------------------------------------------------------------------

APPENDICES

A.  Patches listed in this bulletin are available to all Sun customers via 
    World Wide Web at:
    
    	ftp://sunsolve1.sun.com/pub/patches/patches.html
    	
    Customers with Sun support contracts can also obtain patches from local 
    Sun answer centers and SunSITEs worldwide.
    
B.  To report or inquire about a security problem with Sun software, contact 
    one or more of the following:
  
        - Your local Sun answer centers
        - Your representative computer security response team, such as CERT 
        - Sun Security Coordination Team. Send email to:
	 
     		security-alert@sun.com
     		
C.  To receive information or subscribe to our CWS (Customer Warning System) 
    mailing list, send email to:
    
    		security-alert@sun.com
   
    with a subject line (not body) containing one of the following commands:

        Command         Information Returned/Action Taken
        -------         ---------------------------------

        HELP            An explanation of how to get information

        LIST            A list of current security topics

        QUERY [topic]   The mail containing the question is relayed to
                        the Security Coordination Team for response.

        REPORT [topic]  The mail containing the text is treated as a
                        security report and forwarded to the Security
                        Coordination Team. We do not recommend that detailed 
                        problem descriptions be sent in plain text.

        SEND topic      A short status summary or bulletin. For example, to 
        		retrieve a Security Bulletin #00138, supply the 
        		following in the subject line (not body):
        		
        			SEND #138

        SUBSCRIBE       Sender is added to our mailing list.  To subscribe, 
                        supply the following in the subject line (not body):

                            	SUBSCRIBE cws your-email-address
			
			Note that your-email-address should be substituted
			by your email address.
			
        UNSUBSCRIBE     Sender is removed from our mailing list.
- ------------------------------------------------------------------------------

- --------------------------END INCLUDED TEXT--------------------


-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv
Comment: ftp://ftp.auscert.org.au/pub/auscert/AUSCERT_PGP.key

iQCVAwUBM5aciCh9+71yA2DNAQFQbgP+KjDPzkuKsVaoy9Q9pDE+ckr1CrrvoQ3H
XIhCMffgUR7ttQpOka8aoYS88dBuHsYY73P9Sb1XV+syhh4JzZoBU3qQjS9N23km
wzSNbFUB3/9H5LPF0FgxRGvl0K7BCz/vpdLuoGa7qvOlFkCku++vohqEyLDEFxXd
MjK5yfAHlXk=
=svMi
-----END PGP SIGNATURE-----