Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If using MD5 is all you do, you'd still be susceptible to brute force attacks. MD5 is a really fast hash to compute, salting or not.

The solution is to pick a better algorithm and learn how to use it securely. That probably won't happen unless all the ridiculous PHP 'security' tutorials are erased from the history of the internet and only correct methods are shown.



    If using MD5 is all you do, you'd still be 
    susceptible to brute force attacks.
Only if you know the algorithm and salt used (i.e. your source code is also compromised, not just your database).

Otherwise, demonstrate to me how you can find the passwords that relate to these hashes (all of them use the same salt):

     23C206503ABD36FCB575FC8F12791CF0
     D82BDB4160F60B657D6F994B553D2E63
     0DA0572E042F822F91772F14269548E6
     CB8BF6C16029400885F9A68A17576FA7
     7CE4F679810409CF1477CF142B481EF9
It should be easy, right?


A standard assumption in cryptography, known as Kerckhoff's principle (http://en.wikipedia.org/wiki/Kerckhoffs%27_principle), is: "A cryptosystem should be secure even if everything about the system, except the key, is public knowledge." or "Don't rely on security by obscurity.".


In this case, the salt is effectively part of the key. They know how you use the salt, sure. Just not the big arbitrary hex string that is the salt.


No it is not, because the salt is stored in a plaintext or easily reversible format somewhere, and has to be in order for authentication to work, if you are in a position to grab the hashes, it will also be trivial to grab the salts. The point of the salt is not to add some padding bits to the password. Salts should be publicly knowable without it causing a loss of security.

The one and _only_ use of a salt is to prevent precomputation attacks (rainbow tables).


But isn't the SSH private key also stored in plain text?

I mean, yeah, you could also have a password for that key, but then most people use ssh-agent because typing that key every single time is annoying, which means the password is somewhere in memory. Or you could just install a keylogger on it and wait for the user to login.

If the user's computer is compromised, a hacker could gain access to his SSH credentials. Isn't that still security by obscurity?

And if you gain access to the source-code and to the database, I'm pretty sure you'll end up in a position to modify that source-code anyway, thus finding user passwords by simply logging them somewhere.

Security is a complex topic and relying on the slowness of an algorithm like bcrypt doesn't make me feel any safer, as people can always come up with a faster bcrypt. Instead we should rely on computational complexity, because no matter what we do, unless quantum computers become a realy, there are limits to what we can compute when exponential complexity is involved.


> Instead we should rely on computational complexity, because no matter what we do, unless quantum computers become a realy, there are limits to what we can compute when exponential complexity is involved.

Quantum computing does not help with exponential problems in general.


> But isn't the SSH private key also stored in plain text?

Not if you passphrase-protect it.


From throwaway64, who is dead:

">But isn't the SSH private key also stored in plain text?

no, passwording the key encrypts it

>I mean, yeah, you could also have a password for that key, but then most people use ssh-agent because typing that key every single time is annoying, which means the password is somewhere in memory. Or you could just install a keylogger on it and wait for the user to login.

ssh-agent does not expose the private key to clients requesting it, thats part of its design, you can however get a login session to whatever hosts it holds keys for.

> Isn't that still security by obscurity?

That is much more involved than a hit and run attack where you download the DB, and much more likely to be detected/detectable before any harm is done, via such things as IDS, or just plain not possible due to how a system is locked down (stuff like ssh gateways that are heavily secured, etc).

>Instead we should rely on computational complexity ... there are limits to what we can compute when exponential complexity is involved.

the point of bcrypt isnt JUST that it is slow, its that each step requires the data from the previous step, many thousands of times over, that makes it impossible to parallelize across many GPU cores or similar arangements, thats a huge part of the weakness of stuff like plain hashing/salting, its trivial to parallelize and to scale up that parellelization till you are generating billions, or even trillions of hashes a second, that approch is totally useless on bcrypt."


It's somewhat optimistic to assume that the adversary knows no passwords - even if you can't create a user, phishing one isn't that hard. That makes recovering the salt much easier.


Well yeah, but then you're proposing a brute force against the salt and the salt can be anything of any length.

So if you're assuming a salt that can contain standard latin letters and digits and is 256 in length, that's 62^256 possible variations.

Do note that I'm not saying here that MD5_HMAC doesn't have flaws, but it definitely doesn't have the same flaws as MD5, cracking it ain't easy and I can't find a reference for an instance in which this was actually done.


Where did the HMAC come from? I thought we were discussing plain MD5.

And yes, a huge secret salt will help. Of course, if your source code is ever visible to anyone you'll have to lock all accounts.


Well, I thought it was assumed :) ... since salting a hash has inherent vulnerabilities if you're not doing it right and HMAC is a sane way to do it.

I really don't get this argument that since MD5 is fast to compute, that's the reason it is vulnerable. That's not true, MD5 is vulnerable for other reasons, like collision attacks are possible, preimage vulnerabilities were demonstrated, huge rainbow tables are precalculated and so on and so forth.

However, HMAC_MD5 does not have the same vulnerabilities and increasing the size of the salt increases the time of a brute force attack exponentially. 62^256 is a freakishly big number and it doesn't matter much if you divide the work by 100,000 computation units. But if that makes you feel uncomfortable, you can always increase the salt to 1000 chars.

And I simply don't buy that we have enough computation power in this world to brute force something with 62^1000 computational complexity.


A salt will not remain secret if your hashes are compromised, its always going to be a trivial step to also grab the salts.


except you shouldn't have 'the' salt, you should have 'a' salt for each user...


The parent to my post specified "all use the same salt".


Phishing the password from one user and recovering the salt shouldn't be useful in the first place. The parent example was only meant to show how difficult it is to recover a salt even with multiple examples of its use, not to give a real life example of password hash use. (Which was my point)

That said, I don't know how you would obtain a list of hashed passwords without also getting the associated list of salts (wouldn't they be in the same database?), so it is kind of a moot point. The different salts are intended to prevent against the ability to have a single rainbow table to crack every password in the database.

Instead, you need a table for each salt, which means that you basically have to brute force the entire database. This still doesn't really help if you are using something fast like MD5, as brute force solution will be possible with that algorithm. Which is why you want something reasonably slow.


Having the exact salt in the same database as the user data defeats the purpose of the salt.

Normally you have a global salt, somewhere in your source-code, which you combine with the per-user generated salt. It also doesn't have to be something obvious in the database (like a column named user_salt :)), you could just use something like HMAC_MD5(global_salt, email + username + joined_date) for each user.

Of course, this may seem like security by obscurity, but even in the case of SSH you keep your private key safe and as a business if you have both your database and your source-code compromised, you're fucked anyway.


How does it defeat the purpose of the salt?

The purpose of the salt is to defeat time/space tradeoff attacks by inflating the required space to the point of impracticality. ie. 20 bits of salt will increase the size of the rainbow table required a million times.


immutable fields are probably recommended for salts ... I quite like being able to change my email address on a site ;-)

but yes, a hashed (global + immutable-user-specific) combination seems to be best practice.


Mostly, there will be a column conveniently labeled 'salt'. And in e.g. a MySQL database, you can bet the native hashing format has been used.

Ignoring that, if someone got your database, you should assume they got your code. If you care about passwords not being lost, you use bcrypt or something similar.


You ommited this:

  > MD5 is a really fast hash to compute, salting or not.
Just spend some time thinking about this.


Yes MD5 is fast to compute and ... NO, in the example I've given it really does not matter much.

As I said, it should be easy cracking those hashes right? Prove me wrong.


"Prove me wrong."

This is not how discussions in this topic work.


If I have your hashes, I probably have your salts too. (Unless you use a single salt, in which case, I can easily get your salt if I've already got a username/password for your site.)


Do you have a reference that you would consider "the minimum you should know?" And, perhaps, maybe one somewhat better than that one? TIA.


Yes: http://codahale.com/how-to-safely-store-a-password/

This is the answer to this question. You should bookmark it and share it with your peers when this question inevitably comes up on another thread.


OK, so this is still the definitive thinking. I think you've told us about this before. Thanks again.


Just remember "use bcrypt" and you should be fine. There is almost certainly a library for it for your language.


Definitely. I'm just saying that I could recover the common passwords with a 486 instead of a GPU :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: