It is a common practice to hash passwords as a way to create publicly viewable manifestations of secret content. One popular choice is the md5 hash. The problem is that md5 is well-known. When hackers break into a system and find unencoded passwords (and there are still systems that do this), they often run md5 hash on it an publish it on a public website. This creates a database of password/hash combinations, effectively breaking any security based on md5.
For example, one of my personal passwords for low-security websites is ‘gsmith29′. If you convert ‘gsmith29′ into an md5 hash (http://www.miraclesalad.com/webtools/md5.php) you get 45f3df4cd11f2e0c6af0a7caac657765.
Now, suppose you’re a hacker and you find an /etc/passwd (or other) password file with md5 hashed passwords in it. If you run each of the hashes into a Google search, you may find matches in one of these hacker websites. For example, when I “Google” 45f3df4cd11f2e0c6af0a7caac657765 I get…
md5.db30.com – 45f3df4cd11f2e0c6af0a7caac657765
Clicking on this link takes you to a site that displays my password in clear text. Not only does it “decrypt” my md5 hashed password, but it displays all kinds of other hashes of my password. Now, the hacker has a vector into the website, using my password.
The takeaway here is two fold: Once your password is hijacked, you must change it everywhere because if the host system is using md5 hash, your password may be “well known”. Secondly, if you’re architecting a secure site, you need to use something other than md5 to hash your passwords.
One alternative to a strict md5 hash is to hash the password with some “salt” that is hard to determine. Say, secret=md5(password+salt) where salt=md5(username). The idea is to create a function that is different from all other website’s password hashing algorithms. This makes it difficult for people to look up your user’s hashed passwords on the internet.