Oracle came out with Database Security Worst Practices this week, a list of seven things you should not do. It's a fairly good list if you are an Oracle customer, covering the basic preventative security settings you should check before any database server is deployed into production. But I have a couple that trumps them all, especially if your databases support Web applications:
Don't store passwords in clear text!
Don't encrypt passwords if you leave the encryption keys unsecured!
Apparently that is just what the developers at Gawker did. If you have a user account on Gawker, Gizmodo, Jalopnik, Jezebel, Kotaku, Lifehacker, Deadspin, io9, or Fleshbot, Gawker is telling you that your user credentials have been compromised. For the user credentials to have been compromised means they were stored in clear text, or the sites were using encryption and left the encryption keys somewhere easy to get. As their websites claim, they were encrypted; I'll give them the benefit of the doubt. But it means the hackers have access to everything the users did, and possibly some of the administrative accounts as well.
Most public-facing Web applications do not encrypt passwords. They use what is called a hash function. Both completely alter the original value so it's pretty much impossible to guess the password. The difference between the two is that encryption can be reversed back into the original value by using a secret encryption key. The security of the password is only as strong as the security of the key. A hash function permanently obfuscates the password. This is done so if someone should manage to break into your database, he does not automatically obtain all user passwords; rather he gets the hashed value that cannot be used as a password. When a user logs into the system, the password he sends to the database is also hashed; if the new hashed value matches the hashed value stored for that user account, that person is logged into the database.
I am going to bet a lot of you already knew that. And you know that every major relational database platform stores passwords for users of that database as a hashed value in a secured table. And most RDBMSs offer a hash function as a stored procedure call as well, just in case you maintain your own user and password tables.
But this bears explaining; clearly some developers out there apparently did not get the memo that hackers hack databases. And that secret encryption keys need to be kept secret. If they had or used hashing, then hackers getting the user name -- and even the email credentials -- the accounts would not have been compromised.
This is a colossal failure that would place No. 3 on my list of things not to do with database security. No. 2 would be clear text passwords. No. 1 would be leaving the administrator password at the default setting. Let's hope Gawker at least got that right.
Adrian Lane is an analyst/CTO with Securosis LLC, an independent security consulting practice. Special to Dark Reading.. Adrian Lane is a Security Strategist and brings over 25 years of industry experience to the Securosis team, much of it at the executive level. Adrian specializes in database security, data security, and secure software development. With experience at Ingres, Oracle, and ... View Full Bio