November 5, 1993 CERT Coordination Center Generic Security Information The following information can be used in two ways: 1) To help sites that have, or may have, experienced a break-in. 2) To help assess the security of sites that have not experienced a break-in. Section A lists several ways to determine if a system has been compromised. Sections B and C contain lists of vulnerabilities that have been exploited by intruders on UNIX and VMS systems respectively. Section D describes tools that can be used to help secure a system. The information in this document can be used to prevent several types of break-ins. We encourage system administrators to review all sections of this document and modify their systems accordingly to close these potential vulnerabilities. ------------------------------------------------------------------------------- A. How To Determine If Your System Has Been Compromised 1. Examine log files such as your 'last' log, process accounting, syslog, and C2 security logs for logins from unusual locations or other unusual activity. Note that this is not foolproof; many intruders edit accounting files in an attempt to hide their activity. 2. Look everywhere on the system for unusual or hidden files (files that start with a period and are normally not shown by ls) as these can be used to hide information such as password cracking programs and password files from other systems. A favorite trick on UNIX systems is to put a hidden directory in a user's account with an unusual name; something like '...' or '.. ' (dot dot space space) or '..^G' (dot dot control-G). Also, files with names such as '.xx' and '.mail' have been used. 3. Look for set-uid files everywhere on your system. Intruders often leave set-uid copies of /bin/sh around to allow them root access at a later time. The UNIX find program can be used to hunt for setuid root files. The following example will find setuid root files on the '/' (root) partition (Note: The find command will not follow symbolic links): find / -user root -perm -4000 -print 4. Check your system binaries to make sure that they haven't been changed. We've seen intruders change programs on UNIX systems such as login, su, telnet, and other critical network and system programs. On VMS systems, we've seen intruders change programs such as loginout.exe and show.exe. Compare the versions on your systems with known good copies such as those from your initial installation tapes. Be careful of trusting backups; your backups could also contain Trojan horses. 5. Examine all the files that are run by cron and at. We've seen intruders leave back doors in files run from cron or submitted to at. These techniques can let an intruder back on the system even after you've kicked him or her off. Also, verify that all files/programs referenced (directly or indirectly) by the cron and at jobs, and the job files themselves, are not world-writable. 6. Inspect /etc/inetd.conf for unauthorized additions or changes. In particular, hunt for entries that execute a shell program (for example, /bin/sh or /bin/csh) and check all programs that are specified in /etc/inetd.conf to verify that they are correct and haven't been replaced by Trojan horses. 7. Check your system and network configuration files for unauthorized entries. In particular, look for '+' (plus sign) entries and inappropriate non-local host names in /etc/hosts.equiv, /etc/hosts.lpd, and in all ~/.rhost files (especially ~root, ~uucp, ~ftp, and other system accounts) on the system. These files should not be world-writable. Furthermore, ensure that these files existed prior to any intrusion and have not been created by the intruder. 8. Examine all machines on the local network when searching for signs of intrusion. In particular, check those hosts that share NIS (yellow pages) or NFS mounted partitions, or that are referenced in /etc/hosts.equiv files. Also, check any hosts with which your users share .rhost access. 9. Examine the /etc/passwd file on the system and check for any additional or modified accounts. In particular, look for the unauthorized creation of new accounts, accounts with no passwords, or UID changes to existing accounts. B. UNIX System Configuration Problems That Have Been Exploited 1. Weak passwords Intruders often use finger or ruser to discover account names and then try simple passwords. Encourage your users to choose passwords that are difficult to guess (for example, words that are not contained in any dictionary of words of any language; no proper nouns, including names of "famous" real or fictitious characters; no acronyms that are common to computer professionals; no simple variations of first or last names. Furthermore, inform your users not to leave any clear text username/password information in files on any system. A good heuristic for choosing a password is to choose an easy-to-remember phrase, such as "By The Dawn's Early Light", and take the first letters to form a password. Insert in some punctuation or mixed case letters as well. For the phrase above, one example password might be: bt}DeL{. (DO NOT use this sample phrase for your password.) If intruders can get a password file, they will usually take it to another machine and run password guessing programs on it. These programs involve large dictionary searches and run quickly even on slow machines. The experience of many sites is that most systems that do not put any controls on the types of passwords used probably have at least one password that can be easily guessed. If you believe that your password file may have been taken, change all the passwords on the system. At the very least, you should always change all system passwords because an intruder may concentrate on those and may be able to guess even a reasonably 'good' password. Section D details proactive steps that can be taken to ensure that users set 'good' passwords and that encrypted passwords are not visible to system users. 2. Use of TFTP (Trivial File Transfer Protocol) to steal password files To test your system for this vulnerability, connect to your system using tftp and try 'get /etc/passwd'. If you can do this, anyone else on the network can probably get your password file. To avoid this problem, either disable tftpd if you don't require it or ensure that it is configured with restricted access. If you believe your password file may have been taken, the safest course is to change all passwords in the system. 3. Accounts without passwords or known passwords (accounts with vendor-supplied default passwords are favorites) Intruders often exploit system default passwords that have not been changed since installation. Be sure to change all default passwords when the software is installed. Also, be aware that product upgrades can quietly change account passwords to a new default. It is best to change the passwords of default accounts after updates are applied. Scan your password file for extra UID 0 accounts, accounts with no password, or new entries in the password file. Do not allow any accounts without passwords. Remove entries for unused accounts from the password file. To disable an account, change the password field in the /etc/passwd file to an asterisk '*', and change the login shell to /bin/false to ensure that an intruder cannot login to the account from a trusted system on the network. 4. Vulnerabilities in sendmail There have been a number vulnerabilities identified over the years in sendmail(8). To the best of our knowledge, BSD 8.6.4 appears to address those vulnerabilities. To establish which version of sendmail that you are running, use telnet to connect to the SMTP port (25) on your system: telnet 25 We encourage you to keep up to date with the latest version of sendmail from your vendor, and ensure that it is up to date with any security patches or workarounds detailed in CERT Advisories. 5. Old versions of FTP; misconfigured anonymous FTP Make sure that you are running the most recent version of ftpd, which is the Berkeley version 5.60 of July 22, 1990. Check with your vendor for information on configuration upgrades. Also check your anonymous FTP configuration. It is important to follow the instructions provided with the operating system to properly configure the files and directories available through anonymous FTP (for example, file and directory permissions, ownership and group). Note that you should not use your system's standard password file or group file as the password file or group file for FTP. The anonymous FTP root directory and its two subdirectories, etc and bin, should not be owned by ftp. 6. Fingerd hole used by the Morris Internet worm Make sure that you're running a version of finger that is more recent than November 1988. Numerous Berkeley-derived versions of UNIX were vulnerable. 7. Inappropriate network configuration file entries Several vendors supply /etc/hosts.equiv files with a '+' (plus sign) entry. The '+' entry should be removed from this file because it means that your system will trust all other systems. Other files that should not contain a '+' entry include /etc/hosts.lpd and all ~/.rhost files on the system. These files should not be world-writable. We recommend that you do not support the following services in your /etc/inetd.conf file unless you specifically require them: port 11 - systat port 69 - tftp port 87 - link 8. Misconfiguration of uucp If your machine supports uucp, check the L.cmds (Permissions) file and ensure that only the commands you require are included. This file should be owned by root (not by uucp!) and world-readable. The L.sys (Systems) file should be owned by uucp and protected (600) so that only programs running setuid uucp can access it. 9. Inappropriate 'secure' settings in /etc/ttys and /etc/ttytab Check the file /etc/ttys or /etc/ttytab depending on the release of UNIX being used. The default setting should be that no terminal lines, pseudo terminals or network terminals are set secure except for the console. 10. Inappropriate entries in /usr/lib/aliases Examine the /usr/lib/aliases (mail alias) file for inappropriate entries. Some alias files include an alias named 'uudecode' or just 'decode'. If this alias exists on your system, and you are not explicitly using it, then it should be removed. 11. Inappropriate file and directory protections Check your system documentation to establish the correct file and directory protections and ownership for system files and directories. In particular, check the '/' (root) and '/etc' directories, and all system and network configuration files. Examine file and directory protections before and after installing software or running verification utilities. Such procedures can cause file and directory protections to change. 12. Old versions of system software Older versions of operating systems often have security vulnerabilities that are well known to intruders. To minimize your vulnerability to attacks, keep the version of your operating system up-to-date and apply security patches appropriate to your system(s) as soon as they become available. C. VMS System Vulnerabilities 1. Accounts with known default passwords Intruders often exploit system default passwords that have not been changed since installation. Make sure to change all default passwords when the software is installed. Be aware that product upgrades can quietly change account passwords to a new default. It is best to change the passwords of default accounts after updates are applied. Accounts no longer in use should be removed from the authorization file and rights database. Dormant accounts should be set to DISUSER. Intruders also try guessing simple user passwords. See the discussion on weak passwords in Section A for suggestions on choosing good passwords. 2. Unauthorized versions of system files If an intruder gets into a system, the programs patch.exe, loginout.exe, and show.exe are often modified. Compare these programs with those found in your distribution media. D. Software Tools To Assist In Securing Your System ***************************************************************************** * The CERT Coordination Center will not formally review, evaluate, or * * endorse the tools and techniques described. The decision to use the * * tools and techniques described is the responsibility of each user or * * organization, and we encourage each organization to thoroughly evaluate * * new tools and techniques before installation or use. * ***************************************************************************** 1. Shadow passwords If your UNIX system has a shadow password capability, you should consider using it. Under a shadow password system the /etc/passwd file does not have encrypted passwords in the password field. Instead the encrypted passwords are held in a shadow file that is not world readable. Consult your system manuals to determine whether a shadow password capability is available on your system, and to get details of how to set up and manage such a facility. 2. COPS (The Computer Oracle and Password System) COPS is a publicly available collection of programs that attempt to identify security problems in a UNIX system. COPS does not attempt to correct any discrepancies found; it simply produces a report of its findings. COPS was written by Dan Farmer and is available via anonymous FTP from the info.cert.org system in the /pub/cops directory and via uucp from uunet.uu.net. 3. passwd+ passwd+ is a replacement program suite that allows a system administrator to enforce policies for selecting passwords. The suite also provides a logging capability. passwd+ was written by Matt Bishop and can be obtained by anonymous FTP from the dartmouth.edu system (129.170.16.4) in the file /pub/passwd+.tar.Z. Please read the README.IMPORTANT file which accompanies this software distribution. 4. TCP/IP Wrapper Program This program provides additional network logging information and gives a system administrator the ability to deny or allow access from certain systems or domains to the host on which the program is installed. ation of this software does not require any modification to existing network software or network configuration files. The program was written by Wietse Venema from Eindhoven University of Technology in the Netherlands and is available via anonymous FTP from the info.cert.org system in the /pub/tools/tcp_wrapper directory. ------------------------------------------------------------------------- If you believe that your system has been compromised, contact the CERT Coordination Center or your representative in Forum of Incident Response and Security Teams (FIRST). Internet E-mail: cert@cert.org Telephone: 412-268-7090 (24-hour hotline) CERT personnel answer 8:30 a.m.-5:00 p.m. EST(GMT-5)/EDT(GMT-4), and are on call for emergencies during other hours. CERT Coordination Center Software Engineering Institute Carnegie Mellon University Pittsburgh, PA 15213-3890 The CERT Coordination Center issues CERT Advisories, which warn you about problems and inform you about preventive techniques. The CERT Coordination Center maintains a CERT Advisory mailing list, which is also distributed via the USENET newsgroup comp.security.announce. If you are unable to receive the newsgroup comp.security.announce, and would like to be added to the Advisory mailing list, send mail to: cert-advisory-request@cert.org Past advisories, information about FIRST representatives, and other information related to computer security are available for anonymous FTP from info.cert.org. Copyright (c) 1991, 1992, 1993 Carnegie Mellon University