Broken Authentication and Session Management – A security concern

This blog post showcases the need for protecting user’s password, the password habits that the application should enforce to the end user, and the practices that a developer should follow to secure a user’s information, especially the session information. This blog will also focus on aspects of session management.

Security Business Case

  1. A authenticated user on a shopping site post a sale link on facebook – http://somekart.com/sale/saleitems?sessionid=125874588, without even knowing that it has her session id in the link. A miscreant can use her link and shop away with her credits on that site
  2. A user closes the browser in an internet enabled public computer, without logging out of the website. Attacker comes in and uses the browser which is still authenticated
  3. Hacker gets access to system’s password, due to weak hashing and encryption mechanisms

Safety Measures

Password Management

Some key aspects to bear in mind:

  1. User should be prompted to create a fairly complex password, with no reference to previous passwords
  2. User should be allowed to enter password only limited number of times in case of wrong passwords. Details (time stamp) of previous successful login and failed attempts should be emailed or sent as a text to a linked cellphone.
  3. Passwords right or wrong should not be captured in log. Anyone having access to the log can hijack the user’s account.
  4. Only a single password change mechanism should be present.
  5. Whenever, the user changes any of their personal credentials such as a linked email, he should be asked to authenticate again. If ignored, the attacker my gain access to the session, may change the email to his own, and can request for a forgotten password.

Password Protection

Thumb rules for password protection:

  1. All passwords stored should be either hashed or encrypted using cryptographic hashing techniques such as Hash functions like SHA256, SHA512, RipeMD, and WHIRLPOOL. In case of encryption, decryption keys should be securely protected.
  2. Always protect the login transaction using SSL. The user session too should be protected via SSL, the session id of the user cannot be hacked off the network.
  3. Always use a POST for any form of session related submission. No Cache tags (PRAGMA:NO-CACHE and CACHE-CONTROL:NO-CACHE) should be used to prevent resubmitting login credentials using back button. Using these caches takes the forward request to origin server.
  4. Session should always be invalidated after a certain time, if the application is not in use.

What next?

           As a follow up to this post on broken authentication mechanisms, my next blog would be related to Cross Site Scripting or specifically XSS attacks.

The following two tabs change content below.

Vivek Sharma

Over 10 years of experience in technology and extremely interested in software security. Experienced in working with banks to safeguard against security threats. He spends his free time deep in stock market analysis.
Vivek Sharma

Over 10 years of experience in technology and extremely interested in software security. Experienced in working with banks to safeguard against security threats. He spends his free time deep in stock market analysis.

All stories by: Vivek Sharma