__________________________________________________________ The U.S. Department of Energy Computer Incident Advisory Capability ___ __ __ _ ___ / | /_\ / \___ __|__ / \ \___ __________________________________________________________ INFORMATION BULLETIN Vulnerability in suidperl (sperl) April 8, 1998 21:00 GMT Number H-66a ______________________________________________________________________________ PROBLEM: A problem has been identified in suidperl that allows a buffer overflow condition. PLATFORM: All Unix systems with Perl 4.x and Perl 5.x. DAMAGE: When calling this program with appropriately crafted parameters, unauthorized local users can execute arbitrary commands as root. SOLUTION: Apply the proper patch supply by vendor. ______________________________________________________________________________ VULNERABILITY This vulnerability is being actively exploited. ASSESSMENT: ______________________________________________________________________________ [ Appended on April 8, 1998 with additional vendor information ] [ Start CERT Advisory ] ============================================================================= CERT* Advisory CA-97.17 Original issue date: May 29, 1997 Last revised: -- Topic: Vulnerability in suidperl (sperl) - ------------------------------------------------------------------------------ The CERT Coordination Center has received reports of a buffer overflow condition in suidperl built from Perl 4.n and Perl 5.n distributions on UNIX systems. By calling this program with appropriately crafted parameters, unauthorized local users can execute arbitrary commands as root. This vulnerability is being actively exploited. The CERT/CC team recommends installing a vendor patch if one is available (see Section III.B). Until you can do so, we recommend disabling suidperl (Section III.A). Two other alternatives are to install suidperl or sperl from version 5.003 source code along with the patch provided in Appendix B of this advisory (see also Section III.C), or upgrade to Perl version 5.004 (Section III.D). Note that Perl4 is no longer supported. We will update this advisory as we receive additional information. Please check our advisory files regularly for updates that relate to your site. - ------------------------------------------------------------------------------ I. Description On some systems, setuid and setgid scripts (scripts written in the C shell, Bourne shell, or Perl, for example, with the set user or group ID permissions enabled) are insecure due to a race condition in the kernel. For those systems, Perl versions 4 and 5 attempt to work around this vulnerability with a special program named suidperl, also known as sperl. This program attempts to emulate the set-user-ID and set-group-ID features of the kernel. There is a buffer overflow condition in suidperl built from Perl 4.n and Perl 5.n distributions earlier than version 5.004. If this program is called with appropriately crafted parameters, an attacker can execute arbitrary commands as root. This vulnerability is being actively exploited. II. Impact Users executing Perl scripts with the setuid bit set can execute arbitrary commands with the effective uid of the owner of the Perl script. Attackers can execute commands as root. III. Solution Use the command in Section A to help you determine if your system is vulnerable and, if it is, to (optionally) disable the suidperl and sperl programs (see Section A). If you find that your system is vulnerable, replace the suidperl and sperl programs with new versions. Section B describes how to do that if your site uses versions of suidperl and sperl that are provided as part of a vendor-supplied distribution. Sites that installed suidperl and sperl programs themselves from the Perl source distribution should patch the distribution as described in Section C or upgrade to version 5.004 as described in Section D. Note that Perl4 is no longer supported. A. Determine if your system is vulnerable and disable vulnerable programs To determine if a system is vulnerable to this problem and to disable the programs that are believed to be vulnerable, use the following find command or a variant. Consult your local system documentation to determine how to tailor the find program on your system. After you have run this command on all your systems, they will no longer be vulnerable. Note that after disabling the suidperl and sperl programs, they will no longer be able to emulate the set-user-ID and set-group-ID features of the kernel. You will need to run the find command on each system you maintain because the command examines files on the local disk only. Substitute the names of your local file systems for FILE_SYSTEM_NAMES in the example. Example local file system names are /, /usr, and /var. You must do this as root. Note that this is one long command, though we have separated it onto five lines using back-slashes. find FILE_SYSTEM_NAMES -xdev -type f -user root \ \( -name 'sperl4.[0-9][0-9][0-9]' \ -o -name 'sperl5.00[0-3]' \ -o -name 'suidperl' \) \ -perm -04000 -print -ok chmod ug-s '{}' \; This command will find all files on a system that are - only in the file system you name (FILE_SYSTEM_NAMES -xdev) - regular files (-type f) - owned by root (-user root) - named appropriately (-name 'sperl4.[0-9][0-9][0-9]' -o -name 'sperl5.00[0-3]' -o -name 'suidperl') - setuid root (-perm -04000) Once found, those files will - have their names printed (-print) - have their modes changed, but only if you type `y' in response to the prompt (-ok chown ug-s '{}' \;) B. Obtain and install the appropriate patch from your vendor If your vendor ships suidperl or sperl, you may be vulnerable and need a patch. Appendix A contains information provided by the following vendors. If your vendor is not on this list, please contact the vendor directly. Berkeley Software Design, Inc. (BSDI) Cray Research - A Silicon Graphics Company Data General Corporation Hewlett-Packard Company IBM Corporation Linux The Santa Cruz Operation, Inc. (SCO) Silicon Graphics, Inc. (SGI) Until you can install a patch, we recommend disabling suidperl. The find command above will help you do that. If you need suidperl or sperl, see the alternatives in Sections C and D below. C. Install suidperl or sperl from 5.003 source code and apply a patch. Follow the instructions below, which were provided by Chip Salzenberg. If you would like to keep using setuid Perl scripts, fix Perl yourself by following these steps: 1. Go to your Perl 5.003 source directory, or else obtain a fresh Perl 5.003 distribution from http://www.perl.com/CPAN/src/5.0/perl5.003.tar.gz or another CPAN archive accessible to you. This file is approximately 1.5 megabytes in size. 2. Using the "patch" program, apply the patch that is enclosed below in Appendix B. 3. Build and install the patched Perl 5.003. (If you have never built Perl before, be sure to read the "INSTALL" file first.) Perl 5.003 binaries that have had this patch applied, and therefore are safe from all known attacks, can be identified by the output of the "perl -v" command: the "locally applied patches" list will include "SUIDBUF - Buffer overflow fixes for suidperl security". D. Install suidperl or sperl from 5.004 source code (no patch needed). If you would like to upgrade to Perl version 5.004, follow these steps: 1. Obtain a fresh Perl 5.004 distribution from http://www.perl.com/CPAN/src/5.0/perl5.004.tar.gz or another CPAN archive accessible to you. This file is approximately 2.5 megabytes in size. 2. Build and install Perl 5.004 according to the instructions given in the "INSTALL" file. Do NOT apply the patch. Perl 5.004 binaries, which are safe from all known attacks, can be identified by the output of the "perl -v" command: it should say "This is perl, version 5.004". (Unlike the 5.003 patch mentioned in Section C, the "locally applied patches" list will NOT include "SUIDBUF - Buffer overflow fixes for suidperl security". The fact that it is version 5.004 is sufficient in this case.) ============================================================================== Appendix A - Vendor Information Below is a list of the vendors who have provided information for this advisory. We will update this appendix as we receive additional information. If you do not see your vendor's name, the CERT/CC did not hear from that vendor. Please contact the vendor directly. Berkeley Software Design, Inc. (BSDI) ===================================== BSD/OS is vulnerable to the suidperl (sperl) buffer overflow problem. We will be releasing a patch for BSDI 3.0 and perl 5.003 and are currently working on patches for BSD/OS 3.0 and Perl 4.036. We will also be developing patches for the perl versions shipped with BSD/OS 2.1. Cray Research - A Silicon Graphics Company ========================================== Cray Research does not ship perl as part of either Unicos or Unicos/mk. Data General Corporation ======================== The only perl executables that are shipped with DG/UX are: /bin/perl and /bin/perl5 /* in R420 */ These are not set uid programs. Therefore, No versions of DG/UX are vulnerable to this problem. Hewlett-Packard Company ======================= HP does not ship this product. IBM Corporation =============== AIX versions do not have Perl as part of the standard product. However, the SP2's PSSP software does contain suidperl, but the program is not installed with the setuid bit set. IBM and AIX are registered trademarks of International Business Machines Corporation. Linux ===== Red Hat 4.2 is not vulnerable Red Hat 4.1/4.0 you can get the upgraded RPM from ftp.redhat.com If you wish to check whether you have the fixed perl run perl -v and check for Locally applied patches: SUIDBUF - Buffer overflow fixes for suidperl security The Santa Cruz Operation, Inc. (SCO) ==================================== suidperl is not included in any SCO products. SCO CMW+ and SCO OpenServer do not have kernel support for setuid scripts, but you may have installed suidperl in order to emulate that functionality - in that case you should replace your version of perl with version 5.004, or patch your source code as noted in this advisory. SCO UnixWare does have safe kernel support for setuid scripts so that suidperl is not necessary. If you have installed a version of perl that includes suidperl, you should remove suidperl and install a version of perl built so as not to require it. Silicon Graphics, Inc. (SGI) ============================= At this time, Silicon Graphics does not have any public information for this suidperl/sperl issue. Silicon Graphics has communicated with CERT and other external security parties and is actively investigating this issue. When more Silicon Graphics information (including any possible patches) is available for release, that information will be released via the SGI security mailing list, wiretap. For subscribing to the wiretap mailing list and other SGI security related information, please refer to the Silicon Graphics Security Headquarters website located at: http://www.sgi.com/Support/Secur/security.html ============================================================================ Appendix B - Source Code Patch Information The following patch information has been supplied by Chip Salzenberg. If you built suidperl or sperl from 5.003 source code, we encouraged you to apply this patch (see the explanation in Section III.C above). Patch follows. - --------------------------------------------------------------------------- Index: patchlevel.h *************** *** 41,42 **** - - --- 41,43 ---- + ,"SUIDBUF - Buffer overflow fixes for suidperl security" ,NULL }; Index: perl.c *************** char *s; *** 1212,1216 **** # endif #endif ! fputs("\n\t+ suidperl security patch", stdout); fputs("\n\nCopyright 1987-1996, Larry Wall\n",stdout); #ifdef MSDOS - - --- 1212,1216 ---- # endif #endif ! fputs("\n\t+ two suidperl security patches", stdout); fputs("\n\nCopyright 1987-1996, Larry Wall\n",stdout); #ifdef MSDOS Index: gv.c *************** gv_fetchfile(name) *** 59,67 **** char *name; { ! char tmpbuf[1200]; GV *gv; ! sprintf(tmpbuf,"::_<%s", name); gv = gv_fetchpv(tmpbuf, TRUE, SVt_PVGV); sv_setpv(GvSV(gv), name); if (*name == '/' && (instr(name,"/lib/") || instr(name,".pm"))) - - --- 59,80 ---- char *name; { ! char smallbuf[256]; ! char *tmpbuf; ! STRLEN tmplen; GV *gv; ! tmplen = strlen(name) + 4; ! if (tmplen < sizeof smallbuf) ! tmpbuf = smallbuf; ! else ! New(603, tmpbuf, tmplen + 1, char); ! tmpbuf[0] = ':'; ! tmpbuf[1] = ':'; ! tmpbuf[2] = '_'; ! tmpbuf[3] = '<'; ! strcpy(tmpbuf + 4, name); gv = gv_fetchpv(tmpbuf, TRUE, SVt_PVGV); + if (tmpbuf != smallbuf) + Safefree(tmpbuf); sv_setpv(GvSV(gv), name); if (*name == '/' && (instr(name,"/lib/") || instr(name,".pm"))) Index: toke.c *************** static char *scan_const _((char *start)) *** 22,26 **** static char *scan_formline _((char *s)); static char *scan_heredoc _((char *s)); ! static char *scan_ident _((char *s, char *send, char *dest, I32 ck_uni)); static char *scan_inputsymbol _((char *start)); static char *scan_pat _((char *start)); - - --- 22,27 ---- static char *scan_formline _((char *s)); static char *scan_heredoc _((char *s)); ! static char *scan_ident _((char *s, char *send, char *dest, STRLEN destlen, ! I32 ck_uni)); static char *scan_inputsymbol _((char *start)); static char *scan_pat _((char *start)); *************** static char *scan_str _((char *start)); *** 28,32 **** static char *scan_subst _((char *start)); static char *scan_trans _((char *start)); ! static char *scan_word _((char *s, char *dest, int allow_package, STRLEN *slp)); static char *skipspace _((char *s)); static void checkcomma _((char *s, char *name, char *what)); - - --- 29,34 ---- static char *scan_subst _((char *start)); static char *scan_trans _((char *start)); ! static char *scan_word _((char *s, char *dest, STRLEN destlen, ! int allow_package, STRLEN *slp)); static char *skipspace _((char *s)); static void checkcomma _((char *s, char *name, char *what)); *************** static char * filter_gets _((SV *sv, FIL *** 47,50 **** - - --- 49,54 ---- static void restore_rsfp _((void *f)); + static char too_long[] = "Identifier too long"; + /* The following are arranged oddly so that the guard on the switch statement * can get by with a single comparison (if the compiler is smart enough). *************** int allow_tick; *** 475,479 **** (allow_tick && *s == '\'') ) { ! s = scan_word(s, tokenbuf, allow_pack, &len); if (check_keyword && keyword(tokenbuf, len)) return start; - - --- 479,483 ---- (allow_tick && *s == '\'') ) { ! s = scan_word(s, tokenbuf, sizeof tokenbuf, allow_pack, &len); if (check_keyword && keyword(tokenbuf, len)) return start; *************** register char *s; *** 847,851 **** unsigned char un_char = 0, last_un_char; char *send = strchr(s,']'); ! char tmpbuf[512]; if (!send) /* has to be an expression */ - - --- 851,855 ---- unsigned char un_char = 0, last_un_char; char *send = strchr(s,']'); ! char tmpbuf[sizeof tokenbuf * 4]; if (!send) /* has to be an expression */ *************** register char *s; *** 872,876 **** weight -= seen[un_char] * 10; if (isALNUM(s[1])) { ! scan_ident(s,send,tmpbuf,FALSE); if ((int)strlen(tmpbuf) > 1 && gv_fetchpv(tmpbuf,FALSE, SVt_PV)) weight -= 100; - - --- 876,880 ---- weight -= seen[un_char] * 10; if (isALNUM(s[1])) { ! scan_ident(s, send, tmpbuf, sizeof tmpbuf, FALSE); if ((int)strlen(tmpbuf) > 1 && gv_fetchpv(tmpbuf,FALSE, SVt_PV)) weight -= 100; *************** GV *gv; *** 942,946 **** { char *s = start + (*start == '$'); ! char tmpbuf[1024]; STRLEN len; GV* indirgv; - - --- 946,950 ---- { char *s = start + (*start == '$'); ! char tmpbuf[sizeof tokenbuf]; STRLEN len; GV* indirgv; *************** GV *gv; *** 952,956 **** gv = 0; } ! s = scan_word(s, tmpbuf, TRUE, &len); if (*start == '$') { if (gv || last_lop_op == OP_PRINT || isUPPER(*tokenbuf)) - - --- 956,960 ---- gv = 0; } ! s = scan_word(s, tmpbuf, sizeof tmpbuf, TRUE, &len); if (*start == '$') { if (gv || last_lop_op == OP_PRINT || isUPPER(*tokenbuf)) *************** yylex() *** 1629,1633 **** case '*': if (expect != XOPERATOR) { ! s = scan_ident(s, bufend, tokenbuf, TRUE); expect = XOPERATOR; force_ident(tokenbuf, '*'); - - --- 1633,1637 ---- case '*': if (expect != XOPERATOR) { ! s = scan_ident(s, bufend, tokenbuf, sizeof tokenbuf, TRUE); expect = XOPERATOR; force_ident(tokenbuf, '*'); *************** yylex() *** 1645,1649 **** case '%': if (expect != XOPERATOR) { ! s = scan_ident(s, bufend, tokenbuf + 1, TRUE); if (tokenbuf[1]) { expect = XOPERATOR; - - --- 1649,1653 ---- case '%': if (expect != XOPERATOR) { ! s = scan_ident(s, bufend, tokenbuf + 1, sizeof tokenbuf - 1, TRUE); if (tokenbuf[1]) { expect = XOPERATOR; *************** yylex() *** 1748,1752 **** s++; if (s < bufend && isALPHA(*s)) { ! d = scan_word(s, tokenbuf, FALSE, &len); while (d < bufend && (*d == ' ' || *d == '\t')) d++; - - --- 1752,1756 ---- s++; if (s < bufend && isALPHA(*s)) { ! d = scan_word(s, tokenbuf, sizeof tokenbuf, FALSE, &len); while (d < bufend && (*d == ' ' || *d == '\t')) d++; *************** yylex() *** 1847,1851 **** } ! s = scan_ident(s-1, bufend, tokenbuf, TRUE); if (*tokenbuf) { expect = XOPERATOR; - - --- 1851,1855 ---- } ! s = scan_ident(s - 1, bufend, tokenbuf, sizeof tokenbuf, TRUE); if (*tokenbuf) { expect = XOPERATOR; *************** yylex() *** 1956,1960 **** case '$': if (s[1] == '#' && (isALPHA(s[2]) || strchr("_{$:", s[2]))) { ! s = scan_ident(s+1, bufend, tokenbuf+1, FALSE); if (expect == XOPERATOR) { if (lex_formbrack && lex_brackets == lex_formbrack) { - - --- 1960,1965 ---- case '$': if (s[1] == '#' && (isALPHA(s[2]) || strchr("_{$:", s[2]))) { ! s = scan_ident(s + 1, bufend, tokenbuf + 1, sizeof tokenbuf - 1, ! FALSE); if (expect == XOPERATOR) { if (lex_formbrack && lex_brackets == lex_formbrack) { *************** yylex() *** 1982,1986 **** TOKEN(DOLSHARP); } ! s = scan_ident(s, bufend, tokenbuf+1, FALSE); if (expect == XOPERATOR) { if (lex_formbrack && lex_brackets == lex_formbrack) { - - --- 1987,1991 ---- TOKEN(DOLSHARP); } ! s = scan_ident(s, bufend, tokenbuf + 1, sizeof tokenbuf - 1, FALSE); if (expect == XOPERATOR) { if (lex_formbrack && lex_brackets == lex_formbrack) { *************** yylex() *** 2016,2024 **** if (*s == '{' && strEQ(tokenbuf, "$SIG") && (t = strchr(s,'}')) && (t = strchr(t,'='))) { ! char tmpbuf[1024]; STRLEN len; for (t++; isSPACE(*t); t++) ; if (isIDFIRST(*t)) { ! t = scan_word(t, tmpbuf, TRUE, &len); if (*t != '(' && perl_get_cv(tmpbuf, FALSE)) warn("You need to quote \"%s\"", tmpbuf); - - --- 2021,2029 ---- if (*s == '{' && strEQ(tokenbuf, "$SIG") && (t = strchr(s,'}')) && (t = strchr(t,'='))) { ! char tmpbuf[sizeof tokenbuf]; STRLEN len; for (t++; isSPACE(*t); t++) ; if (isIDFIRST(*t)) { ! t = scan_word(t, tmpbuf, sizeof tmpbuf, TRUE, &len); if (*t != '(' && perl_get_cv(tmpbuf, FALSE)) warn("You need to quote \"%s\"", tmpbuf); *************** yylex() *** 2093,2097 **** case '@': ! s = scan_ident(s, bufend, tokenbuf+1, FALSE); if (expect == XOPERATOR) no_op("Array",s); - - --- 2098,2102 ---- case '@': ! s = scan_ident(s, bufend, tokenbuf + 1, sizeof tokenbuf - 1, FALSE); if (expect == XOPERATOR) no_op("Array",s); *************** yylex() *** 2129,2133 **** : !GvHV(gv) ))) { ! char tmpbuf[1024]; sprintf(tmpbuf, "Literal @%s now requires backslash",tokenbuf+1); yyerror(tmpbuf); - - --- 2134,2138 ---- : !GvHV(gv) ))) { ! char tmpbuf[sizeof tokenbuf + 40]; sprintf(tmpbuf, "Literal @%s now requires backslash",tokenbuf+1); yyerror(tmpbuf); *************** yylex() *** 2293,2297 **** keylookup: bufptr = s; ! s = scan_word(s, tokenbuf, FALSE, &len); if (*s == ':' && s[1] == ':' && strNE(tokenbuf, "CORE")) - - --- 2298,2302 ---- keylookup: bufptr = s; ! s = scan_word(s, tokenbuf, sizeof tokenbuf, FALSE, &len); if (*s == ':' && s[1] == ':' && strNE(tokenbuf, "CORE")) *************** yylex() *** 2338,2342 **** if (*s == '\'' || *s == ':' && s[1] == ':') { ! s = scan_word(s, tokenbuf + len, TRUE, &len); if (!len) croak("Bad name after %s::", tokenbuf); - - --- 2343,2348 ---- if (*s == '\'' || *s == ':' && s[1] == ':') { ! s = scan_word(s, tokenbuf + len, sizeof tokenbuf - len, ! TRUE, &len); if (!len) croak("Bad name after %s::", tokenbuf); *************** yylex() *** 2557,2561 **** s += 2; d = s; ! s = scan_word(s, tokenbuf, FALSE, &len); tmp = keyword(tokenbuf, len); if (tmp < 0) - - --- 2563,2567 ---- s += 2; d = s; ! s = scan_word(s, tokenbuf, sizeof tokenbuf, FALSE, &len); tmp = keyword(tokenbuf, len); if (tmp < 0) *************** yylex() *** 3244,3250 **** if (isIDFIRST(*s) || *s == '\'' || *s == ':') { ! char tmpbuf[128]; expect = XBLOCK; ! d = scan_word(s, tmpbuf, TRUE, &len); if (strchr(tmpbuf, ':')) sv_setpv(subname, tmpbuf); - - --- 3250,3256 ---- if (isIDFIRST(*s) || *s == '\'' || *s == ':') { ! char tmpbuf[sizeof tokenbuf]; expect = XBLOCK; ! d = scan_word(s, tmpbuf, sizeof tmpbuf, TRUE, &len); if (strchr(tmpbuf, ':')) sv_setpv(subname, tmpbuf); *************** char *what; *** 4091,4102 **** static char * ! scan_word(s, dest, allow_package, slp) register char *s; char *dest; int allow_package; STRLEN *slp; { register char *d = dest; for (;;) { if (isALNUM(*s)) *d++ = *s++; - - --- 4097,4112 ---- static char * ! scan_word(s, dest, destlen, allow_package, slp) register char *s; char *dest; + STRLEN destlen; int allow_package; STRLEN *slp; { register char *d = dest; + register char *e = d + destlen - 3; /* two-character token, ending NUL */ for (;;) { + if (d >= e) + croak(too_long); if (isALNUM(*s)) *d++ = *s++; *************** STRLEN *slp; *** 4119,4129 **** static char * ! scan_ident(s,send,dest,ck_uni) register char *s; register char *send; char *dest; I32 ck_uni; { register char *d; char *bracket = 0; char funny = *s++; - - --- 4129,4141 ---- static char * ! scan_ident(s, send, dest, destlen, ck_uni) register char *s; register char *send; char *dest; + STRLEN destlen; I32 ck_uni; { register char *d; + register char *e; char *bracket = 0; char funny = *s++; *************** I32 ck_uni; *** 4134,4143 **** s = skipspace(s); d = dest; if (isDIGIT(*s)) { ! while (isDIGIT(*s)) *d++ = *s++; } else { for (;;) { if (isALNUM(*s)) *d++ = *s++; - - --- 4146,4161 ---- s = skipspace(s); d = dest; + e = d + destlen - 3; /* two-character token, ending NUL */ if (isDIGIT(*s)) { ! while (isDIGIT(*s)) { ! if (d >= e) ! croak(too_long); *d++ = *s++; + } } else { for (;;) { + if (d >= e) + croak(too_long); if (isALNUM(*s)) *d++ = *s++; - --------------------------------------------------------------------------- End of patch. - ------------------------------------------------------------------------------ [ End CERT Advisory ] [ Append Silicon Graphic Inc. Advisory ] -----BEGIN PGP SIGNED MESSAGE----- ______________________________________________________________________________ Silicon Graphics Inc. Security Advisory Title: Buffer Overflow Vulnerability in suidperl/sperl program Title: CERT CA-97.17 and AUSCERT AA-97.13 Number: 19980404-01-I Date: April 6, 1998 ______________________________________________________________________________ Silicon Graphics provides this information freely to the SGI user community for its consideration, interpretation, implementation and use. Silicon Graphics recommends that this information be acted upon as soon as possible. Silicon Graphics provides the information in this Security Advisory on an "AS-IS" basis only, and disclaims all warranties with respect thereto, express, implied or otherwise, including, without limitation, any warranty of merchantability or fitness for a particular purpose. In no event shall Silicon Graphics be liable for any loss of profits, loss of business, loss of data or for any indirect, special, exemplary, incidental or consequential damages of any kind arising from your use of, failure to use or improper use of any of the instructions or information in this Security Advisory. ______________________________________________________________________________ - ----------------------- - --- Issue Specifics --- - ----------------------- The suidperl or sperl program is an altered versions of PERL which allows PERL scripts to be run under the setuid of a particular user. Unfortunately, a buffer overrun has been discovered in the suidperl/sperl program which could allow arbitrary commands to be run as the privileged user root. Silicon Graphics Inc. has investigated the issue and recommends the following steps for neutralizing the exposure. It is HIGHLY RECOMMENDED that these measures be implemented on ALL vulnerable SGI systems. - -------------- - --- Impact --- - -------------- As a service to its customers, Silicon Graphics provides IRIX installable inst images of many popular "free" software packages and can be found on the SGI Freeware 1.0/2.0 CD or online at: http://www.sgi.com/TasteOfDT/public/freeware.html The suidperl/sperl program is freeware and is not installed by default. Versions 5.003 and lower of suidperl/sperl have this buffer overrun vulnerability. With a local account, the suidperl/sperl buffer overrun vulnerability can be exploited locally and remotely. The suidperl/sperl buffer overrun vulnerability can be utilized to execute commands with root privileges. The suidperl/sperl buffer overrun vulnerability has been publicly discussed in Usenet newsgroups and mailing lists and also reported in CERT Advisory CA-97.17 and AUSCERT Advisory AA-97.13. - -------------------------- - --- Temporary Solution --- - -------------------------- Although new releases of suidperl/sperl are available to fix this issue, it is realized that there may be situations where installing the new release immediately may not be possible. To determine if a system is vulnerable to this problem and to disable the programs that are believed to be vulnerable, use the following steps. 1) Become the root user on the system. % /bin/su - Password: # 2) Find suidperl or sperl programs and disable them. You will need to run the find(1) command on each system you maintain because the command examines files on local disks only. Note that this is one long command, though we have separated it onto five lines using backslashes. # find / -local -type f -user root \ \( -name 'sperl4.[0-9][0-9][0-9]' \ -o -name 'sperl5.00[0-3]' \ -o -name 'suidperl' \) \ -perm -04000 -print -ok chmod ug-s '{}' \; This command will find all files on a system that are - only in the file system you name (/ -local) - regular files (-type f) - owned by root (-user root) - named appropriately (-name 'sperl4.[0-9][0-9][0-9]' -o -name 'sperl5.00[0-3]' -o -name 'suidperl') - setuid root (-perm -04000) Once found, those files will - have their names printed (-print) - have their modes changed, but only if you type `y' in response to the prompt (-ok chmod ug-s '{}' \;) After you have run this command on all your systems, they will no longer be vulnerable. Note that after disabling the suidperl and sperl programs, they will no longer be able to emulate the set-user-ID and set-group-ID features of the kernel. 3) Return to previous level. # exit $ - ---------------- - --- Solution --- - ---------------- No Silicon Graphic's patches are available for freeware software. As freeware software, all reasonable efforts will be made to address the issue in future releases of the Silicon Graphic's Freeware. Unsupported patches are publicly available from http://www.perl.com/ - ------------------------ - --- Acknowledgments --- - ------------------------ Silicon Graphics wishes to thank the Internet Community, CERT Coordination Center, and AUSCERT for their assistance in this matter. - ----------------------------------------------------------- - --- Silicon Graphics Inc. Security Information/Contacts --- - ----------------------------------------------------------- If there are questions about this document, email can be sent to cse-security-alert@sgi.com. ------oOo------ Silicon Graphics provides security information and patches for use by the entire SGI community. This information is freely available to any person needing the information and is available via anonymous FTP and the Web. The primary SGI anonymous FTP site for security information and patches is sgigate.sgi.com (204.94.209.1). Security information and patches are located under the directories ~ftp/security and ~ftp/patches, respectively. The Silicon Graphics Security Headquarters Web page is accessible at the URL http://www.sgi.com/Support/security/security.html. For issues with the patches on the FTP sites, email can be sent to cse-security-alert@sgi.com. For assistance obtaining or working with security patches, please contact your SGI support provider. ------oOo------ Silicon Graphics provides a free security mailing list service called wiretap and encourages interested parties to self-subscribe to receive (via email) all SGI Security Advisories when they are released. Subscribing to the mailing list can be done via the Web (http://www.sgi.com/Support/security/wiretap.html) or by sending email to SGI as outlined below. % mail wiretap-request@sgi.com subscribe wiretap end ^d In the example above, is the email address that you wish the mailing list information sent to. The word end must be on a separate line to indicate the end of the body of the message. The control-d (^d) is used to indicate to the mail program that you are finished composing the mail message. ------oOo------ Silicon Graphics provides a comprehensive customer World Wide Web site. This site is located at http://www.sgi.com/Support/security/security.html. ------oOo------ For reporting *NEW* SGI security issues, email can be sent to security-alert@sgi.com or contact your SGI support provider. A support contract is not required for submitting a security report. ______________________________________________________________________________ This information is provided freely to all interested parties and may be redistributed provided that it is not altered in any way, Silicon Graphics is appropriately credited and the document retains and includes its valid PGP signature. -----BEGIN PGP SIGNATURE----- Version: 2.6.2 iQCVAwUBNSlKpLQ4cFApAP75AQFX/gP+JJi7lzq3za0b0Xfb39KiwRAh6EBH7IG/ +YJxB6/Crt+cb9ez4P1IujrVmJ5TFZhxDfTJEG9eyhxNj4Lgz/XZTFmTfZmVMZyL BVKJl9IQNyjoEAajUjqARJqctjAWDbZ6PT/kb478SPEa4KXn4OzcqldW8E0KgjCN eiDvpZovM0A= =NTlB -----END PGP SIGNATURE----- [ End Silicon Graphic Inc. Advisory ] ______________________________________________________________________________ CIAC wishes to acknowledge the contributions of CERT, Chip Salzenberg, Larry Wall, and Warner Losh for the information contained in this bulletin. ______________________________________________________________________________ CIAC, the Computer Incident Advisory Capability, is the computer security incident response team for the U.S. Department of Energy (DOE) and the emergency backup response team for the National Institutes of Health (NIH). CIAC is located at the Lawrence Livermore National Laboratory in Livermore, California. CIAC is also a founding member of FIRST, the Forum of Incident Response and Security Teams, a global organization established to foster cooperation and coordination among computer security teams worldwide. CIAC services are available to DOE, DOE contractors, and the NIH. CIAC can be contacted at: Voice: +1 510-422-8193 FAX: +1 510-423-8002 STU-III: +1 510-423-2604 E-mail: ciac@llnl.gov For emergencies and off-hour assistance, DOE, DOE contractor sites, and the NIH may contact CIAC 24-hours a day. During off hours (5PM - 8AM PST), call the CIAC voice number 510-422-8193 and leave a message, or call 800-759-7243 (800-SKY-PAGE) to send a Sky Page. CIAC has two Sky Page PIN numbers, the primary PIN number, 8550070, is for the CIAC duty person, and the secondary PIN number, 8550074 is for the CIAC Project Leader. Previous CIAC notices, anti-virus software, and other information are available from the CIAC Computer Security Archive. World Wide Web: http://ciac.llnl.gov/ Anonymous FTP: ciac.llnl.gov (198.128.39.53) Modem access: +1 (510) 423-4753 (28.8K baud) +1 (510) 423-3331 (28.8K baud) CIAC has several self-subscribing mailing lists for electronic publications: 1. CIAC-BULLETIN for Advisories, highest priority - time critical information and Bulletins, important computer security information; 2. CIAC-NOTES for Notes, a collection of computer security articles; 3. SPI-ANNOUNCE for official news about Security Profile Inspector (SPI) software updates, new features, distribution and availability; 4. SPI-NOTES, for discussion of problems and solutions regarding the use of SPI products. Our mailing lists are managed by a public domain software package called Majordomo, which ignores E-mail header subject lines. To subscribe (add yourself) to one of our mailing lists, send the following request as the E-mail message body, substituting ciac-bulletin, ciac-notes, spi-announce OR spi-notes for list-name: E-mail to ciac-listproc@llnl.gov or majordomo@tholia.llnl.gov: subscribe list-name e.g., subscribe ciac-notes You will receive an acknowledgment email immediately with a confirmation that you will need to mail back to the addresses above, as per the instructions in the email. This is a partial protection to make sure you are really the one who asked to be signed up for the list in question. If you include the word 'help' in the body of an email to the above address, it will also send back an information file on how to subscribe/unsubscribe, get past issues of CIAC bulletins via email, etc. PLEASE NOTE: Many users outside of the DOE, ESnet, and NIH computing communities receive CIAC bulletins. If you are not part of these communities, please contact your agency's response team to report incidents. Your agency's team will coordinate with CIAC. The Forum of Incident Response and Security Teams (FIRST) is a world-wide organization. A list of FIRST member organizations and their constituencies can be obtained via WWW at http://www.first.org/. This document was prepared as an account of work sponsored by an agency of the United States Government. Neither the United States Government nor the University of California nor any of their employees, makes any warranty, express or implied, or assumes any legal liability or responsibility for the accuracy, completeness, or usefulness of any information, apparatus, product, or process disclosed, or represents that its use would not infringe privately owned rights. Reference herein to any specific commercial products, process, or service by trade name, trademark, manufacturer, or otherwise, does not necessarily constitute or imply its endorsement, recommendation or favoring by the United States Government or the University of California. The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or the University of California, and shall not be used for advertising or product endorsement purposes. LAST 10 CIAC BULLETINS ISSUED (Previous bulletins available from CIAC) H-56: Solaris 2.x lp temporary files creation Vulnerability H-57: Windows NT/95 Out of Band Data Exploit H-58: IRIX runpriv Program Vulnerability H-59: Solaris 2.x ps Buffer Overflow Vulnerability H-60: Vulnerability in metamail H-61: SGI IRIX df, pset, and eject Buffer Overrun Vulnerabilities H-62: SGI IRIX ordist, login/scheme Buffer Overrun Vulnerability H-63: ftpd Signal Handling Vulnerability H-64: SGI IRIX login LOCKOUT parameter Vulnerability H-65: SGI IRIX rld Security Vulnerability