-----BEGIN PGP SIGNED MESSAGE----- __________________________________________________________ The U.S. Department of Energy Computer Incident Advisory Capability ___ __ __ _ ___ / | /_\ / \___ __|__ / \ \___ __________________________________________________________ INFORMATION BULLETIN Vulnerability in rlogin/term February 6, 1997 23:00 GMT Number H-25 ______________________________________________________________________________ PROBLEM: A vulnerability in many implementations of the rlogin program, including eklogin and klogin. PLATFORM: Systems using any of the listed vendors maybe vulnerable. Berkeley Software Design, Inc. (BSDI) Cray Research - A Silicon Graphics Company Digital Equipment Corporation FreeBSD, Inc. Hewlett-Packard Corporation IBM Corporation Linux Systems NEC Corporation NeXT Software, Inc. The Open Group The Santa Cruz Operation (SCO) DAMAGE: Local users may gain root privileges. SOLUTION: Install vendor patches for this problem as listed in (Sec. III.A). Until you can do so, turn off rlogin or replace it with a wrapper (see Sec. III.B.2). ______________________________________________________________________________ VULNERABILITY Exploit details involving this vulnerability have been made ASSESSMENT: publicly available. ______________________________________________________________________________ [ Start CERT Advisory ] ============================================================================= CERT(sm) Advisory CA-97.06 Original issue date: February 6, 1997 Last revised: -- Topic: Vulnerability in rlogin/term - ------------------------------------------------------------------------------ The CERT Coordination Center has received reports of a vulnerability in many implementations of the rlogin program, including eklogin and klogin. By exploiting this vulnerability, users with access to an account on the system can cause a buffer overflow and execute arbitrary programs as root. The CERT/CC staff recommends installing a vendor patch for this problem (Sec. III.A). Until you can do so, we urge you to turn off rlogin or replace it with a wrapper (see Sec. III.B.2). We will update this advisory as we receive additional information. Please check advisory files regularly for updates that relate to your site. - ------------------------------------------------------------------------------ I. Description The rlogin program provided by many UNIX systems, as well as some non-UNIX systems, is described in RFC 1282. Here is an excerpt from that RFC that describes its elemental functionality: "The rlogin facility provides a remote-echoed, locally flow- controlled virtual terminal with proper flushing of output. It is widely used between Unix hosts because it provides transport of more of the Unix terminal environment semantics than does the Telnet protocol, and because on many Unix hosts it can be configured not to require user entry of passwords when connections originate from trusted hosts." The key point from this description is that the rlogin program passes the terminal type description from the local host to the remote host. This functionality allows terminal-aware programs such as full-screen text editors to operate properly across a computer-to-computer connection created with rlogin. To do this, the rlogin program uses the current terminal definition as identified by the TERM environment variable. The protocol described in RFC 1282 explains how this terminal information is transferred from the local machine where the rlogin client program is running to the remote machine where service is sought. Unfortunately, many implementations of the rlogin program contain a defect whereby the value of the TERM environment variable is copied to an internal buffer without due care. The buffer holding the copied value of TERM can be overflowed. In some implementations, the buffer is a local variable, meaning that the subroutine call stack can be overwritten and arbitrary code executed. The executed code is under the control of the user running the rlogin program. In addition, the rlogin program is set-user-id root. rlogin requires these increased privileges so it can allocate a port in the required range, as described in the in.rlogind (or rlogind) manual page: "The server checks the client's source port. If the port is not in the range 0-1023, the server aborts the connection." In summary, rlogin is a set-user-id root program that in many implementations contains a programming defect whereby an internal buffer can be overflowed and arbitrary code can be executed as root. II. Impact Users can become root if they have access to an account on the system. III. Solution Install a patch from your vendor if one is available (Section A). Until you can take one of those actions, we recommend applying the workaround described in Section B. A. Obtain and install a patch for this problem. Below is a list of vendors who have provided information about rlogin. Details are in Appendix A of this advisory; we will update the appendix as we receive more information. If your vendor's name is not on this list, the CERT/CC did not hear from that vendor. Please contact your vendor directly. Berkeley Software Design, Inc. (BSDI) Cray Research - A Silicon Graphics Company Digital Equipment Corporation FreeBSD, Inc. Hewlett-Packard Corporation IBM Corporation Linux Systems NEC Corporation NeXT Software, Inc. The Open Group The Santa Cruz Operation (SCO) B. Until you are able to install the appropriate patch, we recommend one of the following workarounds: 1. Turn off rlogin. If your user community does not use rlogin, turn it off. As root, do the following: % chmod 0 /usr/bin/rlogin You may find the rlogin program in some other directory on your system. Example directories are: /bin, /usr/bin, /usr/ucb. Note: On some systems, rlogin is provided in different forms that do additional work. Examples are eklogin (kerberos authentication plus encryption of the data stream) and klogin (kerberos authentication only). These, too, need to be turned off. 2. Replace the rlogin program with a wrapper. We have written a prototype wrapper that is available at URL ftp://info.cert.org/pub/tools/rlogin_wrapper/rlogin_wrapper.c The PGP signature for this file is available at URL ftp://info.cert.org/pub/tools/rlogin_wrapper/rlogin_wrapper.c.asc To verify that this file is correct, fetch both the rlogin_wrapper.c and rlogin_wrapper.c.asc files and check the signature with pgp as in % pgp rlogin_wrapper.c.asc rlogin_wrapper.c Notes: * You may have to change this program to get it to compile and work correctly on your system. * If you have different forms of rlogin, as noted in the previous section, then you will need to replace those forms with the wrapper as well. - -------------------------------------------------------------------------------- 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) ==================================== Unpatched BSD/OS 2.1 systems are vulnerable to this problem. A patch was issued that resolved this problem in August 1996. The patch is available from the mail server or via anonymous ftp at: ftp://ftp.bsdi.com/bsdi/patches/patches-2.1/U210-021 Cray Research - A Silicon Graphics Company ========================================== This problem has been corrected in all currently supported versions of Unicos. Digital Equipment Corporation ============================= At the time of writing this document, patches(binary kits) are available from your normal Digital Support Channel. rlogin patches are available for: DIGITAL UNIX V3.2c, V3.2de1/de2, V3.2g, V3.2g, V4.0, V4.0a, V4.0b. DIGITAL ULTRIX V4.4 VAX & MIPS, V4.5 VAX and MIPS DIGITAL EQUIPMENT CORPORATION ----------------------------- FreeBSD, Inc. ============= This vulnerability is present in FreeBSD 2.1.5 and previous versions. It was fixed in all FreeBSD source and binary distributions dated after 1996/07/25. The following source code patch may be applied to FreeBSD 2.1.5 based distributions, and should work in previous distributions. Users unable to apply this patch and recompile the rlogin binary are encouraged to use the wrapper provided by CERT. Index: rlogin.c =================================================================== RCS file: /home/ncvs/src/usr.bin/rlogin/rlogin.c,v retrieving revision 1.5.4.1 retrieving revision 1.5.4.2 diff -c -r1.5.4.1 -r1.5.4.2 *** rlogin.c 1996/06/23 13:08:27 1.5.4.1 - - --- rlogin.c 1996/07/25 18:29:35 1.5.4.2 *************** *** 102,107 **** - - --- 102,108 ---- char *speeds[] = { "0", "50", "75", "110", "134", "150", "200", "300", "600", "1200", "1800", "2400", "4800", "9600", "19200", "38400", "57600", "115200" + #define MAX_SPEED_LENGTH (sizeof("115200") - 1) }; #ifdef OLDSUN *************** *** 259,265 **** exit(1); } ! (void)strcpy(term, (p = getenv("TERM")) ? p : "network"); if (ioctl(0, TIOCGETP, &ttyb) == 0) { (void)strcat(term, "/"); (void)strcat(term, speeds[(int)ttyb.sg_ospeed]); - - --- 260,270 ---- exit(1); } ! #define MAX_TERM_LENGTH (sizeof(term) - 1 - MAX_SPEED_LENGTH - 1) ! ! (void)strncpy(term, (p = getenv("TERM")) ? p : "network", ! MAX_TERM_LENGTH); ! term[MAX_TERM_LENGTH] = '\0'; if (ioctl(0, TIOCGETP, &ttyb) == 0) { (void)strcat(term, "/"); (void)strcat(term, speeds[(int)ttyb.sg_ospeed]); Hewlett-Packard Corporation =========================== This rlogin problem is fixed: PHNE_8807 10.20 s700/800 PHNE_8806 10.10, 10.0X s700/800 PHNE_8805 9.X s700/800 See Hewlett-Packard Security Bulletin HPSBUX9702-052, dated February 5, 1997. IBM Corporation =============== See the appropriate release below to determine your action. AIX 3.2 ------- Apply the following fix to your system: APAR - IX57724 (PTF - U442613) To determine if you have this PTF on your system, run the following command: lslpp -lB U442613 AIX 4.1 ------- Apply the following fix to your system: APAR - IX57972 To determine if you have this APAR on your system, run the following command: instfix -ik IX57972 Or run the following command: lslpp -h bos.net.tcp.client Your version of bos.net.tcp.client should be 4.1.4.13 or later. AIX 4.2 ------- No APAR required. Fix already contained in the release. To Order -------- APARs may be ordered using Electronic Fix Distribution (via FixDist) or from the IBM Support Center. For more information on FixDist, reference URL: http://service.software.ibm.com/aixsupport/ or send e-mail to aixserv@austin.ibm.com with a subject of "FixDist". IBM and AIX are registered trademarks of International Business Machines Corporation. Linux Systems ============= Only very out of date Linux systems are vulnerable. Linux Netkit 0.08 has rlogin fixed. All Linux systems using older NetKits should upgrade to NetKit 0.09. Some vendors have shipped patched Netkit-0.08 releases. Check with your vendor for confirmation. NetKit 0.09 is available from: ftp://ftp.uk.linux.org/pub/linux/Networking/base/NetKit-0.09.tar.gz NEC Corporation =============== UX/4800 Not vulnerable for all versions. EWS-UX/V(Rel4.2MP) Not vulnerable for all versions. EWS-UX/V(Rel4.2) Not vulnerable for all versions. UP-UX/V(Rel4.2MP) Not vulnerable for all versions. NeXT Software, Inc. =================== This problem is fixed in OpenStep/Mach release 4.1 and later. The Open Group ============== This problem was fixed in OSF's OSF/1 R1.3.3 maintenance release. The Santa Cruz Operation (SCO) ============================== SCO is investigating this problem and should a patch be necessary, SCO will provide updated information for this advisory. Patches for SCO products are listed at ftp://ftp.sco.COM/SLS/README. - ------------------------------------------------------------------------------ [ End CERT Advisory ] _______________________________________________________________________________ CIAC wishes to acknowledge the contributions of CERT, AUSCERT and DFN-CERT 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 (128.115.19.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 ListProcessor, 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 and valid information for LastName FirstName and PhoneNumber when sending E-mail to ciac-listproc@llnl.gov: subscribe list-name LastName, FirstName PhoneNumber e.g., subscribe ciac-notes OHara, Scarlett W. 404-555-1212 x36 You will receive an acknowledgment containing address, initial PIN, and information on how to change either of them, cancel your subscription, or get help. 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-16: HP-UX Security Vulnerabilities (chfn, Remote Watch) H-06a: Sun libc/libnsl vulnerabilities (Sun Bulletin #00137a) H-17: cron/crontab Buffer Overrun Vulnerabilities H-18: Denial-of-Service Attack via ping H-19: HP Software Installation Programs Vulnerability H-20: Vulnerability in IRIX csetup H-21: HP Security Vulnerabilities (newgrp, authentication, passwor H-22: talkd Buffer Overrun Vulnerability H-23: Sendmail MIME Conversion Buffer Overrun Vulnerability H-24: IBM AIX(r) "gethostbyname()" Buffer Overrun Vulnerability RECENT CIAC NOTES ISSUED (Previous Notes available from CIAC) Notes 07 - 3/29/95 A comprehensive review of SATAN Notes 08 - 4/4/95 A Courtney update Notes 09 - 4/24/95 More on the "Good Times" virus urban legend Notes 10 - 6/16/95 PKZ300B Trojan, Logdaemon/FreeBSD, vulnerability in S/Key, EBOLA Virus Hoax, and Caibua Virus Notes 11 - 7/31/95 Virus Update, Hats Off to Administrators, America On-Line Virus Scare, SPI 3.2.2 Released, The Die_Hard Virus Notes 12 - 9/12/95 Securely configuring Public Telnet Services, X Windows, beta release of Merlin, Microsoft Word Macro Viruses, Allegations of Inappropriate Data Collection in Win95 Notes 96-01 - 3/18/96 Java and JavaScript Vulnerabilities, FIRST Conference Announcement, Security and Web Search Engines, Microsoft Word Macro Virus Update -----BEGIN PGP SIGNATURE----- Version: 2.6.2 iQCVAwUBMxtcornzJzdsy3QZAQFSOQQA8Esh5vY0fR/B7UW7Y+qSCCTYKogqZaqM x3G2psEAwZGgej01y1+OM3gw/W6m0pWk9gf8YXTMY4XUCdmFf2yr1SU0bRx8VfxU CRyyzLj5zLkVERj3QNW4kPvT9GRcjm52jf+cSW9mEqQ5PZtg1qNuB495ATr+UNVv ng2umGiteTU= =jn8f -----END PGP SIGNATURE-----