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 2: <strong>Threats</strong> <strong>and</strong> Countermeasures 37Countermeasures to help address the threat of session replay include:●●●Re-authenticate when performing critical functions. For example, prior toperforming a monetary transfer in a banking application, make the user supplythe account password again.Expire sessions appropriately, including all cookies <strong>and</strong> session tokens.Create a “do not remember me” option to allow no session data to be stored on theclient.Man in the Middle AttacksA man in the middle attack occurs when the attacker intercepts messages sentbetween you <strong>and</strong> your intended recipient. The attacker then changes your message<strong>and</strong> sends it to the original recipient. The recipient receives the message, sees that itcame from you, <strong>and</strong> acts on it. When the recipient sends a message back to you, theattacker intercepts it, alters it, <strong>and</strong> returns it to you. You <strong>and</strong> your recipient neverknow that you have been attacked.Any network request involving client-server communication, including <strong>Web</strong>requests, Distributed Component Object Model (DCOM) requests, <strong>and</strong> calls to remotecomponents <strong>and</strong> <strong>Web</strong> services, are subject to man in the middle attacks.Countermeasures to prevent man in the middle attacks include:● Use cryptography. If you encrypt the data before transmitting it, the attacker canstill intercept it but cannot read it or alter it. If the attacker cannot read it, he or shecannot know which parts to alter. If the attacker blindly modifies your encryptedmessage, then the original recipient is unable to successfully decrypt it <strong>and</strong>, as aresult, knows that it has been tampered with.● Use Hashed Message Authentication Codes (HMACs). If an attacker alters themessage, the recalculation of the HMAC at the recipient fails <strong>and</strong> the data can berejected as invalid.CryptographyMost applications use cryptography to protect data <strong>and</strong> to ensure it remains private<strong>and</strong> unaltered. Top threats surrounding your application’s use of cryptographyinclude:● Poor key generation or key management● Weak or custom encryption● Checksum spoofing

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

Saved successfully!

Ooh no, something went wrong!