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.

Chapter 10: Building Secure ASP.NET Pages <strong>and</strong> Controls 277Use the <strong>Security</strong> AttributeInternet Explorer 6 <strong>and</strong> later supports a new security attribute on the <strong>and</strong> elements. You can use the security attribute to apply the user’s RestrictedSites Internet Explorer security zone settings to an individual frame or iframe. Bydefault, the Restricted Sites zone doesn’t support script execution. If you use thesecurity attribute, it must currently be set to “restricted” as shown below:Use the innerText PropertyIf you create a page with untrusted input, use the innerText property instead ofinnerHTML. The innerText property renders content safe <strong>and</strong> ensures that script isnot executed.AuthenticationWeak authentication increases the identity spoofing threat. If a user’s logoncredentials fall into the wrong h<strong>and</strong>s, an attacker can spoof the user’s identity <strong>and</strong>gain access to the application. The attacker shares all of the user’s privileges in theapplication. Credentials must be protected as they are passed over the network <strong>and</strong>while they are persistent, for example, in the application’s user store. Theauthentication cookie that represents an authenticated identity to the application afterthe initial logon must also be protected to mitigate the risk of session hijacking <strong>and</strong>cookie replay attacks.Forms AuthenticationThe threat of session hijacking <strong>and</strong> cookie replay attacks is particularly significant forapplications that use Forms authentication. You must take particular care whenquerying the database using the user-supplied credentials to ensure that you are notvulnerable to SQL injection. Additionally, to prevent identity spoofing, you shouldmake sure that the user store is secure <strong>and</strong> that strong passwords are enforced.The following fragment shows a “secure” Forms authentication configuration in<strong>Web</strong>.config: Sliding session lifetime

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

Saved successfully!

Ooh no, something went wrong!