-----BEGIN PGP SIGNED MESSAGE----- <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 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". ASSIST uses Pretty Good Privacy (PGP) 2.6.2 as the digital signature mechanism for bulletins. PGP 2.6.2 incorporates the RSAREF(tm) Cryptographic Toolkit under license from RSA Data Security, Inc. A copy of that license is available via anonymous FTP from net-dist.mit.edu (IP 18.72.0.3) in the file /pub/PGP/rsalicen.txt. In accordance with the terms of that license, PGP 2.6.2 may be used for non-commercial purposes only. Instructions for downloading the PGP 2.6.2 software can also be obtained from net-dist.mit.edu in the pub/PGP/README file. PGP 2.6.2 and RSAREF may be subject to the export control laws of the United States of America as implemented by the United States Department of State Office of Defense Trade Controls. The PGP signature information will be attached to the end of ASSIST bulletins. 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. - -----BEGIN PGP PUBLIC KEY BLOCK----- Version: 2.6 mQCNAi4uZ40AAAEEAM1uraimCNeh5PtzX7KoGxC2u8uMTdl8V5sujk3MHbWvCuOM W0FqDy5s9iwfQLZWzJ7cbM6L0mNOj8eJGoz7TqGKZDDRFlKAwg0x8joleZLC2gXw FVdF/g6Mdv7ok7heoa+Y//YMeADnsSrmzqLCnhFbKYffww3EbdH6sbnW3Io9AAUR tB9BU1NJU1QgVGVhbSA8YXNzaXN0QGFzc2lzdC5taWw+iQCVAwUQL1xx7tH6sbnW 3Io9AQEBYwP9FvIJbnKjtMLUj8ghd6hophSx8WZnfQsOmZX/BbX8vKz1a5BkBn4q ANvW+uKGdUlE8LLMEm1PD59Cihcb3OoWDOU8zIOIErvry4eqa+LzEXV8nnBdes+A a1MCMGSz+K3OaP78lQ7JCGoY9TXTWIelfAdBVBG4VQcSQRn8tjRdG2e0KEFTU0lT VCBUZWFtIDxhc3Npc3RAYXNzaXN0Lmltcy5kaXNhLm1pbD6JAJUCBRAuLnHoh0Y9 0jC+b6kBAU0TA/4yXSL7K6tcfVm9ACnP4crCoutFM2w10e7YKxD850ajhWrh6rI9 O+sjU5WObqiPJ7sZHdEw/KARzPSijH/5h8HlyYa6ClksWxYuymzCsUYYJctdjcGr uakfXgYQ1TkkyUfNrN5G90NuRK/vTRe7bkmyGNYjN9Njac1Q18WVF59Chg== =d5rP - -----END PGP PUBLIC KEY BLOCK----- -----BEGIN PGP SIGNATURE----- Version: 2.6 iQCVAwUBL9RzhtH6sbnW3Io9AQHeqAP/Sbb0q3AbT30T70pUbSwSBaLULwxlyTTL nIiqon9rV2qV/ac+Ej1PsWZ2H7Jrfn/QqUCr9ipendqNsZfy6i0qNCDPtHQnzXhj mf9usT7hHLHbyusFfCwvSZuNr/QgY/fRAVgrMlZluDAl3yzG5uARRUUGoPnBKP3R +7cC+IpLCAU= =zZcz -----END PGP SIGNATURE-----