CERT-SEI

Buffer Overflow Problem in rdist

Original issue date: January 15, 1998
Last revised: December 9, 1998
  Updated vendor information for Sun Microsystems, Inc.

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

The CERT Coordination Center has received reports of a vulnerability in rdist that enables anyone with access to a local account to gain root privileges. This is not the same vulnerability as the one discussed in CA-96.14.

Section III.A contains instructions on how to determine if your site is vulnerable. If your implementation of rdist is vulnerable, the CERT/CC team encourages you to follow your vendor's instructions (Sec. III.B and Appendix A) or install a freely available version of the rdist program that is not installed as set-user-id root and is, therefore, not susceptible to the exploitation described in this advisory (Sec. III.C).

For information on the earlier problem with rdist, see

http://www.cert.org/advisories/CA-96.14.rdist_vul.html.

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

The rdist program is a UNIX Operating System utility used to distribute files from one host to another. On some systems, rdist opens network connections using a privileged port as the source port. This requires root privileges, and to attain these privileges rdist on such systems is installed set-user-id root.

A new vulnerability has been found in some set-user-id root implementations of rdist. The vulnerability lies in the function expstr(), where macros supplied as arguments are expanded using sprintf(). It is possible to overwrite stack frames and call specially pre-crafted native machine code. If the appropriate machine code is supplied, an attacker can execute arbitrary programs (such as the shell) with set-user-id root privileges.

Note that this vulnerability is distinct from that discussed in CERT advisoryCA-96.14.

II. Impact

On systems with a vulnerable copy of rdist, anyone with access to a local account can gain root access.

III. Solution

We urge you to follow the steps in Section A to determine if your system is vulnerable and, if it is, to turn off rdist while you decide how to proceed.

If your system is vulnerable and you need the functionality that rdist provides, you should install a vendor patch (Section B). Until you can do so, you may want to use a freely available version of rdist that does not need to be installed as set-user-id root and is, therefore, not susceptible to the exploitation described in this advisory (Section C).

A. How to check for set-user-id root versions of rdist

To find set-user-id root versions of rdist and to disable the programs that are possibly 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.

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 three lines using backslashes.

find FILE_SYSTEM_NAMES -xdev -type f -user root \
 -name '*rdist*' -perm -04000 -exec ls -l '{}' \; \
 -ok chmod 0500 '{}' \;
This command will find all files on a system that
- are only in the file system you name (FILE_SYSTEM_NAMES -xdev) - are regular files (-type f)
- are owned by root (-user root)
- have "rdist" as a component of the name (-name '*rdist*') - are setuid (-perm -04000)

Once found, those files will
- have their names and details printed (-exec ls -l '{}')
- have the setuid mode removed (making the file available only to root) but only if you type `y' in response to the prompt (-ok chmod 0500 '{}' \;)

B. Obtain and install the appropriate patch

Below is a list of vendors who have provided information for this advisory. Details are in Appendix A, and we will update the appendix as we receive more information.

Berkeley Software Design, Inc. (BSDI)
Caldera
Digital Equipment Corp.
FreeBSD, Inc.
Hewlett-Packard Company
IBM Corporation
NEC Corporation
NCR Corporation
The Santa Cruz Operation, Inc. (SCO)
Siemens-Nixdorf
Silicon Graphics Inc. (SGI)
Sun Microsystems, Inc.

If your vendor's name is not on this list, please contact the vendor directly.

C. If you need the functionality that rdist provides but a patched version is not yet available from your vendor, consider installing rdist-6.1.3,

which is freely available from

ftp://usc.edu/pub/rdist/rdist-6.1.3.tar.gz

MD5 (rdist-6.1.3.tar.gz) = 8a76b880b023c5e648b7cb77b9608b9f

The README file in the distribution explains how to configure and install this version of rdist.

We recommend that you configure this version of rdist to use rsh instead of rcmd. Here is the relevant text from the README:

"By default rdist uses rsh(1c) to make connections to remote hosts. This has the advantage that rdist does not need to be setuid to "root". This eliminates most potential security holes. It has the disadvantage that it takes slightly more time for rdist to connect to a remote host due to the added overhead of doing a fork() and then running the rsh(1c) command."

Some sites with sufficient expertise use the ssh program in conjunction with rdist, instead of using rcmd or rsh. If you have the expertise, you may want to implement this configuration.

For further details on this option see "Ssh (Secure Shell) FAQ - Frequently asked questions," Section 4.4, "Can I use rdist with ssh?" It is available from

http://www.uni-karlsruhe.de/~ig25/ssh-faq/ssh-faq-4.html

For details on how to obtain ssh, see FAQ Section 3.4, "Where can I obtain ssh?" This section can be found in

http://www.uni-karlsruhe.de/~ig25/ssh-faq/ssh-faq-3.html


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)

BSDI shipped a patch for this for our 2.1 release (U210-018) when the original Bugtraq advisory was released. The 3.0 version of rdist is not vulnerable and in fact is no longer even setuid.

Caldera

This message is to inform CERT that neither Caldera Network Desktop nor Caldera OpenLinux ship rdist SUID and are thus not vulnerable. See our advisory on this subject at: http://www.caldera.com/tech-ref/security/SA-1997.23.txt

Digital Equipment Corp.

This reported problem is not present for Digital's ULTRIX or Digital UNIX Operating Systems Software.
DIGITAL EQUIPMENT CORPORATION

FreeBSD, Inc.

2.1.0 is vulnerable.
2.1.5, 2.1.6 and 2.1.7 are and 2.1-stable are not. In any case, upgrading to 2.1.7 or even better, 2.1-stable should be considered.
If there is demand, we'll release a patch for 2.1.0

All 2.2 releases, 2.2-stable and FreeBSD-current are not vulnerable.

Hewlett-Packard Company

HP is -not- vulnerable; the problem didn't exist in 9.X, and has been fixed in 10.X with Security Bulletin #36 (HPSBUX9608-036) last year. Patch numbers change frequently because of cumulative patching, so please check current patch ID information either by bulletin or by platform/release at our HP Electronic Support Center in the "Security Patch Matrix," which is updated every 24 hours.

1) From your Web browser, access the URL:
http://us-support.external.hp.com
(US,Canada,Asia-Pacific, and Latin-America)

http://europe-support.external.hp.com
(Europe)

2) On the HP Electronic Support Center main screen, select the hyperlink "Support Information Digests".

3) On the "Welcome to HP's Support Information Digests" screen, under the heading "Register Now", select the appropriate hyperlink "Americas and Asia-Pacific", or "Europe".

4) On the "New User Registration" screen, fill in the fields for the User Information and Password and then select the button labeled "Submit New User".

5) On the "User ID Assigned" screen, select the hyperlink "Support Information Digests".

**Note what your assigned user ID and password are for future reference.

6) You should now be on the "HP Support Information Digests Main" screen. You might want to verify that your email address is correct as displayed on the screen. From this screen, you may also view/subscribe to the digests, including the security bulletins digest.

To get a patch matrix of current HP-UX and BLS security patches referenced by either Security Bulletin or Platform/OS, click on following screens in order:

Technical Knowledge Database
Browse the HP Security Bulletins Archive
HP-UX Security Patch Matrix

IBM Corporation

All versions of AIX are vulnerable to this buffer overflow. There is no 3.2 fix. It is recommended that 3.2 customers upgrade to a higher level. The following APARs will be available for AIX version 4 soon.

AIX 3.2: upgrade to 4.1.5 or higher
AIX 4.1: IX70876
AIX 4.2: IX70875

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.

NEC Corporation

The following systems are NOT affected by this vulnerability:

UX/4800
UX/4800(64)
EWS-UX/V(Rel4.2MP)
EWS-UX/V(Rel4.2)

UP-UX/V(Rel4.2MP)
To report a new vulnerability, contact <UX48-security-support@nec.co.jp>.

NCR Corporation

NCR is delivering a set of operating system dependent patches which contain an update for this problem . Accompanying each patch is a README file which discusses the general purpose of the patch and describes how to apply it to your system.

Recommended solution:

Apply one of the following patches depending on the revision of the inet package installed on your system. To check its version execute:

pkginfo -x inet

For inet 5.01.xx.xx: - PINET501 (Version later than 05.01.01.59)
For inet 6.01.xx.xx: - PINET601 (Version later than 06.01.00.19)
For inet 6.01.xx.xx: - PINET601 (Version later than 06.02.00.01)

OpenBSD

OpenBSD does not have this problem. None of the versions of rdist distributed are setuid or setgid.

The Santa Cruz Operation, Inc. (SCO)

SCO has determined that the following SCO operating systems are not vulnerable:

- SCO CMW+ 3.0
- SCO Open Desktop/Open Server 3.0
- SCO OpenServer 5.0
- SCO UnixWare 2.1

Siemens-Nixdorf Informationssysteme AG

Rdist has not been shipped with ReliantUNIX versions prior to 5.43C. The latest ReliantUNIX-Y/N version 5.43C contains a vulnerable rdist.

For this version we recommend to remove the set-user-id root bit from /usr/ucb/rdist following the instructions given in section III.A.

ReliantUNIX-Y/N 5.44A will be shipped with rdist 6.1.3. Patches for ReliantUNIX-N/Y 5.43C are available on requirement. Please ask SNI's customers service for details."

Silicon Graphics Inc. (SGI)

Silicon Graphics Inc. issued Security Advisory, "IRIX ordist Buffer Overrun Vulnerability," 19970509-02-PX, August 5, 1997.

Patches are available via anonymous FTP and your service/support provider.

The SGI anonymous FTP site is sgigate.sgi.com (204.94.209.1) or its mirror, ftp.sgi.com. Security information and patches can be found in the ~ftp/security and ~ftp/patches directories, respectfully.

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/security/security.html

Sun Microsystems, Inc.

Please refer to Sun Microsystems, Inc. Security Bulletin, "rdist," Number: #00179, distributed November 18, 1998 for additional information relating to this vulnerability.

Patches and Checksums are available to all Sun customers via World Wide Web at: http://sunsolve.sun.com/sunsolve/pubpatches/patches.html

Sun security bulletins are available via World Wide Web at: http://sunsolve.sun.com/pub-cgi/secbul.pl


The CERT Coordination Center thanks Hiroshi Nakano of Ryukoku University, Japan for reporting this problem. We also thank Wolfgang Ley of DFN-CERT for his assistance with the Solutions section of the advisory.



Copyright 1997 Carnegie Mellon University.


Revision History
Dec.  9, 1998   Updated vendor information for Sun Microsystems, Inc.
May 27, 1998    Updated vendor information for Sun Microsystems.
Jan. 15, 1998   Updated vendor information for NCR.
Nov. 14, 1997   Updated vendor information for Siemens-Nixdorf.
Oct. 3, 1997    Appendix A - added information for Caldera.
Sept. 30, 1997  Updated copyright statement
Sept. 15, 1997  Appendix A - added information for OpenBSD and Silicon Graphics, Inc.