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 561Partition Your <strong>Web</strong> SiteSeparate the public <strong>and</strong> restricted access areas of your <strong>Web</strong> site. Place yourapplication’s logon page <strong>and</strong> other pages <strong>and</strong> resources that should only be accessedby authentication users in a separate folder from the public access areas. Protect therestricted subfolders by configuring them in IIS to require SSL access, <strong>and</strong> then use elements to restrict access <strong>and</strong> force a login. For example, thefollowing <strong>Web</strong>.config configuration allows anyone to access the current directory(this provides public access), but prevents unauthenticated users from accessing therestricted sub folder. Any attempt to do so forces a Forms login.For additional programmatic considerations, such as how to navigate betweenrestricted <strong>and</strong> non-restricted pages, see “Forms Authentication” in Chapter 10,“Building ASP.NET <strong>Web</strong> Pages <strong>and</strong> Controls.”Set Protection=“All”This setting ensures that the Forms authentication cookie is encrypted to provideprivacy <strong>and</strong> integrity. The keys <strong>and</strong> algorithms used for cookie encryption arespecified on the element.Encryption <strong>and</strong> integrity checks prevent cookie tampering, although they do notmitigate the risk of cookie replay attacks if an attacker manages to capture the cookie.Also use SSL to prevent an attacker from capturing the cookie by using networkmonitoring software. Despite SSL, cookies can still be stolen with cross-site scripting(XSS) attacks. The application must take adequate precautions with an appropriateinput validation strategy to mitigate this risk.

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

Saved successfully!

Ooh no, something went wrong!