Microsoft Knowledge Base Email Alertz

KBAlertz.com: How to configure uploads for IIS Web applications

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]

Search KbAlertz

Advanced Search

Webmasters
Put kbAlertz on your website.
[ Click Here for more! ]





ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
KBAlertz referrals get
** SIX MONTHS FREE **


Community Site



We Send hundreds of thousands of emails using ASP.NET Email


ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
KBAlertz referrals get
** SIX MONTHS FREE **




Mentioned In








Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks




Article ID: 979124 - Last Review: January 5, 2010 - Revision: 2.1

How to configure uploads for IIS Web applications

On This Page

INTRODUCTION

This article describes how to configure Internet Information Services (IIS) to allow more-secure file uploads through a Web application. Many Web applications such as Content Management Systems require supporting file uploads to the Web server that uses the Web application. Allowing files to be uploaded to the Web server that uses the Web application has security ramifications for the server, and you must understand all the implications for allowing this. This article guides you through securing your Web application uploads through IIS configuration. If your Web application has an automated installer, you can also incorporate the configuration in this article into your installer.

Note Some Web applications use databases to manage uploaded content. However, this article focuses on applications that use the file system.

MORE INFORMATION

Create a separate folder for your uploaded content and change the NTFS file permissions on the upload folder

By doing this, you can configure the behavior of uploaded content differently from the rest of your Web application. Grant the upload folder Read and Write permissions for the IIS worker process identity. For IIS 6.0 in Windows Server 2003, you can use the IIS_WPG user group for this. For IIS 7.0 and later, you can use the IIS_IUSRS user group.

For more information about IIS_WPG, visit the following Microsoft Web page:
Configuring Application Pool Identity in IIS 6.0 (http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/12a3d96c-65ea-4210-96ad-86a801f6a88c.mspx?mfr=true)
For more information about IIS_ISURS, visit the following Microsoft Web page:
Understanding the Built-In User and Group Accounts in IIS 7.0 (http://learn.iis.net/page.aspx/140/understanding-the-built-in-user-and-group-accounts-in-iis-70/)
For more information about how to help secure files with NTFS permissions, visit the following Microsoft Web page:
Securing Files with NTFS Permissions (http://technet.microsoft.com/en-us/library/cc757422(WS.10).aspx)
Note In some cases, such as when impersonation is used, you would need to give Write access for the authenticated user context as well.

Disallow Script Permissions on the upload folder

Uploaded content for most Web applications are static content, such as images and documents. Uploaded content is not meant to be content that can be run, such as scripts or executable files. Therefore, it is important not to grant Script Permissions on this folder. Otherwise, users who can upload content can execute scripts in the context of your worker process identity on the server. If your Web application has logic to restrict uploads by file name extensions, you should use this restriction as a secondary measure. You should still make sure that your application’s upload directory has script permissions disabled.

To disable script permissions in IIS Manager User Interface (inetmgr) in IIS 5.x and 6.0, follow these steps:
  1. Click Start, and then click Run.
  2. Type inetmgr in the Open box, and then click OK.
  3. In the tree view in the navigation pane, select the path of the upload directory of your Web application.
  4. Right-click this path, and then click Properties.
  5. Click the Directory tab, and then select None in the Execute Permissions list.
For more information about how to how to set IIS permissions for specific objects, click the following article number to view the article in the Microsoft Knowledge Base:
324068  (http://kbalertz.com/Feedback.aspx?kbNumber=324068/ ) How to set IIS permissions for specific objects
Alternatively, you can disable script permissions by using metabase configuration in IIS 6.0 by setting AccessFlags property’s AccessScript flag to False at the upload directory level. For more information and for sample scripts that can be changed for this use, visit the following Microsoft Web page:
AccessFlags Metabase Property (IIS 6.0) (http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/e9b6d626-9583-4d59-b7f7-a079ec47461c.mspx?mfr=true)
To disable script permissions in configuration for IIS 7.0 and later versions, you have to set the accessPolicy flag on the handlers section not to have the Script value.

For more information about how to do this in IIS 7.0 and later versions, visit the following Microsoft Web page:
Configure Request Restrictions for a Handler Mapping (http://technet.microsoft.com/en-us/library/cc730969(WS.10).aspx)
Note Make sure that you read the Script value for the access flags.

For more information about how to set permissions, visit the following Microsoft Web page:
Securing Sites with Web Site Permissions (http://technet.microsoft.com/en-us/library/cc756133(WS.10).aspx)

The Web application should restrict uploads to authenticated and authorized users only

This gives the server administrator the ability to audit uploads through the Web application. In the case a user is trying malicious activity, it gives the server administrator an easy mechanism to keep the application functional while blocking out users who are trying malicious activity. When users can upload scripts and execute them through the Web application, authentication should be required and the IIS application pool identity hosting the Web application should not be an Administrative account.

For more information about how to configure application pool identities, visit the following Microsoft Web pages:
Configuring Worker Process Identities (for IIS 6.0) (http://technet.microsoft.com/en-us/library/cc784505(WS.10).aspx)
Specify and Identity for an Application Pool (for IIS 7.0 and later versions) (http://technet.microsoft.com/en-us/library/cc771170(WS.10).aspx)

Follow security best practices for your Web application

It is important to follow security best practices for all parts of your Web application and not just the upload logic. For more information about best practices, visit the following Microsoft Web pages:
Securing IIS 5.0 Resource Guide (http://technet.microsoft.com/en-us/library/cc750568.aspx)
IIS 6.0 Security Best Practices (http://technet.microsoft.com/en-us/library/cc782762(WS.10).aspx)
Configuring Security for IIS 7.0 (http://learn.iis.net/page.aspx/88/configuring-security/)

APPLIES TO
  • Microsoft Internet Information Services 7.5, when used with:
    • Windows 7 Enterprise
    • Windows 7 Home Basic
    • Windows 7 Home Premium
    • Windows 7 Professional
    • Windows 7 Ultimate
    • Windows Server 2008 R2 Standard
    • Windows Server 2008 R2 Enterprise
    • Windows Server 2008 R2 Datacenter
  • Microsoft Internet Information Services 7.0, when used with:
    • Windows Vista Business
    • Windows Vista Enterprise
    • Windows Vista Home Basic
    • Windows Vista Home Premium
    • Windows Vista Ultimate
    • Windows Vista Enterprise 64-bit Edition
    • Windows Vista Home Basic 64-bit Edition
    • Windows Vista Home Premium 64-bit Edition
    • Windows Vista Ultimate 64-bit Edition
    • Windows Vista Business 64-bit Edition
  • Microsoft Internet Information Services 6.0, when used with:
    • Microsoft Windows Server 2003, Standard Edition (32-bit x86)
    • Microsoft Windows Server 2003, Enterprise Edition (32-bit x86)
    • Microsoft Windows Server 2003, Datacenter Edition (32-bit x86)
    • Microsoft Windows Server 2003, Web Edition
    • Microsoft Windows Server 2003, Datacenter x64 Edition
    • Microsoft Windows Server 2003, Enterprise x64 Edition
    • Microsoft Windows Server 2003, Standard x64 Edition
    • Microsoft Windows XP Professional x64 Edition
    • Microsoft Windows Server 2003, Datacenter Edition for Itanium-Based Systems
    • Microsoft Windows Server 2003, Enterprise Edition for Itanium-based Systems
  • Microsoft Internet Information Services 5.1, when used with:
    • Microsoft Windows XP Professional
  • Microsoft Internet Information Services 5.0, when used with:
    • Microsoft Windows 2000 Advanced Server
    • Microsoft Windows 2000 Datacenter Server
    • Microsoft Windows 2000 Professional Edition
    • Microsoft Windows 2000 Server
Keywords: 
kbhowto kbexpertiseinter kbsecurity kbsecvulnerability kbsurveynew KB979124
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate

Be the first to leave feedback, to help others about this knowledge base article.

(Optional) Name

(Optional) Public URL Or Email

Comments
No HTML -- Text Only Please