tags:

views:

369

answers:

5

I was wondering if it was a common practice to salt and hash a password like

E(padding || hash(salt || password))

where || is concatenation and E uses RSA for example. I'm primarily asking this question for transport of a password database (not online storage where the server would have the private key to decrypt the encrypted password at all times).

I know that a cryptographic hash should be irreversible, but an off-line brute force attack on weak passwords would easily reveal a password. To eventually decrypt a record in this database, the server will know the length of padding and simply take away padding to reveal hash(salt || password).

This is not a typical problem, but I couldn't find a reference as to someone having to properly transport a password database and defend against an offline attack.

A: 

if you control the function that try to decrypt the database, put a timer of 1 second between retry?

that would surely slowdown a bit the brute force

Fredou
No, because the cracker will code his program to not have that delay.
Brian
#2 in your answer above is exactly what I just said :-D
Fredou
Possibly but brute force programs rely on being able to try something hundereds of times a second.
Sam152
Fredou: True, but the way you phrased it implies using "sleep" or "delay."
Brian
@Fredou: Key strengthening is *NOT* putting a timer for delay. See http://en.wikipedia.org/wiki/Key_strengthening. The question is about an offline attack with the attacker probably using his own password cracking tool.
0xA3
Fredou
I emphasized the words "Offline" in a bid to make this clearer that user possibly has only time, cpu speed, and algorithmic-ram-tradeoff tricks slowing them down.
Kent Fredric
+1  A: 
  1. Use passwords that won't show up in a dictionary.
  2. Use Key Strengthening.

Or just encrypt the password database itself. If you have no way to transport the decryption key, you can encrypt the decryption key using public key encryption.

Brian
#1-#2 assume you have control over the password database itself, as do most of the suggestions people have made. Hence my alternative suggestion.
Brian
+1  A: 

The point would be that you would salt the password in the same way when you are comparing it while logging a user in and while storing the password. Having a good salt would prevent someone doing a standard lookup and it would also strengthen the hash against dictionary attacks. If the salt and the password are combined within a hash it would greatly reduce the use of offline attacks and you wouldn't need to take any special precaution of protecting it.

Sam152
+2  A: 

Encrypt the password file with something strong, then it doesn't matter how the passwords are stored inside the file.

Ie. use something like PGP for transport.

I noticed that this answer has been downvoted once, before someone else upvoted it, and just thought I would clarify it, since I suspect the person that downvoted my answer didn't actually read the question. On the other hand, perhaps full encryption of the entire file is not possible for the person asking the question. This would be a handy clarification in the question if that is the case.

Anyway, the question specifically states that this is about transporting the data(base). It also specifically states that this is not about online storage and usage.

As such, using a safe and secure encryption method for the entire file is really the best way to go, as then you're not limited to having to manipulate the file contents to try to mask each individual password.

Instead, the whole file would be meaningless, and if more than just the password file is to be transported, it would be lumped together with, and thus encrypted together with, a lot more data, making the process of identifying the passwords nearly impossible as well.

The attacks on such encrypted files are a lot less likely to succeed, if you pick a reputable encryption algorithm and implementation (PGP, GPG, etc.), than inventing something yourself, or at the very least making it easy for the attacker to find the individual passwords in small chunks.

Lasse V. Karlsen
Why had this been downvoted?
0xA3
Its kinda useless on a host where they need the decryption key to be able to read the password file anyway.
Kent Fredric
it just means you have to steal *more* :)
Kent Fredric
As I understood the question it is about transporting a database from A to B (maybe on a DVD, maybe via internet) and how to protect it best. Thus encrypting the transport layer (i.e. encrypting the DVD) seems the only viable way to me. This would also protect weak passwords in the database.
0xA3
A: 

All the other responses are good, but I'd add:

Force password changes on a regular basis.

This is the sure way to disrupt offline brute force attacks. It's harder to hit a moving target.

Moose
My experience indicate that users that are forced to change password just use the same basic password and add a single letter/digit. If you force users to use cryptic passwords they just write them down... Overall, passwords suck :)
nimrodm
Even if they change the password marginally, it still helps. Salting protects against rainbow attacks with the single digit. Yes, passwords suck, but unless you want to go with some hardware methods, you don't have many alternatives.
Moose