Microsoft KB Archive/815144

= HOW TO: Audit the Security of an ASP.NET Web Application or Web Service =

Article ID: 815144

Article Last Modified on 4/30/2003

-

APPLIES TO


 * Microsoft ASP.NET 1.0
 * Microsoft ASP.NET 1.1

-



IN THIS TASK

 * SUMMARY
 * .NET Framework Configuration Items
 * File Permissions
 * IIS Configuration Items
 * SQL Server Configuration Items
 * REFERENCES



SUMMARY
This step-by-step article describes how to audit the security of an ASP.NET Web Application or an ASP.NET Web Service.

The security of a system decreases as new elements are added to the system’s ideal configuration. New application installations, software updates, temporary configuration changes, and troubleshooting change aspects of a system’s security configuration. Whether intentional or unintentional, these changes may cause the system to no longer meet security requirements. To reduce this effect, perform regular audits of the system security configuration. Document and evaluate any changes to the security configuration that have been introduced to the system. When necessary, reverse these changes.

This article describes the key configuration settings that affect an ASP.NET application. Document these settings when you first configure your system in its clean state. Perform regular audits to compare the current settings against the original settings. These audits help you to prevent the system’s security from degrading over time. This article does not describe how to configure these settings.

For additional information about auditing security configuration items that are related to .NET Framework applications and are not ASP.NET, click the following article number to view the article in the Microsoft Knowledge Base:

815143 HOW TO: Audit the Security of a .NET Framework Configuration

back to the top

.NET Framework Configuration Items
The .NET Framework uses a hierarchy of files to determine the policy that is applied to an application. The following file contains the default configuration settings:

\ \Microsoft.NET\Framework\ \CONFIG\Machine.config

These settings may be overridden in the application’s root folder (or any subfolder) by a file named Web.config or .config. You must audit all these files to accurately assess an application’s security configuration. The following are the important elements of the config file:
 * (specifically, the enabled attribute and the localOnly attribute)
 * 
 * 
 * (and any elements that are contained in it)
 * 
 * 
 * 
 *  (specifically the enable attribute, the username attribute, and the password attribute)
 * configuration element in the  element
 *  (specifically the enable attribute, the username attribute, and the password attribute)
 * configuration element in the  element

back to the top

File Permissions
Include the NTFS file permissions that are associated with ASP.NET files and folders in your audit. These may be inherited from the parent folders, or they may be defined uniquely for each file.

To easily audit the file permissions for a large number of files, use the Cacls.exe command-line utility to write the permissions to a text file. Each time that you perform an audit, compare this text file to the file that you created when the system was clean, and then note any changes.

To write all file permissions that are associated with the C:\inetpub\wwwroot\ folder and all subfolders to a file named Output.txt, run the following command at a command prompt:

CACLS C:\inetpub\wwwroot\* /T > output.txt

back to the top

IIS Configuration Items
Windows 2000 systems support ASP.NET applications by using Internet Information Services (IIS) 5.0. When you install the .NET Framework, IIS is automatically configured to support ASP.NET. Audit the following settings in IIS regularly:  Application mappings

To view application mappings settings, follow these steps:  Click Start, point to Settings, and then click Control Panel. Double-click Administrative Tools, and then double-click Internet Services Manager.</li> Right-click the virtual server or the virtual folder that contains your ASP.NET application, and then click Properties.</li> Click the Home Directory tab (or the Directory tab).</li> Under Application Settings, click Configuration.</li> Note the file name extensions that are mapped to the Aspnet_isapi.dll file.</li></ol> </li> Execute permissions

To view the execute permissions settings, follow these steps: <ol style="list-style-type: lower-alpha;"> Click Start, point to Settings, and then click Control Panel.</li> Double-click Administrative Tools, and then double-click Internet Services Manager.</li> Right-click the virtual server or the virtual folder that contains your ASP.NET application, and then click Properties.</li> Click the Home Directory tab (or the Directory tab).</li> Note whether the Script Source Access, Read, Write and Directory Browsing check boxes are selected. Also note the Execute Permissions setting.</li></ol> </li></ul>

back to the top

SQL Server Configuration Items
Microsoft SQL Server contains its own security mechanisms that function separately from the .NET Framework configuration, IIS, and NTFS file permissions. Overly permissive SQL Server rights might create a vulnerability in an ASP.NET application that might be used to compromise private data. You can view all aspects of the security configuration for SQL Server as it relates to ASP.NET access by using the SQL Enterprise Manager.

Audit SQL Server Configuration Items
<ol> Click Start, point to Programs, point to Microsoft SQL Server, and then click SQL Enterprise Manager.</li> Expand your database server, expand Security, and then click Logins.</li> If the ASPNET user account exists, right-click ASPNET, and then click Properties.</li> In SQL Server Login Properties, click the Database Access tab.</li> Note the databases and the roles where the account has been granted access permissions.</li> <li>For each database where the ASPNET account has access permissions, do the following: <ol style="list-style-type: lower-alpha;"> <li>Expand the database, and then click Users.</li> <li>Right-click ASPNET, and then click Properties.</li> <li>In Database User Properties, click Permissions, and then note the permissions that the ASPNET user has on all tables and views.</li></ol> </li></ol>

back to the top

<div class="references_section">