Repository navigation
Replace bcrypt challenge auth with direct password comparison - #9358
Conversation
95ade11 to
690c7c1
Compare
Frenzie
left a comment
There was a problem hiding this comment.
Fwiw I think the idea is that the bcrypt encryption protects against getting the password almost by accident (read: effortlessly, completely untargeted) in logs or some such, not that it's some kind of brilliant protection.
In any case, nothing jumps out at me in the PR.
|
#9362 needs to be merged before this PR |
|
I improved the tests a bit. |
|
Will also remove done |
But add `pattern` again for some nojs support
|
Somehow link checker didn't fail this time. I guess Gentoo wiki responded with 200 once, since it's still down. |
|
Let's go for it, but we need to warn a bit in advance. |
|
Is there anything I should change in the PR? |
|
I forgot about 50c36b8, is it still ok? |
|
Communication: https://framapiaf.org/@freshrss/117509044759169110 |
| header('HTTP/1.1 500 Internal Server Error'); | ||
| Minz_Request::setBadNotification(_t('install.session.nok')); | ||
| Minz_Request::forward(['c' => 'auth', 'a' => 'login'], false); | ||
| Minz_Request::forward(['c' => 'auth', 'a' => 'login'], redirect: true); |
There was a problem hiding this comment.
This is still sending a proper HTTP 500, right?
There was a problem hiding this comment.
No, because redirects only work with 3xx status codes.
But at the same time a redirect is needed here currently, due to a Minz bug that is yet to be addressed: #8535 (we don't want to leak passwordPlain in GET params)
There was a problem hiding this comment.
I forgot about this though
| $challenge = Minz_Request::paramString('challenge'); | ||
| $newPasswordPlain = ''; | ||
| if ($challenge !== '') { | ||
| $passwordPlain = Minz_Request::paramString('passwordPlain', plaintext: true, trim: false); | ||
| $newPasswordPlain = Minz_Request::paramString('newPasswordPlain', plaintext: true, trim: false); | ||
| $confirmPasswordPlain = Minz_Request::paramString('confirmPasswordPlain', plaintext: true, trim: false); | ||
| if ($passwordPlain !== '') { | ||
| $username = Minz_User::name(); | ||
| $nonce = Minz_Session::paramString('nonce'); | ||
| Minz_Session::_param('nonce', false); // One-time: consume the challenge so it cannot be replayed. | ||
|
|
||
| $newPasswordPlain = Minz_Request::paramString('newPasswordPlain', plaintext: true); | ||
| $confirmPasswordPlain = Minz_Request::paramString('confirmPasswordPlain', plaintext: true); |
* Fix current password requirement during password changes Regression from #9358 (follow-up, PR not present in a stable/versioned release) Fix [GHSA-5vxm-62pg-frff](https://github.com/FreshRSS/FreshRSS/security/advisories/GHSA-5vxm-62pg-frff) * Remove stale client side bcrypt comment from passwordUtil * docs: PHP 8.1 is no longer supported * Minor typographic preference --------- Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Regression from #9358 (PR not present in current release, stopped sending 403 on failed logins). This PR fixes the Minz bug mentioned in #9358 (comment) which occurred with `redirect: false` redirects. But it also takes a different approach for redirecting, by using HTML instead of the `Location` header (to address one additional issue with a resubmit prompt appearing when refreshing the login page after a failed login). 403 is now returned during failed reauthentication as well.
So if I understand this correctly this will make the password visible on any reverse proxy with ssl/tls termination, which is commonly hosted in a dmz (ie. low trust), which is a very common scenario? So effectively this simplification to the codebase made the product less secure? |
|
Yes, that means there's less passive observer protection, though whether it actually makes it less secure is debatable. Anything that terminates TLS like that could also simply replace the HTML with whatever it wants thus undoing the client-side bcrypt. |
Sure, but if the low trust dmz rp gets hacked (very likely in this day and age!) then plain text password sniffing is just easy peasy, I would prefer they just get hashes instead. You can learn a lot from a user's password imho... At least the password is not in a url query parameter but in POST request (I hope 😉 ?) I personally think this pull is a mistake. Following Nextcloud and using Argon2id with Argon2i & bcrypt fallbacks as authentication password hashing method would be my preference. |
|
The cleanup was mostly just removing it. I don't think adding it back would look substantially different. Either way I'm neutral on the matter. |
Instead of just adding it back it would probably make more sense to upgrade to a more modern approach, with some brute-force GPU hacking protection built in. Also Nextcloud uses it, so couldn't be all bad. Maybe this is of help (not mine, but gave me some insight): transitioning to argon2id from bcrypt: https://gyaando.com/php-password-hash-bcrypt-vs-argon2id/ |
|
Maybe, but that doesn't affect what I said. ;-) |
Ok so there probably wont be a feature request adding (more modern) password hashing support back in any time soon. More of a ‘spare time’ kind of thing, I guess. But can we just roll back this pull then? I don’t really understand what was ‘won’ by removing something that does work in obfuscating ‘real’ user passwords on low trust environments, so nothing is ‘won’ and “authentication uses no javascript anymore” is a very bad argument as everything after login DOES use javascript… so this is just weird and AM really passionate of retaining at least this feature. So everything short of ‘pretty please’, but PRETTY PLEASE 🙏 ✌️😉 |
|
Communication asking for comments: https://framapiaf.org/@freshrss/117509044759169110 |
Yeah well for me its just
I know its FOSS, sure, but the negatives just clearly outweigh the positives imho and removing a thing that does at least ‘something’ for security/privacy is just a weird action. In my opinion FOSS should be about always improving not removing; willy-nilly and “Always take your time, for any change is your baby” just my 2 cents, because I care. |
Closes #2428
Highlights:
bcrypt.jsdependency, so authentication no longer depends on JavaScript.nonceendpoint from thejavascriptcontroller.<noscript>blocks that were only needed for the previous authentication flow.FreshRSS_FormAuth::checkCredentials()to accept the username, stored bcrypt hash, and plain-text password directly.FreshRSS_FormAuth::passwordRequirementsMet()to replaceFreshRSS_password_Util::check().TextEncoderanddata-max-bytes.FormAuthTestto cover:bcrypt.jsfrom the documented dependencies and updated the authentication documentation.This simplifies the authentication flow, removes the client-side bcrypt challenge, makes password validation consistent between the client and server, and adds more test coverage while keeping compatibility with existing bcrypt password hashes.
Because the password is now sent directly to the server instead of being processed by
bcrypt.js, deployments should use HTTPS. Documentation for HTTPS setup can be handled separately.Prerequisite: #9362 should be merged before this PR.