Skip to content

Harden race condition when submitting 2FA during password reset #66824

Closed

Description

@cincuranet

There's incredibly niche (and pretty contrived) race condition between submitting 2FA (while using old password) and resetting password at the same time.

Here's a sequence with two browser windows:
W1: Login with current password. 2FA is requested.
W2: Reset password.
W1: Submit 2FA.

Even though 2FA was submitted after password reset, the W1 still completes the login process.

Fix could look like:

  • Embed the securityStamp in the TwoFactorUserId principal (similar to StoreRememberClient).
  • Validate the stamp in RetreiveTwoFactorInfoAsync before returning the user.
  • Wire up the cookie validator in both registration paths.
  • Correct the xmldoc on SecurityStampValidator.ValidateAysnc<TValidator>.

Activity

  1. github-actions commented on May 25, 2026

    @github-actions
    Contributor

    Triage Summary

    Area: area-identity (Issue involves SignInManager, two-factor authentication flow, SecurityStampValidator, TwoFactorUserId principal, and password reset — all core Identity functionality)

    Type: bug (Describes a race condition security flaw where 2FA validation succeeds even after the password has been reset, which is unexpected behavior)

    Potential Duplicates

    Notes

    • This appears to be a security hardening issue rather than a critical vulnerability, as the reporter acknowledges it's "incredibly niche (and pretty contrived)"
    • The author is a contributor and has provided a detailed fix proposal involving embedding securityStamp validation in the 2FA flow
    • This relates to the area-security label's domain (security hardening), but since it's specifically about Identity's 2FA and password reset flows, area-identity is the most appropriate classification

    Generated by Issue Triage Agent for dotnet/aspnetcore for issue #66824 · ● 459.9K · ◷

  2. added
    area-identity
    on May 25, 2026
  3. self-assigned this
    on Aug 11, 2026
  4. added this to the 11.0-rc2 milestone on Aug 19, 2026
  5. added theissue type on Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-identity

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions