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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

824 <strong>Improving</strong> <strong>Web</strong> <strong>Application</strong> <strong>Security</strong>: <strong>Threats</strong> <strong>and</strong> CountermeasuresBefore You BeginBefore you begin to use code access security policy to constrain an assembly, youshould be aware of the following:● To constrain a <strong>Web</strong> application so that it is only able to access files within its ownvirtual directory hierarchy, you can configure the application to run with mediumtrust by placing the following in <strong>Web</strong>.config:This uses ASP.NET code access security policy to constrain the ability of the <strong>Web</strong>application to perform file I/O <strong>and</strong> it also imposes other constraints. For example,a medium trust application cannot directly access the event log, registry, or OLEDB data sources.● ASP.NET code access security policy is configured independently from enterpriselevel,machine-level, <strong>and</strong> user-level code access security policy. The.NETFramework version 1.1 Configuration tool only supports enterprise-level,machine-level, <strong>and</strong> user-level policy.You must maintain ASP.NET policy by using a text or XML editor. For moreinformation about running <strong>Web</strong> applications using medium trust, see Chapter 9,“Using Code Access <strong>Security</strong> with ASP.NET.”● When you build an assembly, you can impose constraints programmatically usingcode access security. For more information about how to do this, see Chapter 8,“Code Access <strong>Security</strong> in Practice.”● You should generally avoid building <strong>Web</strong> applications that accept file names <strong>and</strong>paths from the user because of the security risks posed by canonicalization issues.On occasion, you might need to accept a file name as input. This How To showsyou how you can constrain an assembly to ensure that it cannot access arbitraryparts of the file system. For more information about performing file I/O, see“File I/O” sections in Chapter 7, “Building Secure Assemblies” <strong>and</strong> Chapter 8,“Using Code Access <strong>Security</strong> in Practice,” of <strong>Improving</strong> <strong>Web</strong> <strong>Application</strong> <strong>Security</strong>.● For more information about code access security fundamentals, see Chapter 8,“Code Access <strong>Security</strong> in Practice,” of <strong>Improving</strong> <strong>Web</strong> <strong>Application</strong> <strong>Security</strong>.

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

Saved successfully!

Ooh no, something went wrong!