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.

36 Part I: Introduction to <strong>Threats</strong> <strong>and</strong> CountermeasuresAn HMAC provides message integrity in the following way:1. The sender uses a shared secret key to create a hash based on the messagepayload.2. The sender transmits the hash along with the message payload.3. The receiver uses the shared key to recalculate the hash based on the receivedmessage payload. The receiver then compares the new hash value with thetransmitted hash value. If they are the same, the message cannot have beentampered with.Session ManagementSession management for <strong>Web</strong> applications is an application layer responsibility.Session security is critical to the overall security of the application.Top session management threats include:● Session hijacking● Session replay● Man in the middleSession HijackingA session hijacking attack occurs when an attacker uses network monitoring softwareto capture the authentication token (often a cookie) used to represent a user’s sessionwith an application. With the captured cookie, the attacker can spoof the user’ssession <strong>and</strong> gain access to the application. The attacker has the same level ofprivileges as the legitimate user.Countermeasures to prevent session hijacking include:● Use SSL to create a secure communication channel <strong>and</strong> only pass theauthentication cookie over an HTTPS connection.● Implement logout functionality to allow a user to end a session that forcesauthentication if another session is started.●Make sure you limit the expiration period on the session cookie if you do not useSSL. Although this does not prevent session hijacking, it reduces the time windowavailable to the attacker.Session ReplaySession replay occurs when a user’s session token is intercepted <strong>and</strong> submitted by anattacker to bypass the authentication mechanism. For example, if the session token isin plaintext in a cookie or URL, an attacker can sniff it. The attacker then posts arequest using the hijacked session token.

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

Saved successfully!

Ooh no, something went wrong!