cron/crontab Buffer Overrun Vulnerabilities Privacy and Legal Notice

CIAC INFORMATION BULLETIN

H-17: cron/crontab Buffer Overrun Vulnerabilities

December 18, 1996 20:00 GMT
PROBLEM:       Problems have been identified in cron(8) and crontab(1) 
               programs. 
PLATFORM:      All platforms running FreeBSD 1.0, 1.1, 2.1.0, 2.1.5, 2.1.6, 
               2.1.6.1 and 2.2. 
               All platforms running RedHat Linux version 4.0. 
               All releases of NetBSD up to and including 1.2. 
DAMAGE:        Local users may gain root privileges. 
SOLUTION:      Install the proper patches and/or use the workarounds provided 
               below. 

VULNERABILITY Exploit information involving this vulnerabilities has been ASSESSMENT: made publicly available.
[ Start AUSCERT Advisory ] =========================================================================== AA-96.21 AUSCERT Advisory cron/crontab Buffer Overrun Vulnerabilities 18 December 1996 Last Revised: -- ---------------------------------------------------------------------------- AUSCERT has received information that vulnerabilities exist in the cron(8) and crontab(1) programs found in the Unix cron package. These vulnerabilities may allow local users to gain root privileges. Exploit information involving these vulnerabilities has been made publicly available. The vulnerabilities in the cron package affect numerous vendors and platforms. AUSCERT recommends that sites take the steps outlined in section 3 as soon as possible. This advisory will be updated as more information becomes available. ---------------------------------------------------------------------------- 1. Description AUSCERT has received information that vulnerabilities exist in the cron(8) and crontab(1) programs. cron(8) executes commands at specified times according to instructions placed in user crontab files. crontab(1) is used to install, remove or list the tables used to drive the cron daemon. Both of these programs are installed by default. Two unrelated vulnerabilities are known to exist in some versions of the cron package. 1. Command line buffer overrun Due to insufficient bounds checking on arguments which are supplied by users, it is possible to overwrite the internal stack space of the crontab program while it is executing. By supplying a carefully designed argument to the crontab program, intruders may be able to force crontab to execute arbitrary commands. As crontab is setuid root, this may allow intruders to run arbitrary commands with root privileges. 2. Reading environment buffer overrun A similar vulnerability exists in the library routine used to load environment variables. This vulnerable routine is used in both cron and crontab. Due to insufficient bounds checking, it may be possible for intruders to manipulate cron or crontab into executing arbitrary commands with root privileges. Both of these vulnerabilities are known to be present in the Vixie cron package, up to and including version 3.0. This package is installed by default under some versions of Unix. The Vixie cron package may have also been installed as third party software by sites. The following command may be used to indicate whether a version of cron based on Vixie cron is installed: # strings /usr/bin/crontab | grep -i vix Sites which have versions based on Vixie cron should consider themselves vulnerable unless they have specific information from their vendors which suggests otherwise. Other versions of the cron package supplied by vendors may also be vulnerable (Section 3). Exploit information involving these vulnerabilities has been made publicly available. 2. Impact Local users may gain root privileges. 3. Workarounds/Solution AUSCERT recommends that sites limit the possible exploitation of these vulnerabilities by immediately removing the setuid permissions on crontab(1) and checking the contents of crontab files as stated in Section 3.1. Vendor information about the vulnerabilities described in this advisory is provided in Section 3.2. If the cron functionality is required for non privileged users, and no vendor information or patches are available (Section 3.2), AUSCERT recommends that access be restricted to a trusted set of users as given in Section 3.3. 3.1 Remove setuid and non-root execute permissions and check crontab files AUSCERT recommends that the setuid permissions be removed from the crontab program immediately. As the crontab program will no longer work for non-root users, it is recommended that the execute permissions also be removed. For example: # ls -l /usr/bin/crontab -r-sr-xr-x 1 root bin 20480 Jun 10 1996 /usr/bin/crontab # chmod 500 /usr/bin/crontab # ls -l /usr/bin/crontab -r-x------ 1 root bin 20480 Jun 10 1996 /usr/bin/crontab Note that this will remove the ability for any non-root user to run the crontab program. This will prevent further exploitation of the crontab vulnerabilities described in this advisory. In addition, to ensure that cron can not be exploited through existing user crontab files, sites should check the contents of all existing crontab files for unusual contents. Unusual contents may include very long lines or lines containing non-ASCII characters. If strange environment settings or other unusual entries are found, it may indicate a possible attack. User crontab files are usually located in either /var/cron/tabs or /var/spool/cron. 3.2 Vendor information Below is a list of vendors which are known to be affected by the crontab vulnerabilities described in this advisory: RedHat Linux FreeBSD, Inc NetBSD Project The following vendors have informed AUSCERT that they are not vulnerable to these vulnerabilities: Hewlett Packard IBM Corporation The OpenBSD project If your vendor's name is not listed above, please contact your vendor directly. For more specific vendor information, see Appendix A. 3.3 Restrict crontab access If the cron functionality is required by a small set of trusted users, sites may wish to restrict the execution of crontab to that group of users. For example, if the Unix group "trusted" exists and contains only those users allowed to use the cron functionality, the following commands will restrict its use: # chgrp trusted /usr/bin/crontab # chmod 4750 /usr/bin/crontab # ls -l /usr/bin/crontab -rwsr-x--- 1 root trusted 20480 Jun 10 1996 /usr/bin/crontab Access to any account in the "trusted" group will allow vulnerable versions of the cron package to be exploited. It should be noted that the use of cron allow/deny files (see crontab(1)) will not prevent the exploitation of the command line buffer overrun vulnerability. ----------------------------------------------------------------------------- Appendix A Vendor information This appendix will be updated as we receive additional information. If your vendor is not listed below, or you require further vendor information, please contact the vendor directly. FreeBSD, Inc. ============= FreeBSD versions 1.0, 1.1, 2.1.0, 2.1.5, 2.1.6, 2.1.6.1 and 2.2 -stable (prior to 16 Dec 1996) and 2.2 -current (prior to 16 Dec 1996) are all affected by the crontab vulnerabilities described in this advisory. The FreeBSD Security Team have released an advisory and patch information for the crontab vulnerabilities. This advisory (FreeBSD-SA-96:20.stack-overflow) is available from: ftp://freebsd.org/pub/CERT/advisories/FreeBSD-SA-96:20.stack-overflow.asc Patches are available from: ftp://freebsd.org/pub/CERT/patches/SA-96:20/ Hewlett Packard =============== The version of crontab shipped with all current versions of HP-UX 9.x and 10.x is not vulnerable to the buffer overflow problems described in this advisory. IBM Corporation =============== The version of crontab shipped with AIX is not vulnerable to the buffer overflow conditions listed in this advisory. IBM and AIX are registered trademarks of International Business Machines Corporation. Linux (RedHat) ============== RedHat Linux version 4.0 is known to be vulnerable. Earlier versions may also be vulnerable. The Net Project =============== All releases of NetBSD up to and including 1.2 appear to be vulnerable. These problems will be fixed in 1.3 and in the upcoming bug fix release for 1.2. The OpenBSD Project =================== OpenBSD 2.0 is not susceptible to the vulnerabilities described in this advisory. ---------------------------------------------------------------------------- AUSCERT thanks Theo de Raadt of the OpenBSD project for his assistance in the preparation of this advisory. Thanks also to the vendors who provided specific product information. ---------------------------------------------------------------------------- [ End AUSCERT Advisory ]

CIAC wishes to acknowledge the contributions of AUSCERT for the information contained in this bulletin.

CIAC services are available to DOE, DOE Contractors, and the NIH. CIAC can be contacted at:
    Voice:          +1 925-422-8193 (7 x 24)
    FAX:            +1 925-423-8002
    STU-III:        +1 925-423-2604
    E-mail:          ciac@ciac.org
    World Wide Web:  http://www.ciac.org/
    Anonymous FTP:   ftp.ciac.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.
UCRL-MI-119788
[Privacy and Legal Notice]