home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / hacking / general / cert0138.txt < prev    next >
Encoding:
Text File  |  2003-06-11  |  15.9 KB  |  445 lines

  1.  
  2. -----BEGIN PGP SIGNED MESSAGE-----
  3.  
  4. =============================================================================
  5. CERT(sm) Advisory CA-97.06
  6. Original issue date: February 6, 1997
  7. Last revised: February 11, 1997
  8.               Appendix A - added entries for Cygnus Solutions, NetBSD, and Sun
  9.  
  10. Topic: Vulnerability in rlogin/term
  11. - -----------------------------------------------------------------------------
  12.  
  13. The CERT Coordination Center has received reports of a vulnerability in many
  14. implementations of the rlogin program, including eklogin and klogin. By
  15. exploiting this vulnerability, users with access to an account on the system
  16. can cause a buffer overflow and execute arbitrary programs as root.
  17.  
  18. The CERT/CC staff recommends installing a vendor patch for this problem
  19. (Sec. III.A). Until you can do so, we urge you to turn off rlogin or replace
  20. it with a wrapper (see Sec. III.B.2).
  21.  
  22. We will update this advisory as we receive additional information.
  23. Please check advisory files regularly for updates that relate to your site.
  24.  
  25. - -----------------------------------------------------------------------------
  26.  
  27. I.   Description
  28.  
  29.      The rlogin program provided by many UNIX systems, as well as some non-UNIX
  30.      systems, is described in RFC 1282. Here is an excerpt from that RFC that
  31.      describes its elemental functionality:
  32.  
  33.         "The rlogin facility provides a remote-echoed, locally flow-
  34.          controlled virtual terminal with proper flushing of output.
  35.          It is widely used between Unix hosts because it provides
  36.          transport of more of the Unix terminal environment semantics
  37.          than does the Telnet protocol, and because on many Unix hosts
  38.          it can be configured not to require user entry of passwords
  39.          when connections originate from trusted hosts."
  40.  
  41.      The key point from this description is that the rlogin program passes
  42.      the terminal type description from the local host to the remote host.
  43.      This functionality allows terminal-aware programs such as full-screen
  44.      text editors to operate properly across a computer-to-computer
  45.      connection created with rlogin.
  46.  
  47.      To do this, the rlogin program uses the current terminal definition as
  48.      identified by the TERM environment variable. The protocol described in
  49.      RFC 1282 explains how this terminal information is transferred from the
  50.      local machine where the rlogin client program is running to the remote
  51.      machine where service is sought.
  52.  
  53.      Unfortunately, many implementations of the rlogin program contain a
  54.      defect whereby the value of the TERM environment variable is copied to
  55.      an internal buffer without due care. The buffer holding the copied value
  56.      of TERM can be overflowed. In some implementations, the buffer is a local
  57.      variable, meaning that the subroutine call stack can be overwritten and
  58.      arbitrary code executed. The executed code is under the control of the
  59.      user running the rlogin program.
  60.  
  61.      In addition, the rlogin program is set-user-id root. rlogin requires
  62.      these increased privileges so it can allocate a port in the required
  63.      range, as described in the in.rlogind (or rlogind) manual page:
  64.  
  65.          "The server checks the client's source port. If the port is not
  66.           in the range 0-1023, the server aborts the connection."
  67.  
  68.      In summary, rlogin is a set-user-id root program that in many
  69.      implementations contains a programming defect whereby an internal buffer
  70.      can be overflowed and arbitrary code can be executed as root.
  71.  
  72. II.  Impact
  73.  
  74.      Users can become root if they have access to an account on the system.
  75.  
  76. III. Solution
  77.  
  78.      Install a patch from your vendor if one is available (Section A).
  79.      Until you can take one of those actions, we recommend applying the
  80.      workaround described in Section B.
  81.  
  82.      A.  Obtain and install a patch for this problem.
  83.  
  84.          Below is a list of vendors who have provided information about
  85.          rlogin. Details are in Appendix A of this advisory; we will update
  86.          the appendix as we receive more information. If your vendor's name is
  87.          not on this list, the CERT/CC did not hear from that vendor. Please
  88.          contact your vendor directly.
  89.  
  90.               Berkeley Software Design, Inc. (BSDI)
  91.               Cray Research - A Silicon Graphics Company
  92.               Cygnus Solutions (formerly Cygnus Support)
  93.               Digital Equipment Corporation
  94.               FreeBSD, Inc.
  95.               Hewlett-Packard Corporation
  96.               IBM Corporation
  97.               Linux Systems
  98.               NEC Corporation
  99.               NetBSD
  100.               NeXT Software, Inc.
  101.               The Open Group
  102.               The Santa Cruz Operation (SCO)
  103.               Sun Microsystems, Inc.
  104.  
  105.      B.  Until you are able to install the appropriate patch, we recommend
  106.          one of the following workarounds:
  107.  
  108.          1. Turn off rlogin.
  109.             If your user community does not use rlogin, turn it off.
  110.             As root, do the following:
  111.  
  112.                 % chmod 0 /usr/bin/rlogin
  113.  
  114.             You may find the rlogin program in some other directory on
  115.             your system. Example directories are: /bin, /usr/bin, /usr/ucb.
  116.  
  117.             Note: On some systems, rlogin is provided in different forms
  118.             that do additional work. Examples are eklogin (kerberos
  119.             authentication plus encryption of the data stream) and klogin
  120.             (kerberos authentication only). These, too, need to be turned
  121.             off.
  122.  
  123.          2. Replace the rlogin program with a wrapper.
  124.             We have written a prototype wrapper that is available at
  125.  
  126.           URL ftp://info.cert.org/pub/tools/rlogin_wrapper/rlogin_wrapper.c
  127.  
  128.             The PGP signature for this file is available at
  129.  
  130.           URL ftp://info.cert.org/pub/tools/rlogin_wrapper/rlogin_wrapper.c.asc
  131.  
  132.             To verify that this file is correct, fetch both the
  133.             rlogin_wrapper.c and rlogin_wrapper.c.asc files and check the
  134.             signature with pgp as in
  135.  
  136.                % pgp rlogin_wrapper.c.asc rlogin_wrapper.c
  137.  
  138.             Notes:
  139.                * You may have to change this program to get it to compile and
  140.                   work correctly on your system.
  141.  
  142.                * If you have different forms of rlogin, as noted in the
  143.                   previous section, then you will need to replace those forms
  144.                   with the wrapper as well.
  145.  
  146. ...........................................................................
  147.  
  148. Appendix A - Vendor Information
  149.  
  150. Below is a list of the vendors who have provided information for this
  151. advisory. We will update this appendix as we receive additional information.
  152. If you do not see your vendor's name, the CERT/CC did not hear from that
  153. vendor. Please contact the vendor directly.
  154.  
  155.  
  156. Berkeley Software Design, Inc. (BSDI)
  157. ====================================
  158.         Unpatched BSD/OS 2.1 systems are vulnerable to this problem.  A patch
  159.         was issued that resolved this problem in August 1996.  The patch is
  160.         available from the <patches@BSDI.COM> mail server or via anonymous ftp
  161.         at:
  162.  
  163.              ftp://ftp.bsdi.com/bsdi/patches/patches-2.1/U210-021
  164.  
  165.  
  166. Cray Research - A Silicon Graphics Company
  167. ==========================================
  168.         This problem has been corrected in all currently supported versions
  169.         of Unicos.
  170.  
  171.  
  172. Cygnus Solutions (formerly Cygnus Support)
  173. ==========================================
  174.        CNS (our product based on Kerberos V4) all releases are not
  175.        vulnerable.
  176.  
  177.        KerbNet Security System (our product based on Kerberos V5) all
  178.        releases are not vulnerable.
  179.  
  180.   Since our version of rlogin is not installed set-user-id root, it is
  181.   not vulnerable.  To secure a machine which is running our rlogin, all
  182.   that is necessary is to secure the vendor rlogin.
  183.  
  184.  
  185. Digital Equipment Corporation
  186. =============================
  187.         At the time of writing this document, patches(binary kits) are
  188.         available from your normal Digital Support Channel.
  189.  
  190.         rlogin patches are available for:
  191.             DIGITAL UNIX V3.2c, V3.2de1/de2, V3.2g, V3.2g, V4.0, V4.0a, V4.0b.
  192.             DIGITAL ULTRIX V4.4 VAX & MIPS, V4.5 VAX and MIPS
  193.  
  194.                                 DIGITAL EQUIPMENT CORPORATION
  195.                                 -----------------------------
  196.  
  197. FreeBSD, Inc.
  198. =============
  199.         This vulnerability is present in FreeBSD 2.1.5 and previous
  200.         versions.  It was fixed in all FreeBSD source and
  201.         binary distributions dated after 1996/07/25.
  202.  
  203.         The following source code patch may be applied to FreeBSD
  204.         2.1.5 based distributions, and should work in previous
  205.         distributions.  Users unable to apply this patch and
  206.         recompile the rlogin binary are encouraged to use the
  207.         wrapper provided by CERT.
  208.  
  209.  
  210. Index: rlogin.c
  211. ===================================================================
  212. RCS file: /home/ncvs/src/usr.bin/rlogin/rlogin.c,v
  213. retrieving revision 1.5.4.1
  214. retrieving revision 1.5.4.2
  215. diff -c -r1.5.4.1 -r1.5.4.2
  216. *** rlogin.c    1996/06/23 13:08:27    1.5.4.1
  217. - --- rlogin.c    1996/07/25 18:29:35    1.5.4.2
  218. ***************
  219. *** 102,107 ****
  220. - --- 102,108 ----
  221.   char *speeds[] = {
  222.       "0", "50", "75", "110", "134", "150", "200", "300", "600", "1200",
  223.       "1800", "2400", "4800", "9600", "19200", "38400", "57600", "115200"
  224. + #define    MAX_SPEED_LENGTH    (sizeof("115200") - 1)
  225.   };
  226.  
  227.   #ifdef OLDSUN
  228. ***************
  229. *** 259,265 ****
  230.           exit(1);
  231.       }
  232.  
  233. !     (void)strcpy(term, (p = getenv("TERM")) ? p : "network");
  234.       if (ioctl(0, TIOCGETP, &ttyb) == 0) {
  235.           (void)strcat(term, "/");
  236.           (void)strcat(term, speeds[(int)ttyb.sg_ospeed]);
  237. - --- 260,270 ----
  238.           exit(1);
  239.       }
  240.  
  241. ! #define    MAX_TERM_LENGTH    (sizeof(term) - 1 - MAX_SPEED_LENGTH - 1)
  242. !
  243. !     (void)strncpy(term, (p = getenv("TERM")) ? p : "network",
  244. !               MAX_TERM_LENGTH);
  245. !     term[MAX_TERM_LENGTH] = '\0';
  246.       if (ioctl(0, TIOCGETP, &ttyb) == 0) {
  247.           (void)strcat(term, "/");
  248.           (void)strcat(term, speeds[(int)ttyb.sg_ospeed]);
  249.  
  250.  
  251. Hewlett-Packard Corporation
  252. ===========================
  253.         This rlogin problem is fixed:
  254.  
  255.         PHNE_8807 10.20        s700/800
  256.         PHNE_8806 10.10, 10.0X s700/800
  257.         PHNE_8805 9.X          s700/800
  258.  
  259.         See Hewlett-Packard Security Bulletin HPSBUX9702-052, dated
  260.         February 5, 1997.
  261.  
  262.  
  263. IBM Corporation
  264. ===============
  265.   See the appropriate release below to determine your action.
  266.  
  267.  
  268.   AIX 3.2
  269.   -------
  270.     Apply the following fix to your system:
  271.  
  272.        APAR - IX57724 (PTF - U442613)
  273.  
  274.     To determine if you have this PTF on your system, run the following
  275.     command:
  276.  
  277.        lslpp -lB U442613
  278.  
  279.  
  280.   AIX 4.1
  281.   -------
  282.     Apply the following fix to your system:
  283.  
  284.         APAR - IX57972
  285.  
  286.     To determine if you have this APAR on your system, run the following
  287.     command:
  288.  
  289.        instfix -ik IX57972
  290.  
  291.     Or run the following command:
  292.  
  293.        lslpp -h bos.net.tcp.client
  294.  
  295.     Your version of bos.net.tcp.client should be 4.1.4.13 or later.
  296.  
  297.  
  298.   AIX 4.2
  299.   -------
  300.     No APAR required.  Fix already contained in the release.
  301.  
  302.  
  303.   To Order
  304.   --------
  305.     APARs may be ordered using Electronic Fix Distribution (via FixDist)
  306.     or from the IBM Support Center.  For more information on FixDist,
  307.     reference URL:
  308.  
  309.        http://service.software.ibm.com/aixsupport/
  310.  
  311.     or send e-mail to aixserv@austin.ibm.com with a subject of "FixDist".
  312.  
  313.  
  314.   IBM and AIX are registered trademarks of International Business Machines
  315.   Corporation.
  316.  
  317.  
  318. Linux Systems
  319. =============
  320.         Only very out of date Linux systems are vulnerable.
  321.  
  322.         Linux Netkit 0.08 has rlogin fixed. All Linux systems using older
  323.         NetKits should upgrade to NetKit 0.09. Some vendors have shipped
  324.         patched Netkit-0.08 releases. Check with your vendor for
  325.         confirmation.
  326.  
  327.         NetKit 0.09 is available from:
  328.  
  329.         ftp://ftp.uk.linux.org/pub/linux/Networking/base/NetKit-0.09.tar.gz
  330.  
  331.  
  332. NEC Corporation
  333. ===============
  334.         UX/4800             Not vulnerable for all versions.
  335.         EWS-UX/V(Rel4.2MP)  Not vulnerable for all versions.
  336.         EWS-UX/V(Rel4.2)    Not vulnerable for all versions.
  337.         UP-UX/V(Rel4.2MP)   Not vulnerable for all versions.
  338.  
  339.  
  340. NetBSD
  341. ======
  342.    This was fixed in NetBSD some time ago, and is part of the 1.2 release.
  343.  
  344.    NetBSD 1.1 and prior are vulnerable to this, and the best solution is to
  345.    upgrade, or at least obtain new src/usr.bin/rlogin source and recompile.
  346.  
  347.  
  348. NeXT Software, Inc.
  349. ===================
  350.    This problem is fixed in OpenStep/Mach release 4.1 and later.
  351.  
  352.  
  353. The Open Group
  354. ==============
  355.     This problem was fixed in OSF's OSF/1 R1.3.3 maintenance release.
  356.  
  357.  
  358. The Santa Cruz Operation (SCO)
  359. ==============================
  360.      SCO is investigating this problem and should a patch be necessary, SCO
  361.      will provide updated information for this advisory. Patches for SCO
  362.      products are listed at ftp://ftp.sco.COM/SLS/README.
  363.  
  364. Sun Microsystems, Inc.
  365. ======================
  366.      No SunOS systems are vulnerable to this attack.
  367.  
  368. - -----------------------------------------------------------------------------
  369. The CERT Coordination Center staff thanks AUSCERT and DFN-CERT for their
  370. contributions to the development of this advisory.
  371. - -----------------------------------------------------------------------------
  372.  
  373. If you believe that your system has been compromised, contact the CERT
  374. Coordination Center or your representative in the Forum of Incident Response
  375. and Security Teams (see ftp://info.cert.org/pub/FIRST/first-contacts).
  376.  
  377.  
  378. CERT/CC Contact Information
  379. - ----------------------------
  380. Email    cert@cert.org
  381.  
  382. Phone    +1 412-268-7090 (24-hour hotline)
  383.                 CERT personnel answer 8:30-5:00 p.m. EST(GMT-5) / EDT(GMT-4)
  384.                 and are on call for emergencies during other hours.
  385.  
  386. Fax      +1 412-268-6989
  387.  
  388. Postal address
  389.          CERT Coordination Center
  390.          Software Engineering Institute
  391.          Carnegie Mellon University
  392.          Pittsburgh PA 15213-3890
  393.          USA
  394.  
  395. Using encryption
  396.    We strongly urge you to encrypt sensitive information sent by email. We can
  397.    support a shared DES key or PGP. Contact the CERT/CC for more information.
  398.    Location of CERT PGP key
  399.          ftp://info.cert.org/pub/CERT_PGP.key
  400.  
  401. Getting security information
  402.    CERT publications and other security information are available from
  403.         http://www.cert.org/
  404.         ftp://info.cert.org/pub/
  405.  
  406.    CERT advisories and bulletins are also posted on the USENET newsgroup
  407.         comp.security.announce
  408.  
  409.    To be added to our mailing list for advisories and bulletins, send your
  410.    email address to
  411.         cert-advisory-request@cert.org
  412.    In the subject line, type
  413.         SUBSCRIBE  your-email-address
  414.  
  415. - ---------------------------------------------------------------------------
  416. Copyright 1997 Carnegie Mellon University
  417. This material may be reproduced and distributed without permission provided
  418. it is used for non-commercial purposes and the copyright statement is
  419. included.
  420.  
  421. CERT is a service mark of Carnegie Mellon University.
  422. - ---------------------------------------------------------------------------
  423.  
  424. This file: ftp://info.cert.org/pub/cert_advisories/CA-97.06.rlogin-term
  425.            http://www.cert.org
  426.                click on "CERT Advisories"
  427.  
  428.  
  429. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  430. Revision history
  431.  
  432. Feb. 11, 1997  Appendix A - added entries for Cygnus Solutions, NetBSD, and
  433.                 Sun Microsystems
  434.  
  435. -----BEGIN PGP SIGNATURE-----
  436. Version: 2.6.2
  437.  
  438. iQCVAwUBMwC9BHVP+x0t4w7BAQExzQP/exu/u5kkL3SKnsLy3YHm9sYvLXlbZJtQ
  439. ZqEmK4YUjGbsgXkSW2QAnxaZvYAXSJIzapMnnBKI0V18/zu5xGDiJdF18+HfPPc+
  440. xip4cRaSwyutsobpHgp2twGH5rRmmnEzKrpx+I8JOmybjyMfbSEJyq0xHWxQxWM3
  441. bQu1ePswKrs=
  442. =HSix
  443. -----END PGP SIGNATURE-----
  444.  
  445.