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.

290 Part III: Building Secure <strong>Web</strong> <strong>Application</strong>sDo Not Mix Session Tokens <strong>and</strong> Authentication TokensSecure session management requires that you do not mix the two types of tokens.First, secure the authentication token to make sure an attacker cannot capture it <strong>and</strong>use it to gain access to the restricted areas of your application. Second, build yourapplication in such a way that the session token alone cannot be used to gain accessto sensitive pages or data. The session token should be used only for personalizationpurposes or to maintain the user state across multiple HTTP requests. Withoutauthentication, do not maintain sensitive items of the user state.Use SSL EffectivelyIf your site has secure areas <strong>and</strong> public access areas, you must protect the secureauthenticated areas with SSL. When a user moves back <strong>and</strong> forth between secure <strong>and</strong>public areas, the ASP.NET-generated session cookie (or URL if you have enabledcookie-less session state) moves with them in plaintext, but the authentication cookieis never passed over unencrypted HTTP connections as long as the Secure cookieproperty is set.Note You can set the Secure property for a Forms authentication cookie by settingrequireSSL="true" on the element.An attacker is able to obtain a session cookie passed over an unencrypted HTTPsession, but if you have designed your site correctly <strong>and</strong> place restricted pages <strong>and</strong>resources in a separate <strong>and</strong> secure directory, the attacker can use it to access only tothe non-secure, public access pages. In this event, there is no security threat becausethese pages do not perform sensitive operations. Once the attacker tries to replay thesession token to a secured page, because there is no authentication token, the attackeris redirected to the application’s login page.For more information about using the Secure cookie property <strong>and</strong> how to buildsecure Forms authentication solutions, see “Forms Authentication” earlier in thischapter.Secure the Session DataIf the session data on the server contains sensitive items, the data <strong>and</strong> the store needsto be secured. ASP.NET supports several session state modes. For information abouthow to secure ASP.NET session state, see “Session State” in Chapter 19, “SecuringYour ASP.NET <strong>Application</strong> <strong>and</strong> <strong>Web</strong> Services.”

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

Saved successfully!

Ooh no, something went wrong!