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.

582 Part IV: Securing Your Network, Host, <strong>and</strong> <strong>Application</strong>If a fixed impersonation account is provided through the userName <strong>and</strong> passwordattributes, ASP.NET uses that account instead of the IIS UNC token to access theshare. Any resource access performed by your application also uses the fixedimpersonation account.Note In the above example, Aspnet_setreg.exe has been used to store the encrypted accountcredentials in the registry.If you enable impersonation of the original caller (IIS authenticated identity) by usingthe following configuration, ASP.NET still uses the UNC-provided token to accessyour application’s files on the share, although any resource access performed by yourapplication uses the impersonation token.Note The account used for the UNC share must also be able to read Machine.config.Code Access <strong>Security</strong> Considerations<strong>Application</strong>s on a UNC share are granted the intranet permission set by code accesssecurity policy. The intranet permission set does not containAspNetHostingPermission, which ASP.NET <strong>Web</strong> applications require to run, so yourapplication will not run without explicit policy modifications.You have two options:● Grant full trust to the UNC share on which your application is hosted.This is the simplest option to manage <strong>and</strong> if you run .NET Framework version 1.0,this is the only option because ASP.NET version 1.0 <strong>Web</strong> applications require fulltrust.● Configure code access security policy to grant your code theAspNetHostingPermission <strong>and</strong> any other permission it might require based onthe types of resources it accesses <strong>and</strong> the operations it performs.Because of the way in which ASP.NET dynamically creates code <strong>and</strong> compilespage classes, you must use a code group for the UNC <strong>and</strong> the Temporary ASP.NETFiles directory when you configure policy. The default temporary directory is\WINNT\Microsoft.NET\Framework\{version}\Temporary ASP.NET Files, butthe location is configurable on a per application basis by using the tempDirectoryattribute of the element.For more information about ASP.NET code access security policy <strong>and</strong> s<strong>and</strong>boxingprivileged code, see Chapter 9, “Using Code Access <strong>Security</strong> with ASP.NET.”Note When configuring policy, you should grant trust to the share (by using a file location) ratherthan to the zone. This provides finer granularity because you do not affect all the applications ina particular zone.

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

Saved successfully!

Ooh no, something went wrong!