************************************************************************** Security Bulletin 9525 DISA Defense Communications System June 7, 1995 Published by: DDN Security Coordination Center (SCC@NIC.DDN.MIL) 1-(800) 365-3642 DEFENSE DATA NETWORK SECURITY BULLETIN The DDN SECURITY BULLETIN is distributed by the DDN SCC (Security Coordination Center) under DISA contract as a means of communicating information on network and host security exposures, fixes, and concerns to security and management personnel at DDN facilities. Back issues may be obtained via FTP (or Kermit) from NIC.DDN.MIL [192.112.36.5] using login="anonymous" and password="guest". The bulletin pathname is scc/ddn-security-yynn (where "yy" is the year the bulletin is issued and "nn" is a bulletin number, e.g. scc/ddn-security-9428). ************************************************************************** + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ! ! ! The following important advisory was issued by the Automated ! ! Systems Security Incident Support Team (ASSIST) and is being ! ! relayed unedited via the Defense Information Systems Agency's ! ! Security Coordination Center distribution system as a means ! ! of providing DDN subscribers with useful security information. ! ! ! + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Automated Systems Security Incident Support Team _____ ___ ___ _____ ___ _____ | / /\ / \ / \ | / \ | | / Integritas / \ \___ \___ | \___ | | < et /____\ \ \ | \ | | \ Celeritas / \ \___/ \___/ __|__ \___/ | |_____\ <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Bulletin 95-23 Release date: 6 June, 1995, 11:30 AM EDT (GMT -4) SUBJECT: wu-ftpd Mis-configuration Vulnerability. SUMMARY: A problem exists with certain configurations of the Washington University ftpd which may allow root access from any account on the system. This bulletin provides updated information to ASSIST bulletin 94-12, which can be referenced for additional background information on this problem. BACKGROUND: Some pre-compiled wu-ftpd-2.4 binaries distributed with Linux have a vulnerable configuration. Other users of wu-ftpd should take this opportunity to verify the configuration of their daemons are not vulnerable. NOTE: Versions of wu-ftpd prior to 2.4 contain serious security vulnerabilities and should be updated immediately. In its original form, the vulnerability was not enabled by default. However, certain distributions of Linux contain a wu.ftpd that has been compiled with a vulnerable configuration. This vulnerability has been confirmed for Linux Slackware-2.1 and 2.2. Other versions may also be affected. Instructions for testing systems for the vulnerability (including non-Linux) are included in this bulletin. The pre-compiled binaries shipped with Linux Slackware distributions are vulnerable. The variable _PATH_EXECPATH was set to "/bin" in the configuration file src/pathnames.h when the distribution binary was built. _PATH_EXECPATH should be set to "/bin/ftp-exec" or a similar directory that does not contain a shell or command interpreter. The source code shipped with the Linux distributions contains the correct value ("/bin/ftp-exec") (which should be verified before recompiling) despite the incorrect distribution binary. Floppy-only distributions of Linux do not contain source code. The latest version of the wu-ftpd source code can be obtained from: ftp://wuarchive.wustl.edu/packages/wuarchive-ftpd/wu-ftpd-2.4.tar.Z The patch file wu-ftpd-2.4.diff.gz for Linux contains incorrect information. This should be corrected and verified before recompiling. The diff(1) file exists to modify the wu-ftpd source code to allow it to compile on Linux. The application of this diff(1) file patch will configure wu-ftpd with the vulnerability in place. IMPACT: Anyone who has a local account on the system offering ftp services with the vulnerable configuration may gain root access. Support for anonymous ftp access is not required to exploit this vulnerability. RECOMMENDED SOLUTIONS: wu-ftpd configurations should be checked for existence of the vulnerability, and corrective action taken to immediately remove the problem if found. Detection Vulnerable wu-ftpd configurations can be detected by executing (as a user) the commands below or by running strings(1) against the wu-ftpd daemon. A. Detection with user commands. To test your configuration to see if you are vulnerable, you can execute the following commands: srchost> ftp ftphost Connected to ftphost 220 ftphost FTP server (Version wu-2.4(2) Mon Apr 18 09:12:35 GMT+1000 1994) ready. Name (srchost:user): 331 Password required for user. Password: 230 User user logged in. ftp> quote site exec echo problem 200-echo problem 200-problem 200 (end of 'echo problem') ftp> quit 221 Goodbye. srchost> If you receive the line "200-problem", then your site is vulnerable. Note that this does not work for anonymous ftp access, or for all vulnerable configurations. B. Detection using strings(1) Determine the location of the SITE EXEC path by executing the following command on the src/pathnames.h file: $ grep _PATH_EXECPATH pathnames.h #define _PATH_EXECPATH "/bin/ftp-exec" $ Use the output of this command to verify that the currently running binary is configured the same as the source code. Note, you should consult your documentation for strings(1) to determine the correct switch for examining the entire binary: $ strings -a wu.ftpd | grep "/bin/ftp-exec" /bin/ftp-exec $ If the binary contains the same pathname for _PATH_EXECPATH, then you have determined the correct location for the SITE EXEC commands. The directory defined by _PATH_EXECPATH should not contain a shell or command interpreter (such as perl) and should not be world or group writeable, nor should any directory back to the root directory (/) be group or world writeable. Permissions 511 are acceptable. Recovery If you have the vulnerability and you are unsure how to eliminate it you should mmediately disable your ftp daemon until the configuration can be corrected. A. Temporary workaround If you are unsure how to rebuild a new ftpd daemon, then an interim workaround is to disable the existing service. Note: This will cause all incoming ftp requests to fail. 1. become root 2. comment out ftp in /etc/inetd.conf by inserting a "#" at the beginning of the ftp line, ie: #ftp stream tcp 3. Restart the inetd process. On most systems, this is done by sending a HUP signal to the inetd process. For example: On System V systems # /bin/ps -ef | grep inetd | grep -v grep or On BSD systems # /bin/ps -aux | grep inetd | grep -v grep followed by: # kill -HUP You should verify that the ftp service has been disabled by attempting to connect to it. You should see a "connection refused" message. B. Correcting the vulnerable configuration. Ensure that the _PATH_EXECPATH definition in src/pathnames.h is "/bin/ftp-exec" and not "/bin" or any other system directory containing a shell or interpreter, and then recompile. If the wu-ftpd-2.4.diff.gz patch has been applied on Linux systems, the patched version of pathnames.h will be vulnerable. This file should be edited manually before the rebuild to correct the _PATH_EXECPATH definition to "/bin/ftp-exec". Replace the existing ftpd binary with the newly built version. C. Instructions to enable SITE EXEC Once the running binary has been confirmed as not containing the vulnerable configuration, the SITE EXEC commands can be enabled through the following procedure. 1. Ensure that the _PATH_EXECPATH definition in pathnames.h is "/bin/ftp-exec" and not "/bin" or any other system directory containing a shell. This should also be checked in the binary version (see "Detection B" section above). 2. Create ~ftp/bin/ftp-exec. This should be owned by root, permissions set to 555. 3. Copy the statically linked binaries that you want available for execution by SITE EXEC into the ~ftp/bin/ftp-exec directory. These should be owned by root with permissions set as 111. The binaries should never be a shell or command interpreter that allows arbitrary programs to be run. 4. If you want the DIR ftp command, you will need a hard link from ~ftp/bin/ls to ~ftp/bin/ftp-exec/ls or a copy of ls in ~ftp/bin. The instructions above enable SITE EXEC commands for anonymous users only. To enable SITE EXEC commands for normal ftp users: 5. Create a symbolic link from /bin/ftp-exec to ~ftp/bin/ftp-exec. You should follow file ownership, group membership and permissions strictly according to your documentation. Note that some versions of ftp contain incorrect information for setting file permissions and ownership. Further information can be found in: ftp://assist.mil/pub/general.info/securing.info.servers ASSIST would like to thank the AUSCERT for information contained in this bulletin. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ASSIST is an element of the Defense Information Systems Agency (DISA), Center for Information Systems Security (CISS), that provides service to the entire DoD community. Constituents of the DoD with questions about ASSIST or computer security security issues, can contact ASSIST using one of the methods listed below. Non-DoD organizations/institutions, contact the Forum of Incident Response and Security Teams (FIRST) (FIRST) representative. To obtain a list of FIRST member organizations and their constituencies send an email to docserver@first.org with an empty "subject" line and a message body containing the line "send first-contacts". ASSIST Information Resources: To be included in the distribution list for the ASSIST bulletins, send your Milnet (Internet) e-mail address to assist-request@assist.mil. Back issues of ASSIST bulletins, and other security related information, are available from the ASSIST BBS at 703-607-4710, DSN 327-4710, and through anonymous FTP from assist.mil (IP address 199.211.123.11). Note: assist.mil will only accept anonymous FTP connections from Milnet addresses that are registered with the NIC or DNS. If your system is not registered, you must provide your MILNET IP address to ASSIST before access can be provided. ASSIST Contact Information: PHONE: 800-357-4231 (or 703-756-7974 DSN 289), duty hours are 06:00 to 22:30 EDT (GMT -4) Monday through Friday. During off duty hours, weekends and holidays, ASSIST can be reached via pager at 800-791- 4857. The page will be answered within 30 minutes, however if a quicker response is required, prefix the phone number with "999". ELECTRONIC MAIL: Send to assist@assist.mil. ASSIST BBS: Leave a message for the "sysop". Reference herein to any specific commercial product, process, or service by trade name, trademark manufacturer, or otherwise, does not constitute or imply its endorsement, recommendation, or favoring by ASSIST. The views and opinions of authors expressed herein shall not be used for advertising or product endorsement purposes. **************************************************************************** * * * The point of contact for MILNET security-related incidents is the * * Security Coordination Center (SCC). * * * * E-mail address: SCC@NIC.DDN.MIL * * * * Telephone: 1-(800)-365-3642 * * * * NIC Help Desk personnel are available from 7:00 a.m.-7:00 p.m. EST, * * Monday through Friday except on federal holidays. * * * **************************************************************************** PLEASE NOTE: Some users outside of the DOD computing communities may receive DDN Security bulletins. If you are not part of the DOD community, please contact your agency's incident response team to report incidents. Your agency's team will coordinate with DOD. 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 by sending email to docserver@first.org with an empty subject line and a message body containing the line: send first-contacts. This document was prepared as an service to the DOD community. Neither the United States Government nor any of their employees, makes any warranty, expressed or implied, or assumes any legal liability or responsibility for the accuracy, completeness, or usefulness of any information, 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. The opinions of the authors expressed herein do not necessarily state or reflect those of the United States Government, and shall not be used for advertising or product endorsement purposes.