unosquare / passcore

A self-service password management tool for Active Directory
https://unosquare.github.io/passcore/
MIT License
1.03k stars 221 forks source link

Wrong current password sends multiple login attempts #677

Open MaksaUniver opened 1 year ago

MaksaUniver commented 1 year ago

PassCore Server

Describe the bug When I intentionally enter wrong password in order to test PassCore since it's new installation, badPwdCount attribute value increments by 2, 3, or even 4 on every attempt. Problem is that it also automatically locks account.

To Reproduce Steps to reproduce the behavior:

  1. Enter all required data for resetting password
  2. Intentionally enter wrong current password
  3. Check badPwdCount attribute value in Active Directory

Expected behavior badPwdCount attribute value should increment by 1.

Desktop (please complete the following information):

MaksaUniver commented 1 year ago

Log information:

Hosting environment: Production

Content root path: C:\inetpub\wwwroot\PassCore

Now listening on: http://reset.server.local:80/

Now listening on: https://reset.server.local:443/

Application started. Press Ctrl+C to shut down.

info: Microsoft.AspNetCore.Hosting.Diagnostics[1]

  Request starting HTTP/2.0 GET https://reset.server.local/  

info: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[6]

  The file /index.html was not modified

info: Microsoft.AspNetCore.Hosting.Diagnostics[2]

  Request finished in 24.3604ms 304 text/html

info: Microsoft.AspNetCore.Hosting.Diagnostics[1]

  Request starting HTTP/2.0 GET https://reset.server.local/api/password  

info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]

  Executing endpoint 'Unosquare.PassCore.Web.Controllers.PasswordController.Get (Unosquare.PassCore.Web)'

info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[3]

  Route matched with {action = "Get", controller = "Password"}. Executing controller action with signature Microsoft.AspNetCore.Mvc.IActionResult Get() on controller Unosquare.PassCore.Web.Controllers.PasswordController (Unosquare.PassCore.Web).

info: Microsoft.AspNetCore.Mvc.Infrastructure.SystemTextJsonResultExecutor[1]

  Executing JsonResult, writing value of type 'Unosquare.PassCore.Web.Models.ClientSettings'.

info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[2]

  Executed action Unosquare.PassCore.Web.Controllers.PasswordController.Get (Unosquare.PassCore.Web) in 21.8165ms

info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]

  Executed endpoint 'Unosquare.PassCore.Web.Controllers.PasswordController.Get (Unosquare.PassCore.Web)'

info: Microsoft.AspNetCore.Hosting.Diagnostics[2]

  Request finished in 67.9911ms 200 application/json; charset=utf-8

info: Microsoft.AspNetCore.Hosting.Diagnostics[1]

  Request starting HTTP/2.0 POST https://reset.server.local/api/password application/json 132

info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]

  Executing endpoint 'Unosquare.PassCore.Web.Controllers.PasswordController.Post (Unosquare.PassCore.Web)'

info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[3]

  Route matched with {action = "Post", controller = "Password"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] Post(Unosquare.PassCore.Web.Models.ChangePasswordModel) on controller Unosquare.PassCore.Web.Controllers.PasswordController (Unosquare.PassCore.Web).

warn: Unosquare.PassCore.PasswordProvider.PasswordChangeProvider[0]

  Using AutomaticContext

info: Unosquare.PassCore.PasswordProvider.PasswordChangeProvider[0]

  PerformPasswordChange for user user.name@server.local

fail: Unosquare.PassCore.PasswordProvider.PasswordChangeProvider[888]

  ValidateGroups

System.NullReferenceException: Object reference not set to an instance of an object.

at Unosquare.PassCore.PasswordProvider.PasswordChangeProvider.b__7_0(Principal x) in C:\Unosquare\passcore\src\Unosquare.PassCore.PasswordProvider\PasswordChangeProvider.cs:line 167

at System.Linq.Enumerable.Any[TSource](IEnumerable1 source, Func2 predicate)

at Unosquare.PassCore.PasswordProvider.PasswordChangeProvider.ValidateGroups(UserPrincipal userPrincipal) in C:\Unosquare\passcore\src\Unosquare.PassCore.PasswordProvider\PasswordChangeProvider.cs:line 167

dbug: Unosquare.PassCore.PasswordProvider.PasswordChangeProvider[0]

  ValidateUserCredentials GetLastWin32Error 1326

warn: Unosquare.PassCore.PasswordProvider.PasswordChangeProvider[0]

  The User principal password is not valid

info: Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor[1]

  Executing ObjectResult, writing value of type 'Unosquare.PassCore.Web.Models.ApiResult'.

info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[2]

  Executed action Unosquare.PassCore.Web.Controllers.PasswordController.Post (Unosquare.PassCore.Web) in 613.7161ms

inf