On This Page
Introduction
Before You Begin
Reducing the Attack Surface of Your Web Server
Configuring Accounts
Securing Files and Directories
Securing Web Sites and Virtual Directories
Configuring Secure Sockets Layer on Your Web Server
Related Information
Introduction
Web servers are frequent targets for various types of security attacks. Some of these attacks are serious enough to cause significant damage to business assets, productivity, and customer relationships-and all attacks are inconvenient and frustrating. The security of your Web servers is vital to the success of your business.
This document explains how to begin the process of securing a Web server that is running Internet Information Services (IIS) 5.0 on the Microsoft Windows 2000 Server, Standard Edition operating system, or Internet Information Services 5.1 on the Microsoft Windows XP operating system. First, this section describes some of the most common threats that affect Web servers. Then, this document provides prescriptive guidance for making your Web server more secure against such attacks.
This document provides the following guidance for increasing the security of your Web server:
-
Reducing the attack surface, or the extent to which your server is exposed to potential attackers, of your Web server
-
Configuring accounts and permissions for the users and groups that access your Web site
-
Making the IIS metabase and log files more secure against access by unauthorized users
-
Configuring Secure Sockets Layer (SSL) on your Web server
IMPORTANT: All of the step-by-step instructions that are included in this document were developed by using the Start menu that appears by default when you install your operating system. If you have modified your Start menu, the steps might differ slightly.
After you complete the steps in this document, your Web server will still have significant protection from the following types of attacks that sometimes threaten Internet-facing servers:
-
Profiling attacks that gather information about your Web site, which can be reduced by blocking unneeded ports and disabling unneeded protocols.
-
Denial-of-service attacks that flood your Web server with requests, which can be minimized by applying security patches and software updates.
-
Unauthorized access by a user without the correct permissions, which can often be thwarted by configuring Web and NTFS permissions.
-
Arbitrary execution of malicious code on your Web server, which can be minimized by preventing access to system tools and commands.
-
Elevation of privileges that allows a malicious user to use a high-privileged account to run programs, which can be minimized by using least-privileged service and user accounts.
-
Damage from viruses, worms, and Trojan horses, which can be contained by disabling unneeded functionality, using least-privileged accounts, and promptly applying the latest security patches.
Note: Because securing a Web server is a complex and ongoing process, complete security cannot be guaranteed.
Before You Begin
This section explains the system requirements and describes the characteristics of the example Web server used in this document.
System Requirements
The Web server used as an example in this document has the following system requirements:
-
The operating system is installed on an NTFS partition. For information about NTFS, search for "NTFS" in Help and Support Center for Windows Server 2003.
-
Required patches and updates for Windows 2000 Server or Windows XP have been applied to the server.
-
The server is running either Windows 2000 Server, with Service Pack 4 installed, or Windows XP, with Service Pack 1 installed.
IMPORTANT: If Service Pack 1 or Service Pack 4 is not installed on a particular computer or if you do not know whether it is installed, you can go to the Windows Update page on the Microsoft Web site at http://go.microsoft.com/fwlink/?LinkID=22630 and have Windows Update scan your computer for available updates. If Service Pack 1 or Service Pack 4 shows up as an available update, install any required service pack before proceeding with the procedures in this document.
The information in this document can help you take the first steps toward configuring a more secure Web server. However, to make your Web server as secure as possible, you need to understand the behavior of the applications that run on the server. This document does not contain information about configuring specific applications for security.
Web Server Characteristics
The Web server that is used as an example in this document has the following characteristics:
-
Is running either IIS 5.0 (for Windows 2000 Server) or IIS 5.1 (for Windows XP).
-
Hosts one Internet-facing Web site.
-
Is a dedicated Web server.
-
Is behind a firewall that allows traffic only on HTTP Port 80 and HTTPS Port 443.
-
Permits anonymous access to the Web site.
-
Serves HTML and ASP pages.
-
Does not support FTP (file uploading and downloading), SMTP (e-mail), or NNTP (newsgroup) protocols.
-
Does not use Internet Security and Acceleration Server.
-
Requires the administrator to log on locally to administer the Web server.
In addition to the preceding requirements, the following conditions in the example exist:
Reducing the Attack Surface of Your Web Server
Begin the process of securing your Web server by reducing its attack surface, for example, by enabling only those components, services, and ports that are necessary for your Web server to operate correctly.
This section provides the following step-by-step instructions for reducing the attack surface of your Web server:
Running the IIS Lockdown Tool
Using the IIS Lockdown Tool, you can choose a specific server role, depending on the types of applications that your Web server hosts, and then improve security for that server by using customized templates that either disable or secure various features.
By running the IIS Lockdown Tool, you can automate much of the process of securing your Web server. However, remember that no tool replaces the need for timely installation of service packs and hot fixes.
Note: It is recommended that you read the documentation that accompanies the IIS Lockdown Tool before you run the tool.
This section provides the following step-by-step instructions for running the IIS Lockdown Tool:
-
Installing the IIS Lockdown Tool
-
Determining whether your Web server serves dynamic content
-
Determining whether the IIS Lockdown Tool has already been run on your Web server
-
Running the IIS Lockdown Tool
Requirements
-
Credentials: You must be logged on as a member of the Administrators group on the Web server.
-
Tools: IIS Lockdown Tool, Internet Services Manager must be installed.
If you have already run the IIS Lockdown Tool on your Web server, skip the remaining procedures in this section and go on to the "Configuring UrlScan Configuration" section.
Note: It is recommended that you review the remaining sections of this document to ensure that the IIS Lockdown Tool settings on your Web server provide the level of security that you require.
Verifying New Settings
Verify that the appropriate security settings for the IIS Lockdown Tool have been applied to your local computer.
The following table shows the changes made by the IIS Lockdown Tool based on your changes, as well as the vulnerabilities minimized by locking down these items.
IIS Lockdown Tool Changes to Minimize Security Issues
|
Page
|
Action
|
Security Issues Minimized
|
|
Internet Services
|
Disabled FTP, SMTP, and NNTP services
|
Any running service is a potential point of attack.
These services are particularly vulnerable.
|
|
Script Maps
|
Disabled the following file extensions by mapping them to 404.dll: Indexing Service (.idq, .htw, .ida) Server-side includes (.shtml, .shtm, .stm) Internet Data Connector (.idc). HTR scripting (.htr)Internet printing (.printer)
|
idq, .ida: buffer overflow could allow an attacker to gain complete control of the server. htw: a user could inadvertently open an hostile link through a browser or HTML-compliant e-mail client. shtml, .shtm, .stm: ssiinc.dll security issue can return to the browser any attacker-specified content located on the Web server. idc: cross-site scripting security issue can return an entire URL in an error page, allowing attackers to run arbitrary script code at the server. htr: revelation of the source code of ASP files. printer: provide an attacker with a remote console on the target IIS system.
|
|
Additional Security
|
Removed the following virtual directories: IIS Samples MSADC IISHelp Scripts IISAdmin Printers directory for Internet printing
Removed the IISAdmin Web site
Restricted anonymous access to system tools
Restricted anonymous users from writing to Web content directories.
Created two new local groups called Web Anonymous Users and Web Applications, and added Deny access control entries (ACEs) for these groups to the access control list (ACL) on key tools and directories.
Added the default anonymous Internet user account, IUSR_ComputerName, to Web Anonymous Users.
Added the default Web application identity, IWAM_ComputerName, to Web Applications.
Disabled Web Distributed Authoring and Versioning (WebDAV). Installed the UrlScan ISAPI filter.
|
|
If the log files are absent, or if they are present and their data and time stamps are earlier than those for oblt-log.log, the IIS Lockdown Tool configuration is in force on the Web server.
After running the IIS Lockdown Tool, you can re-enable a file name extension manually. This is preferable to re-running the IIS Lockdown Tool and remove its configuration.
Customizing UrlScan Configuration
UrlScan is installed when you run the IIS Lockdown Tool. UrlScan is an Internet Services Application Programming Interface (ISAPI) filter that protects a Web server from attacks by filtering and rejecting HTTP requests based on a set of rules. The rules apply to all sites hosted by the Web server. When correctly installed, UrlScan runs automatically whenever IIS is started.
You can change UrlScan rules by editing the UrlScan.ini file. This file must reside in the same directory as the UrlScan.dll file, which is the file that runs UrlScan.
This section provides the following step-by-step instructions for customizing UrlScan configuration:
Requirements
-
Credentials: You must be logged on as a member of the Administrators group on the Web server.
-
Tools: My Computer, UrlScan.ini file, Notepad, iisreset command.
Verifying New Settings
Verify that the appropriate security settings for the UrlScan configuration have been applied to your local computer.
Disabling Unneeded Protocols
By preventing the use of unneeded protocols, you reduce the potential for attack.
This section provides the following step-by-step instructions for disabling unneeded protocols:
Disabling SMB and NetBIOS
Host enumeration attacks scan the network to determine the IP address of potential targets. To reduce the likelihood of successful host enumeration attacks against Internet-facing ports on your Web server, disable all network protocols except Transmission Control Protocol (TCP). Web servers do not require Server Message Block (SMB) or NetBIOS on their network adapters.
Note: When you disable SMB and NetBIOS, the server cannot function as a file server or a print server, no network browsing is possible, and you cannot manage the Web server remotely. If your server is a dedicated Web server that requires administrators to log on locally, these restrictions should not affect the operation of the server.
SMB uses the following ports:
NetBIOS uses the following ports:
-
TCP and User Datagram Protocol (UDP) port 137 (NetBIOS name service)
-
TCP and UDP port 138 (NetBIOS datagram service)
-
TCP and UDP port 139 (NetBIOS session service)
Disabling only NetBIOS is not sufficient to prevent SMB communication because if a standard NetBIOS port is unavailable, SMB uses TCP port 445 (known as the SMB Direct Host). You must disable NetBIOS and SMB separately.
Requirements
-
Credentials: You must be logged on as a member of the Administrators group on the Web server.
-
Tools: My Computer, System Tools, Device Manager.
Verifying New Settings
Verify that the appropriate security settings have been applied to your Web server.
Disabling Null Sessions to Prevent Anonymous Logons
To prevent anonymous access, disable null sessions. These are unauthenticated or anonymous sessions established between two computers. If null sessions are not disabled, an attacker can connect to your server anonymously without being authenticated.
An attacker who establishes a null session can perform a variety of attacks, including enumeration techniques, which are used to collect system-related information from the target computer ? information that can greatly assist subsequent attacks. Information that can be returned over a null session includes domain and trust details, shares, user information (including groups and user rights), and registry keys.
Requirements
-
To disable null sessions
-
Click Start, click Programs, click Administrative Tools, and then click Local Security Policy.
-
Under Security Settings, double-click Local Policies, and then click Security Options.
-
Double-click Additional restrictions for anonymous connections, and then select No access without explicit anonymous permissions under Local policy setting.
-
Restart the Web server for the change to take effect.
Verifying New Settings
Verify that the appropriate security settings for disabling null sessions have been applied to your local computer.
Configuring Accounts
You should remove unused accounts because an attacker might discover and use them. Always require strong passwords ? weak passwords increase the likelihood of a successful brute force or dictionary attack. Use accounts that run with least privilege. Otherwise, an attacker can use accounts with too much privilege to gain access to unauthorized resources.
This section provides the following step-by-step instructions for configuring accounts:
Disabling Unused Accounts
Unused accounts and their privileges can be used by an attacker to gain access to a server. You should periodically audit local accounts on the server and disable any accounts that are not being used. Disable accounts on a test server before you disable them on a production server to ensure that disabling an account does not adversely affect the way your application operates. If disabling the account does not cause any problems on the test server, disable the account on your production server.
Note: If you choose to delete an unused account instead of disabling it, be aware that you cannot recover a deleted account and that the Administrator account and the Guest account cannot be deleted. Also, be sure to delete the account on a test server before you delete it on your production server.
This section provides the following step-by-step instructions for disabling unused accounts:
-
Disabling the Guest account
-
Renaming the Administrator account
-
Disabling the IUSR_ComputerName account
Disabling the Guest Account
Anonymous connections to the server use the built-in Guest account. To restrict anonymous connections to the computer, keep this account disabled. The Guest account is disabled by default on Windows 2000.
Note: You cannot disable the Guest account on a domain controller.
Requirements
Renaming the Administrator Account
The default local Administrator account is a target for malicious use because of its elevated privileges on the computer. To improve security, rename the default Administrator account and assign it a strong password.
Note: You cannot rename the local Administrator account on a domain controller.
Requirements
Renaming the IUSR_ComputerName Account
The default anonymous Internet user account, IUSR_ComputerName, is created during IIS installation. The value of ComputerName is the NetBIOS name of your server at IIS installation time.
Requirements
Verifying New Settings
Verify that the appropriate security settings have been applied to your local computer.
Securing Files and Directories
Use strong access controls to protect sensitive files and directories. In most situations, an approach that allows access to specific accounts is more effective than one that denies access to specific accounts. Set access at the directory level whenever possible. As files are added to the folder they inherit permissions from the folder, so you need to take no further action.
This section provides the following step-by-step instructions for securing files and directories:
Relocating and Setting Permissions for IIS Log Files
To increase the security of the IIS log files, you should relocate them to a nonsystem drive that has been formatted to use the NTFS file system. This location should not be the same as the location of your Web site content.
This section provides the following step-by-step instructions for relocation and setting permissions for IIS log files:
Requirements
-
Credentials: You must be logged on as a member of the Administrators group on the Web server.
-
Tools: My Computer, Internet Services Manager.
Note: If you already have IIS log files in their original location at C:\WINNT\System32\logfiles, you must move these files to the new location manually. IIS does not move those files for you.
Verifying New Settings
Verify that the appropriate security settings have been applied to your local computer.
Configuring IIS Metabase Permissions
The IIS metabase is a binary file that contains most IIS configuration information. Only members of the Administrators group and the LocalSystem account should have Full Control access to the metabase. It is important that you audit all attempts to access the metabase by the Everyone group.
This section provides the following step-by-step instructions for configuring IIS metabase permissions:
-
Restricting access to the MetaBase.bin file
-
Auditing access to the MetaBase.bin file
-
Disabling the FileSystemObject component
Requirements
Verifying New Settings
Verify that the appropriate security settings for auditing and restricting access to the MetaBase.bin file have been applied to your local computer.
Disabling the FileSystemObject Component
ASP, Windows Script Host, and other scripting applications use the FileSystemObject (FSO) component to create, delete, gain information about, and manipulate drives, folders, and files. Consider disabling the FSO component, but be aware that this will also remove the Dictionary object. Also, verify that no other programs require this component.
Requirements
Securing Web Sites and Virtual Directories
Relocate Web root directories and virtual directories to a nonsystem partition to protect against directory traversal attacks, which allow an attacker to execute operating system programs and tools. Because it is not possible to traverse across drives, relocating Web site content to another drive offers added protection against these attacks.
This section provides the following step-by-step instructions for securing Web sites and virtual directories:
-
Moving your Web site to a nonsystem drive
-
Disabling the parent paths setting
-
Configuring Web site permissions
Moving Your Web Site to a Nonsystem Drive
Do not use the default \inetpub\wwwroot directory as the location for your Web site content. For example, if your system is installed on the C: drive, consider moving your site and content directory to the D: drive in order to mitigate the risks associated with directory traversal attacks, in which an attacker attempts to browse the directory structure of a Web server.
Requirements
-
Credentials: You must be logged on as a member of the Administrators group on the Web server.
-
Tools: Internet Services Manager, command prompt.
Verifying New Settings
Verify that the appropriate security settings have been applied to your local computer.
Disabling the Parent Paths Setting
This IIS metabase setting prevents the use of parent paths in script and application calls. Disabling parent paths helps guard against directory traversal attacks. The following example shows a parent path in an ASP file:
<!--#include file="../<filename.ext>"-->
When parent paths are disabled, the ASP file should contain path statements in the following format:
<!--#include virtual="/<virtual path>/<filename.ext>"-->
where <virtual path> is the name of the virtual directory where the file resides on your Web server.
Requirements
-
To disable parent paths
-
Click Start, click Programs, click Administrative Tools, and then click Internet Services Manager.
-
Right-click the root of your Web site, and then click Properties.
-
Click the Home Directory tab, and then click Configuration.
-
Click the App Options tab, and then clear the Enable parent paths check box.
Verifying New Settings
Verify that the appropriate security settings have been applied to your local computer.
Configuring Web Site Permissions
You can configure your Web server's access permissions for specific sites, directories, and files. These permissions apply to all users regardless of their specific access rights.
Configuring Permissions on File System Directories
Internet Information Services relies on NTFS permissions for securing individual files and directories from unauthorized access. Unlike Web site permissions, which apply to all users, you can use NTFS permissions to precisely define which users can access your content and how those users are allowed to manipulate that content.
Access control lists (ACLs) indicate which users or groups have permission to access or modify a particular file. Instead of setting ACLs on each file, consider creating new directories for each file type, setting ACLs on each directory, and allowing the ACLs to inherit to the files.
Requirements
Configuring Permissions on Virtual Directories
Most users do not require access to all content on your Web server. To protect the content on your Web server, you must configure appropriate access permissions on your Web server's virtual directories.
Verifying New Settings
Verify that the appropriate security settings have been applied to your local computer.
Configuring Secure Sockets Layer on Your Web Server
Configure Secure Sockets Layer (SSL) security features on your Web server to verify the integrity of your content, verify the identity of users, and encrypt network transmissions. SSL security relies on a server certificate that allows users to authenticate your Web site before they transmit personal information, such as a credit card number.
This section provides the following step-by-step instructions for configuring SSL on your Web server:
Obtaining and Installing a Server Certificate
Certificates are issued by non-Microsoft organizations called certification authorities (CAs). The server certificate is typically associated with your Web server, specifically with the Web site where you have configured SSL. You must generate a request for a certificate, send the request to the CA, and then install the certificate after you receive it from the CA.
Certificates require a pair of encryption keys, one public and one private, to enforce security. When you generate a request for a server certificate, you actually generate the private key. The server certificate you receive from the CA contains the public key.
Requirements
-
Credentials: You must be logged on as a member of the Administrators group on the Web server.
-
Tools: Internet Services Manager, Web Server Certificate Wizard.
When you receive the certificate from your CA, you are ready to install the certificate on your Web server.
Verifying New Settings
Verify that the appropriate security settings have been applied to your local computer.
Enabling and Enforcing SSL Connections on Your Web Server
After you have installed the server certificate, you must enable SSL connections on your Web server. Then, you must enforce SSL connections.
Requirements
Verifying New Settings
Verify that the appropriate security settings have been applied to your local computer.
Related Information
For more information about securing IIS 5.0 and IIS 5.1, see the following:
For more information about IIS 5.0 and IIS 5.1, see the following: