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.

90 Part II: Designing Secure <strong>Web</strong> <strong>Application</strong>sDo Not Store Sensitive Data in Persistent CookiesAvoid storing sensitive data in persistent cookies. If you store plaintext data, the enduser is able to see <strong>and</strong> modify the data. If you encrypt the data, key management canbe a problem. For example, if the key used to encrypt the data in the cookie hasexpired <strong>and</strong> been recycled, the new key cannot decrypt the persistent cookie passedby the browser from the client.Do Not Pass Sensitive Data Using the HTTP-GET ProtocolYou should avoid storing sensitive data using the HTTP-GET protocol because theprotocol uses query strings to pass data. Sensitive data cannot be secured using querystrings <strong>and</strong> query strings are often logged by the server.Session Management<strong>Web</strong> applications are built on the stateless HTTP protocol, so session management isan application-level responsibility. Session security is critical to the overall security ofan application.The following practices improve the security of your <strong>Web</strong> application’s sessionmanagement:● Use SSL to protect session authentication cookies.●●●Encrypt the contents of the authentication cookies.Limit session lifetime.Protect session state from unauthorized access.Use SSL to Protect Session Authentication CookiesDo not pass authentication cookies over HTTP connections. Set the secure cookieproperty within authentication cookies, which instructs browsers to send cookiesback to the server only over HTTPS connections. For more information, seeChapter 10, “Building Secure ASP.NET <strong>Web</strong> Pages <strong>and</strong> Controls.”Encrypt the Contents of the Authentication CookiesEncrypt the cookie contents even if you are using SSL. This prevents an attackerviewing or modifying the cookie if he manages to steal it through an XSS attack. Inthis event, the attacker could still use the cookie to access your application, but onlywhile the cookie remains valid.

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

Saved successfully!

Ooh no, something went wrong!