IIS 6.0 Security by Rohyt Belani and Michael Muckin Last Updated March 5, 2004
script>
The popularity of web servers as a prime target for crackers and worm writers around the globe made IIS a natural place for Microsoft to focus its Trustworthy Computing Initiative. As a result, IIS has been completely redesigned to be secure by default and secure by design. This article discusses the major default configuration and design changes incorporated in IIS 6.0 to make it a more secure platform for hosting critical web applications. Secure by DefaultIn the past, vendors including Microsoft packaged the default installations of their web servers with an array of sample scripts , file handlers and minimal file-system permissions to provide administrators the necessary flexibility and ease of use. However, this approach tended to increase the available attack surface and was the basis of several attacks against IIS. As a result, IIS 6.0 is designed to Be More Secure Out-of-The-Box Than ITS Precursors. The Most Noticeable Change IS That IIS 6.0 is Not Installed by Default with Wind OWS Server 2003. Other Changes Include:
Default installation is only a static HTTP server The default installation of IIS 6.0 is configured to serve static HTML pages only; dynamic content is not permitted The following table compares the default features of IIS 5.0 and IIS 6.0..
IIS ComponentIIS 5.0 default installIIS 6.0 default installStatic file supportEnabledEnabledASPEnabledDisabledServer-side includesEnabledDisabledInternet Data ConnectorEnabledDisabledWebDAVEnabledDisabledIndex Server ISAPIEnabledDisabledInternet Printing ISAPIEnabledDisabledCGIEnabledDisabledMicrosoft FrontPage? Server extensionsEnabledDisabledPassword change interfaceEnabledDisabledSMTPEnabledDisabledFTPEnabledDisabledASP.NETN / ADisabledBackground Intelligence Transfer ServiceN / ADisabled No sample applications installed IIS 6.0 does not include any sample scripts and applications like showcode .asp and codebrws.asp. These programs were originally designed to let programmers quickly look at their database connection code in order to debug it. However, Showcode.asp and codebrws.asp do not correctly check the input to ensure that the file being requested IS WITHIN THE Web Root Directory. this allows the attacker to read any file (include "and insigh tful configuration settings) on the system by traversing back to it Refer to the following link for more information regarding these vulnerabilities:. http://www.microsoft.com/technet/treeview/default.asp?url=/technet/security/ bulletin / MS99-013.asp Improved file-system access controls Anonymous users no longer have write access to the home directory of the Web server. in addition, FTP users are isolated in their own home directories. These limitations prevent a user from uploading malicious FILES TO Other Parts of The Server '
s file system. Such attacks may include web site defacement by uploading files to the web document root and remote command execution via the execution of malicious executables that may be uploaded to the / scripts directory. No Executable Virtual Directories No virtual directories have executable permissions on them. This prevents exploitation of the numerous directory traversal, code upload and MDAC exploits that have existed in the past. Sub-authentication module removed The IISSUBA.dll from IIS 6.0 has been removed. Any accounts that required this functionality in previous versions of IIS required the "access this computer from the network" privilege. Removal of this DLL removes this dependency and thus reduces the attack surface by forcing all authentications directly to the SAM or Active Directory. parent Paths are disabled Access to parent paths in the file system is Disabled by default. this is to prevent Directory Traversal Attacks That May Allow An Attacker To Break Out of T he web document root and gain access to sensitive files on the file system, such as the SAM file. Note that this can however cause problems for migrated applications that used parent paths on previous versions of IIS. Secure by DesignThe fundamental design changes incorporated in IIS 6.0 include improved data validation, enhanced logging, rapid-fail protection, application isolation and adherence to the principle of least privilege. Improved data validationA principal new feature incorporated in the design of IIS 6.0 is the kernel-mode HTTP driver, HTTP.sys. IT is not only tuned to enhance the web server '
s performance and scalability characteristics, but also to significantly strengthen the security posture of the server. HTTP.sys acts as the gateway for user requests to the web server. It first parses the request and then dispatches it to the appropriate user-level worker processes . The restriction of the worker processes to the user-mode prevents them from accessing privileged resources in the system kernel. Thus the target space of an attacker intending to gain privileged access to the server is greatly limited. The kernel-mode driver incorporates several security mechanisms to augment the inherent secure design of IIS 6.0. These features include protection against potential buffer overflows, improved logging mechanisms to aid the process of incident response and advanced URL parsing to check for the validity of user requests. In order to impede the exploitation of A potential buffer or memory overflow Vulnerability That May Arise At a Later Point in Time, Microsoft Has Resorted To the defense-in-depth principle of security in the design of IIS 6.0. This has been accomplished by adding specific URL parsing capabilities to the repertoire of features incorporated in HTTP.sys. These capabilities can be further fine-tuned by appropriately modifying specific registry Values. The Following Table Provides A Brief Overview of Vital Registry Keys (Found At the Following Path: HKLM / System / CurrentControlSet / Services / http / parameters):
AllowRestrictedCharsThis key accepts a Boolean value, which if non-zero allows HTTP.sys to accept hex-encoded characters in the request URL. The default value for this key is 0. This is also the recommended value as it facilitates the task of input validation at the server-level. If set to 1, potentially malicious characters may be hex-encoded by the attacker in an attempt to bypass input validation routines.MaxFieldLengthThis key allows the administrator to set an upper limit (in bytes) for each header. Its default value is 16KB.MaxRequestBytesThis key establishes the upper limit on the total size of the request line and the headers. Its default value is also 16KB.UrlSegmentMaxCountThis key determines the maximum number of URL path segments accepted by the server. It effectively limits the number Of slashes That Can Be Included by The User In a Request Url.it is Recommended That One Set Fairly Stringent Limits On this value based on the depth of the Web Document Root Tree to Protect T he server from a file system traversal attack. The default value for this key is 255.UrlSegmentMaxLengthThis key sets an upper bound on the maximum number of characters in any URL path segment. This value can also be customized in accordance with the normal operation of the hosted applications to prevent the acceptance of unusually long segments that may cause the application to behave in an anomalistic manner. The default value for this key is 260.EnableNonUTF8The value of this key controls the character set that is permitted by HTTP.sys. The default Value of 1 permits http.sys to accept ansi- and dbcs-encoded URLS in addition to those encoded in the utf8 format.
Enhanced logging mechanismsComprehensive logging is a fundamental requirement for the successful detection of, and response to, a security incident. Microsoft has recognized this need and implemented an extensive and reliable logging mechanism in HTTP.sys. HTTP.sys writes to the log file before dispatching the request to the specific worker process. This ensures that an error condition is logged even if it causes the worker process to terminate. An entry in the log file consists of the date and time stamp of the occurrence of the error condition, the source and . destination IP addresses and ports, the protocol version, HTTP verb, the URL, protocol status, the site ID and the HTTP.sys reason phrase The reason phrase provides detailed information about why the error occurred - whether it can be attributed to a timeout Condition or a connection being abandoned by the application pool Due to the Unexpected Termination of the worker process. An example log file entry can be found t the following link: http://www.microsoft.com/technet/treeview/default.asp?url=/technet/prodtechnol/iis/iis6/proddocs/resguide/iisrg_log_qlow.asp Rapid-Fail ProtectionIn addition to tweaking the registry , an IIS 6.0 administrator can also configure the server to automatically shutdown or restart orker processes whose applications have failed repeatedly (a set number of times) within a specific period of time. This is an additional safeguard to protect the application against repeated failures, which May Be An Indication Of Attack. This Feature IS Called Rapid-Fail Protection. Rapid-Fail Protection Can Be Configured Through Iis Manager As Follows:
In IIS Manager, expand local computer. Expand Application Pools Right click on application pool Click on Properties On the Health tab, check the Enable rapid-fail protection box In the Failures box, type the number of worker process failures to be tolerated (before shutting down the process). In the Time Period box, specify the number of minutes for which worker process failures are allowed to accumulate. Application isolationIn previous versions of IIS (version 5.0 and earlier), the performance penalty for segregating web applications into independent units made it infeasible to do so. Thus, more often that not the failure or compromise of one web application had a cascading effect to the other applications resident on the same web server. However, performance enhancements coupled with design changes to the request processing architecture of IIS 6.0 Have Made It Viable To Isolate Applications Into Self-Contained Units Called Application Pools (WITHOUT AFFECTING Performance). Each App lication pool is served by one or more independent worker processes. This allows for the localization of failure, preventing the malfunction of one worker process from affecting the others. This boosts the reliability of the server and in turn that of the applications hosted by it. Adherence to principle of least privilege IIS 6.0 adheres to a fundamental tenet of security - the principle of least privilege This is achieved by including all the code that needs to run with Local System (high-level) privileges in HTTP.sys All the.. Worker Processes Execute As Network Service, A New Type of Account Built-in to Windows 2003 with extremely limited Operating System Rights.