-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Update PasswordEncoder Minimums #10506
Comments
see also #7411 (comment) |
Hi, did someone take this issue? I would like to contribuite. |
@ioanadinuit, thanks for volunteering! The ticket is yours. One thing we need to keep in mind is what will happen to folks when they upgrade to Spring Security 6. Ideally, existing hashes will still work which is not as simple with |
@Sc00bz, I'd prefer to go off of the recommendations on the OWASP cheat sheet. They vary just slightly from your recommendations in your comment. Do you have any concerns with going with the recommendations from the cheat sheet? |
Please also see gh-7411 |
@jzheaux That OWASP cheat sheet is based on my recommendations. The four changes I suggested to this project's defaults:
OWASP cheat sheet has for Argon2:
The curator trimmed the list at the first two. Numbers came from these formulas:
OWASP cheat sheet has for scrypt:
OWASP cheat sheet has for PBKDF2:
Note using SHA512 is better than the others if the one calculating it has a 64 bit CPU. SHA1 and SHA256 are better if the one calculating it has CPU instructions for them.
It was a hard fought battle to get the recommended down to cost 10. Note cost "8.1" is the minimum for bcrypt, but it's an integer so 9. P.S. A new GPU came out since those recommendations. It's ~3% faster compute and 20% more memory bandwidth. Argon2 Note this is how minimums work. Normally every year a new GPU comes out that's 20%+ faster. Last few years have been abnormal. If I were to guess, I'd guess there's going to be a jump in minimums around October. |
Please see gh-4788 |
@Sc00bz Thanks for the updated numbers. The trouble is that we don't know what hardware users are leveraging to run their servers and minimums are a tradeoff. The attackers will always have better optimized hardware for cracking than the defenders will for validating passwords because the defenders need to do more than passwords and it is unlikely they will leverage GPUs. It's all about trade offs. Using a workfactor that is too large will potentially cause a DoS for the application servers. The best we can do is follow the guidance for now and ensure we can support upgrading in the future. This is why we are also looking to implement gh-9833 |
Argon2, bcrypt, PBKDF2, and scrypt can't run on a GPU for the defender. Well they could but it would be very slow. Minimums are set to prevent attackers from getting >10 kH/s/GPU.
Note bcrypt cost 9 is super fast because it is a good algorithm. PBKDF2-HMAC-SHA512 with 130,000 iterations is slow because PBKDF2 is a bad algorithm. If bad algorithms are causing DoS issues, then you should deprecate those algorithms. |
The recommended minimums for Argon2, as per OWASP Cheat Sheet Series (https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html), are: Use Argon2id with a minimum configuration of 15 MiB of memory, an iteration count of 2, and 1 degree of parallelism. Previous default configuration: memory=4, iterations=3, parallelism=1 New default configuration: memory=16, iterations=2, parallelism=1 Issue spring-projectsgh-10506
The recommended minimums for scrypt, as per OWASP Cheat Sheet Series (https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html), are: Use scrypt with a minimum CPU/memory cost parameter of (2^16), a minimum block size of 8 (1024 bytes), and a parallelization parameter of 1. Previous default configuration: cpuCost=16384, memoryCost=8, parallelism=1 New default configuration: cpuCost=65536, memoryCost=8, parallelism=1 The default salt length was also updated from 64 to 16. Issue spring-projectsgh-10506
The recommended minimums for PBKDF2, as per OWASP Cheat Sheet Series (https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html), are: If FIPS-140 compliance is required, use PBKDF2 with a work factor of 310,000 or more and set with an internal hash function of HMAC-SHA-256. Previous default configuration: algorithm=SHA1, iterations=185000, hashLength=256 New default configuration: algorithm=SHA256, iterations=310000, hashLength=256 The default salt length was also updated from 8 to 16. Issue spring-projectsgh-10506
The recommended minimums for Argon2, as per OWASP Cheat Sheet Series (https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html), are: Use Argon2id with a minimum configuration of 15 MiB of memory, an iteration count of 2, and 1 degree of parallelism. Previous default configuration: memory=4, iterations=3, parallelism=1 New default configuration: memory=16, iterations=2, parallelism=1 Issue spring-projectsgh-10506
The recommended minimums for scrypt, as per OWASP Cheat Sheet Series (https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html), are: Use scrypt with a minimum CPU/memory cost parameter of (2^16), a minimum block size of 8 (1024 bytes), and a parallelization parameter of 1. Previous default configuration: cpuCost=16384, memoryCost=8, parallelism=1 New default configuration: cpuCost=65536, memoryCost=8, parallelism=1 The default salt length was also updated from 64 to 16. Issue spring-projectsgh-10506
Based on #10447 (comment),
Argon2PasswordEncoder
,ScryptPasswordEncoder
, andPbkdf2PasswordEncoder
should have their minimums updated.Please also see gh-7411 gh-4788
The text was updated successfully, but these errors were encountered: