11.07.2015 Views

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 19: Securing Your ASP.NET <strong>Application</strong> <strong>and</strong> <strong>Web</strong> Services 581UNC SharesThere are two main ways that your ASP.NET application might use UNC shares:● Accessing files on UNC sharesFor example, your application must access a remote file such as\\remoteserver\share\somefile.dat.● Hosting applications on UNC sharesYour application’s IIS virtual directory is mapped to a remote share, for example,\\remoteserver\appname. In this scenario, HTTP requests are processed by your<strong>Web</strong> server, but the application’s pages, resources, <strong>and</strong> private assemblies arelocated on the remote share.Accessing Files on UNC SharesIf your application accesses files on a UNC share, the ASP.NET process account orany impersonation identities must have the appropriate access rights defined by theACL on the share <strong>and</strong> on the underlying directory or file.If you use the local ASPNET process account, this does not have a network identity,so you must create a mirrored account on the remote server with a matching username <strong>and</strong> password, or you must use a least privileged domain account that hasaccess to both servers. On Windows Server 2003, the NetworkService account that isused to run ASP.NET <strong>Web</strong> applications can be authenticated over the network, so allyou need to do is grant access rights to the machine account.Hosting <strong>Application</strong>s on UNC SharesYou can use IIS to configure a virtual directory to point to a UNC share located onanother computer, for example \\remoteserver\appname. When you do so, IISprompts you to supply account credentials, which it uses to establish a connection tothe remote computer.Note The account credentials are stored in encrypted format in the IIS metabase but are availablethrough an API. You should ensure that you use a least privileged account. For more information, seeMicrosoft Knowledge Base article 280383, “IIS <strong>Security</strong> Recommendations When You Use a UNCShare <strong>and</strong> Username <strong>and</strong> Password Credentials.”If your application resides on a UNC share, ASP.NET impersonates the IIS-providedUNC token (created from the account credentials that you supplied to IIS) to accessthat share, unless you have enabled impersonation <strong>and</strong> have used a fixedimpersonation identity, as shown with the following configuration:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!