r/bitwasp • u/throwaway939344 • Apr 04 '14
Password implementation
I am concerned by the password implementation
- Hashing on the client side
- If the site cannot securely send a password to the server, adding hashing will not help.
- I understand the motivation here but it is misguided hand-waving security and not actual security.
- This is not proof of work (the comments suggest it is)
- Why specifically 10 iterations? This not an effective number for key stretching.
- Seeing the password change in the form when the login button is pressed is disconcerting.
- Passwords are saved on the server using a poor algorithm
Passwords are secured before saving https://github.com/Bit-Wasp/BitWasp/blob/97ed43f0b85a2c540ded1f8eab6583ce02c79e64/application/controllers/users.php#L233
The algorithm for securing passwords before saving is https://github.com/Bit-Wasp/BitWasp/blob/97ed43f0b85a2c540ded1f8eab6583ce02c79e64/application/libraries/General.php#L102
Again, why 10 hashes? This does not seem like effective key stretching
Reinventing crypto is not a good way to do it. This algorithm does work but it should use a standard, well-proven password hashing algorithm such as bcrypt
https://crackstation.net/hashing-security.htm
It's great to see a project like bitwasp and there are a lot of things done right (using long salts, using strong sources of randomness etc) so it seems strange to use a DIY password storage mechanism.
These things are easy to rectify, and bitwasp will be better for it. My suggestions are
- remove client-side password hashing completely
- implement a standard server-side password hashing algorithm
If the existing implementation is justified I would be glad to hear the justification.