Sign-in hardening: count parallel wrong passwords of a session, and small follow-ups of the signed-in count

Đang mở
#3,447 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
csharp
Lĩnh vực
authentication, backend

Hướng nghiên cứu

Start in src/FluentCMS.Core/Identity/ and trace CmsUserManager.ChangePasswordAsync, TwoFactorService.RequireCodeAsync, ClearingPasswordChangeAsync, SetPasswordAsync, and CmsUserStore.cs; the issue also names docs/host-configuration.md. Read the linked follow-ups and their review context, then find the existing tests for these flows. Done means the five listed behaviors are covered by code, tests, or the specified spec update, and the documentation sentence is corrected.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

area:identity security type:bug

Follow-ups of #3371, #3378 and #3381 (#3444), found in its review. Paths are under src/FluentCMS.Core/Identity/.

  • Parallel wrong passwords on change-password are not all counted. CmsUserManager.ChangePasswordAsync ignores the result of SignedInAccessFailedAsync, as it ignored AccessFailedAsync before. A holder of a stolen cookie who posts N guesses at once has them all read one concurrency stamp: each answers "wrong password", one save wins, and the count rises by one. A right guess that loses its save answers ConcurrencyFailure, which tells the sender it was right. The per-address Auth limit (20 a minute) is then the only bound, against the intended 5 in 5 minutes. Codes are not affected, since a right code must win its own save.
  • A right two-factor code resets the count of wrong passwords too. ResetSignedInFailuresAsync is called from TwoFactorService.RequireCodeAsync, so a session that holds the second factor gives 4 wrong passwords, one right code at /me/two-factor/recovery-codes, and starts again.
  • The forced-change flag is put back over a reloaded user. ClearingPasswordChangeAsync and SetPasswordAsync restore mustChangePassword after a failed save without checking that the user was not reloaded, the pattern #3381 fixed for the failure count. No path of core saves the user again in that scope today.
  • IsTokenKeyViolation matches the table name anywhere in the provider's message (CmsUserStore.cs). SQL Server repeats the duplicate key value, so another unique violation whose value contains cms_user_token would be answered as a refusal. It can never become a success.
  • docs/host-configuration.md still says the token endpoint refuses a code or refresh token of a locked-out user, which #3271 ended.

Wanted

  • Every wrong current password of a session counted when requests run at once, and no different answer for a right one that lost its save, with a test.
  • Wrong passwords and wrong codes of a session counted apart, or the reason they share a count recorded in the spec.
  • The flag restored only when the user was not reloaded.
  • The token key matched by the constraint's name on the three providers.
  • The sentence corrected.

Bundle 28.

Ngôn ngữ chính
C#
Star
567
Fork
107
Merge trung bình
1 giờ 19 phút
Pull request đã merge (30 ngày)
353

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của fluentcms/FluentCMS

Tất cả issue của fluentcms/FluentCMS

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.