Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Security] isAccountLocked() should be moved from checkPostAuth to checkPreAuth #8510

Closed
Labels
@mmucklo

Description

@mmucklo

If an account gets locked (say to a user retrying too many times), the auth will still try the credentials and return the "Bad credentials" message.

Instead once the account is locked, it should never try the authentication credentials again.

The reason for this is that it allows an attacker to guess the password of a locked account by brute force based on the response error message.

The code is in UserChecker:

/**     * {@inheritdoc}     */publicfunctioncheckPreAuth(UserInterface$user)    {if (!$userinstanceof AdvancedUserInterface) {return;        }if (!$user->isCredentialsNonExpired()) {$ex =newCredentialsExpiredException('User credentials have expired.');$ex->setUser($user);throw$ex;        }    }/**     * {@inheritdoc}     */publicfunction checkPostAuth(UserInterface$user)    {if (!$userinstanceof AdvancedUserInterface) {return;        }if (!$user->isAccountNonLocked()) {$ex =newLockedException('User account is locked.');$ex->setUser($user);throw$ex;        }

Which I suggest to change to be this:

/**     * {@inheritdoc}     */publicfunctioncheckPreAuth(UserInterface$user)    {if (!$userinstanceof AdvancedUserInterface) {return;        }if (!$user->isCredentialsNonExpired()) {$ex =newCredentialsExpiredException('User credentials have expired.');$ex->setUser($user);throw$ex;        }if (!$user->isAccountNonLocked()) {$ex =newLockedException('User account is locked.');$ex->setUser($user);throw$ex;        }    }/**     * {@inheritdoc}     */publicfunction checkPostAuth(UserInterface$user)    {if (!$userinstanceof AdvancedUserInterface) {return;        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp