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

Aperta
#3,447 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
csharp

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
C#
Stelle
567
Fork
107
Merge medio
1h 19m
PR unite (30g)
353

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di fluentcms/FluentCMS

Tutte le issue di fluentcms/FluentCMS

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.