Repository navigation
Harden email factor revoke and sign-in links - #493
Merged
Merged
Conversation
Previously the "this wasn't me" revoke link only needed the tool_mfa instance ID. IDs are sequential, so anyone could revoke a user's email factor and end all of their sessions without authenticating. Revoke link (factor/email/email.php, renderer.php): - Include the emailed code in the revoke link and require it (secret is now a required param). - Limit guesses on the unauthenticated revoke form. - Reject expired codes before an attempt is counted. - Check the user exists and isn't deleted before revoking. - Suspend accounts with user_suspend_user() instead of a raw set_field, so user_updated/user_suspended events fire Email-link sign-in (pass=1): - Only accept pending, unrevoked email codes. - Reject expired codes. - Load the lock state from the DB before checking for the locked state, so a fresh session can't get around the lockout. Both: - Compare codes with hash_equals() on strings (constant time, no type juggling). Other: - Add a test that the revoke link in the email includes the code. - Version bumps.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously the "this wasn't me" revoke link only needed the tool_mfa instance ID. IDs are sequential, so anyone could revoke a user's email factor and end all of their sessions without authenticating.
Revoke link (factor/email/email.php, renderer.php):
Email-link sign-in (pass=1):
Both:
Other: