RSS
Interceptions

No hash, No hash

Last weekend’s biggest story on blogosphere has been how Gawker media’s user-base was compromised by Anonymous. Ever since media stalwarts and big-brother companies have shut out WikiLeaks, cyber-attacks across the globe are conducted by the Anonymous. Recent attack on Gawker media is believed to be executed by the Anonymous.

Let’s not deal with who made this attacks and all. What surprised me was how insecure the user-base was. They didn’t hash the passwords in their database. They were using mcrypt and blowfish to store the passwords. While mcrypt is a secure method to encrypt data, it can be decrypted easily on a database since it’s not a method of hashing. (Most hashing methods are believed to be impossible to de-hash. Although instances of hash-clashes do exist.)

If you are not lazy, you should hash passwords and sensitive data while writing a programme. Most people avoid hashing because, I believe, they want to simplify the password retrieval process. For them, it’s like:

// User forgets password
user_forgot_pass(){
 get_user_email();
 check = check_database_for_email();
 if(check==true) {
  get_password_from_database();
  send_email();
 } else {
  sorry_user_not_found();
 }
}
Which should have been:
// User forgets password
user_forgot_pass(){
 get_user_email(); // try a captcha for better security
 check = check_database_for_email();
 if(check==true) {
  dummy = create_dummy_password();
  dummy_hash = hash(dummy);
  replace_hash_on_user_base_with(dummy_hash);
  send_email_with(dummy);
 }
}
// Ask/force the user to change the password when s/he logs in
The second method stores the password on the user-base as a hash while the first method either uses plain-text or some weak encryption algorithm. Perhaps a few (hundred) lines of code would have saved Gawker’s reputation.

Labels: ,

Comments

Add yours →