dhui / passhash

Go library providing simple and secure password management
Apache License 2.0
8 stars 4 forks source link

Prevent DOS attacks by pre-hashing password #11

Open dhui opened 5 years ago

dhui commented 5 years ago

Hash used for pre-hashing should be configurable. Default to SHA-3. e.g. Use hash.Hash and sha3.New512() (each hash sum call will either need to lock and reset the hash.Hash OR create a new hash.Hash)

Reference: https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Password_Storage_Cheat_Sheet.md#hash-the-password-as-one-of-several-steps

dhui commented 1 year ago

Turns out pre-hashing a password can be dangerous. e.g. bcrypt of an MD5 hash can be shucked

It's not clear if SHA3 currently has similar vulnerabilities (e.g. any breaches containing SHA3 hashes) but the potential vulnerability is always there in the future. As the linked video mentions, this can be mitigated by peppering the pre-hashed password.