__________________________________________________________ The U.S. Department of Energy Computer Incident Advisory Capability ___ __ __ _ ___ / | /_\ / \___ __|__ / \ \___ __________________________________________________________ INFORMATION BULLETIN cron/crontab Buffer Overrun Vulnerabilities December 18, 1996 23:00 GMT Number H-17 ______________________________________________________________________________ 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, 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-08: lpr Buffer Overrun Vulnerability H-09: HP 9000 Access Vulnerability H-10: HP-UX Security Vulnerabilities (passwd, fpkg2swpkg, newgrp) H-11: sendmail Group Permissions Vulnerability H-12: IBM AIX(r) 'SYN Flood' and 'Ping o' Death' Vulnerabilities H-13: IBM AIX(r) Security Vulnerabilities (gethostbyname, lquerypv) H-14: SGI IRIX Vulnerabilities (systour, OutOfBox, cdplayer, datman) H-15: Korn Shell (ksh) suid_exec Vulnerability H-16: HP-UX Security Vulnerabilities (chfn, Remote Watch) H-06a: Sun libc/libnsl vulnerabilities (Sun Bulletin #00137a) 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