This repository has been archived by the owner on May 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 84
Fix for security hole where user can bypass 2fa #73
Closed
MikeRogers0
wants to merge
1
commit into
twilio:master
from
MikeRogers0:bugfix/user_being_resigned_in_on_session_create
Closed
Fix for security hole where user can bypass 2fa #73
MikeRogers0
wants to merge
1
commit into
twilio:master
from
MikeRogers0:bugfix/user_being_resigned_in_on_session_create
Conversation
This file contains 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
Because the `warden` variable was not locked after we signed out the user, the user would get logged in (bypassing the 2fa completely) before they verified their token.
MikeRogers0
commented
Dec 16, 2016
@@ -62,7 +63,6 @@ def check_request_and_redirect_to_verify_token | |||
session["#{resource_name}_return_to"] = return_to if return_to | |||
|
|||
redirect_to verify_authy_path_for(resource_name) | |||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This return done nothing.
MikeRogers0
commented
Dec 16, 2016
@@ -53,7 +53,8 @@ def check_request_and_redirect_to_verify_token | |||
|
|||
remember_me = (params.fetch(resource_name, {})[:remember_me].to_s == "1") | |||
return_to = session["#{resource_name}_return_to"] | |||
sign_out | |||
sign_out resource_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the sign_out more specific to the resource.
MikeRogers0
commented
Dec 16, 2016
@@ -53,7 +53,8 @@ def check_request_and_redirect_to_verify_token | |||
|
|||
remember_me = (params.fetch(resource_name, {})[:remember_me].to_s == "1") | |||
return_to = session["#{resource_name}_return_to"] | |||
sign_out | |||
sign_out resource_name | |||
warden.lock! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stops any further changes to the signed in users during this request.
MikeRogers0
commented
Dec 17, 2016
|
||
let(:user){ create_user(password: "12345678") } | ||
|
||
describe "POST #create" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the test which recreates the bug I found :)
current_user
would be set on GET_verify_authy page
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Because the
warden
variable was not locked after we signed out theuser, the user would get logged in (bypassing the 2fa completely) before
they verified their token.