Skip to content
This repository has been archived by the owner on May 30, 2022. It is now read-only.

Fix for security hole where user can bypass 2fa #73

Closed
wants to merge 1 commit into from
Closed

Fix for security hole where user can bypass 2fa #73

wants to merge 1 commit into from

Conversation

MikeRogers0
Copy link
Contributor

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.

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.
@@ -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
Copy link
Contributor Author

@MikeRogers0 MikeRogers0 Dec 16, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This return done nothing.

@@ -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
Copy link
Contributor Author

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.

@@ -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!
Copy link
Contributor Author

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.


let(:user){ create_user(password: "12345678") }

describe "POST #create" do
Copy link
Contributor Author

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 :)

@MikeRogers0
Copy link
Contributor Author

@senekis @vargasx Any plans to merge this one?

@shaneog
Copy link

shaneog commented Apr 11, 2017

Ping @senekis @vargasx. Would be great to get this merged.

@MikeRogers0 MikeRogers0 changed the title Fixes bug where current_user would be set on GET_verify_authy page Fix for security hole where user can bypass 2fa Apr 19, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants