Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insecure password hashing #426

Closed
rk opened this issue Feb 4, 2013 · 5 comments
Closed

Insecure password hashing #426

rk opened this issue Feb 4, 2013 · 5 comments

Comments

@rk
Copy link

rk commented Feb 4, 2013

The algorithm used to protect passwords is not secure. SHA1 has not been exposed the way MD5 has, but if you're going to use SHA1 you need to use PBKDF2 with the hash_hmac() algorithm. Otherwise, use bcrypt.

I don't have time for a full explanation, but I've written [removed spammers link] on this elsewhere.

@opencart
Copy link
Collaborator

opencart commented Feb 4, 2013

we don;t just use sha1 we also use salts and encrypt the password many times over

salt = '" . $this->db->escape($salt = substr(md5(uniqid(rand(), true)), 0, 9)) . "', password = '" . $this->db->escape(sha1($salt . sha1($salt . sha1($data['password'])))) . "'

i believe this has been broken at some russian hacking conference after renting out amazons cloud servers to do 18.1 billion combinations in 3 minutes.

the average scumbag will not be able to decrypt these password hashes.

@opencart opencart closed this as completed Feb 4, 2013
@ceejayoz
Copy link

ceejayoz commented Jul 2, 2013

GPU-based systems like some of Amazon's available instances (at the cost of a dollar or two an hour) can do billions of hashes per second. http://www.golubev.com/hashgpu.htm The average scumbag can get an AWS account and pay a couple bucks, no problem.

SHA1 for password hashing is insecure, period. There's a reason PHP's password_hash() function uses bcrypt.

@newsroomdev
Copy link

Also, posting your salt makes it even easier to decrypt. Hope you've changed that; that's like your secret sauce.

Be the sauce boss. Don't share your recipes.

@ackerdev
Copy link

ackerdev commented Jul 2, 2013

@geraldarthur I hope you know better, but for anyone who might stumble across this later...
If you're doing it right, knowing the salt shouldn't matter. Bcrypt stores the salt right in the resulting hash. It also uses a different salt for every password. The point is to run it through such CPU-intensive hashing that it would be infeasible to unravel it even if you know the salt due to the slowness of cracking.

You couldn't match the security of bcrypt even by wrapping the above in 5 more sha1() calls, and on top of that bcrypt is future-proof, as you can compensate for future hardware by increasing the amount of work that must be done to create a hash, which will again slow down any attackers.
And on top of that, it's pretty dang easy to implement, so please use it, for the love of your users.

@opencart
Copy link
Collaborator

opencart commented Jul 3, 2013

what about the padding though? unless the machine knows what the password is in between the hashing its not going to know if its been decrypt correctly. am i wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants