Repository navigation
Conversation
|
Is this still a draft? |
|
Aside from
I think it was ready |
| $isPOST = Minz_Request::isPost() && !Minz_Session::paramBoolean('POST_to_GET'); | ||
| Minz_Session::_param('POST_to_GET'); | ||
|
|
||
| if ($isPOST) { |
| $s = $user_conf->passwordHash; | ||
| if (strlen($s) >= 60) { | ||
| // CRYPT_BLOWFISH Salt: "$2a$", a two digit cost parameter, "$", and 22 characters from the alphabet "./0-9A-Za-z". | ||
| $this->view->salt1 = substr($s, 0, 29); |
There was a problem hiding this comment.
Does it have to be done this way?
There was a problem hiding this comment.
I cannot remember the exact details, but this is not the only solution, if you have something else in mind.
This was a way to extract the salt.
|
The timing thing from the description is still there though. Absent users hit crypt() and real ones just substr(), so absent comes back a lot slower: I got ~6ms for a real user vs ~100ms for a missing one and the ranges didn't overlap, so you can still tell them apart by response time alone. |
|
Sure, you can send the patch here |
|
Patch below. It skips crypt() on the fake path and fixes the last salt char by hand, so you - // Failure: Return static random data for given username.
- $salt = substr(str_replace('+', '.', base64_encode(hash('sha256', FreshRSS_Context::systemConf()->salt . $user))), 0, 22);
- $this->view->salt1 = substr(crypt('failure', '$2y$09$' . $salt), 0, 29);
+ // Failure: static per-user salt, indistinguishable from a real one. Not crypt() here: it
+ // ran only on this branch, so a missing user was slower and enumerable by timing.
+ $alphabet = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
+ $salt = substr(str_replace('+', '.', base64_encode(hash('sha256', FreshRSS_Context::systemConf()->salt . $user))), 0, 22);
+ $salt[21] = '.Oeu'[strpos($alphabet, $salt[21]) >> 4]; // last char carries 2 bits; keep it canonical like crypt() did
+ $this->view->salt1 = '$2y$09$' . $salt; |
|
Better replacement: #9358 |
|
Another follow-up: #9568 |

+redirect to index in formLogin if logged in
+try to simplify formLogin by not using internal redirects
This is a WIP, have not reviewed yet properly if timing attacks are possible for user enumeration.Following user enumeration techniques have been fixed:
?c=javascript&a=nonce&user=<user>displayed a differentsalt1value each time for non-existent users, now a value is displayed based on hash of username if the user doesn't existnonceendpointOne user enumeration technique that is not possible to fix is when the registration form is enabled (can't register existing usernames)