Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two factor code useable more than once #29

Open
theglobe opened this issue May 18, 2020 · 3 comments
Open

Two factor code useable more than once #29

theglobe opened this issue May 18, 2020 · 3 comments

Comments

@theglobe
Copy link

theglobe commented May 18, 2020

It is possible to use the second factor code more than once, e.g. when using the EmailTokenProvider. For security, I would expect that the second factor code becomes invalid after a successful login.

To reproduce:

  1. Log in with two factors.
  2. Log out
  3. Log in with two factors, using the second factor code from step 1.

A possible workaround is to call UserManager.UpdateSecurityStampAsync(userId) after a successful two factor authentication. This will invalidate all issued second factor codes for the user.

@nhendersn52
Copy link

Thanks for posting that workaround, I've been trying to find a way to invalidate used codes.
I would also recommend calling that method before the code is generated, since any previous codes that have been generated that are still within the six minute window can be used if the user hasn't successfully signed in. Very strange that this functionality exists.

@theglobe
Copy link
Author

Good point! Thanks!

By the way, is this project still maintained or has it moved somewhere else?

@theglobe
Copy link
Author

theglobe commented Aug 18, 2020

Described the workaround more elaborately in an answer on Stack Overflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants