ext/standard: notice on long passwords in bcrypt - #23076
Conversation
Bcrypt supports passwords up to 72 characters. The remainder is ignored. Earlier proposed here: - https://news-web.php.net/php.internals/75692 - https://wiki.php.net/rfc/password_hash_spec Bcrypt truncation can result in serious security bugs: - https://pentesterlab.com/blog/freshrss-bcrypt-truncation-auth-bypass - https://www.invicti.com/blog/web-security/okta-vulnerability-bcrypt-auth
|
This could also apply to |
|
@nikic @narfbg @ircmaxell I am looking into this again, and you seemed to have objected last time. Do you feel the same now? This is mostly for the case where some static string is prepended to the password before being passed to |
|
Thanks for the ping, @Sjord. I do still think that warnings would do more harm than good. However, I might not be against a fail-closed approach where an exception is thrown. Not to say that I'd outright support that (the BC break can be too big a price to pay) but it would solve most of the problems I have with the warning idea. |
|
However, in the FreshRSS bug (and more or less the Okta bug) mentioned above, they don't just supply the password, but prepend a nonce or a username. This is a bad idea and not a supported way of using I think throwing an error is warranted. For FreshRSS this would mean severe BC break: their authentication method stops working when they upgrade their PHP version. Perhaps that's acceptable? It could be better than that users can bypass the authentication altogether. And if you use functions in undocumented and unsupported ways, you can expect BC break. |
Bcrypt supports passwords up to 72 characters. The remainder is ignored.
Earlier proposed here:
Bcrypt truncation can result in serious security bugs: