Skip to content

Enforce client minimum ACR for logins not started at the authorization endpoint - #55461

Open
gaoyikeshuer wants to merge 1 commit into
keycloak:mainfrom
gaoyikeshuer:cve-55382
Open

gaoyikeshuer wants to merge 1 commit into
keycloak:mainfrom
gaoyikeshuer:cve-55382

Conversation

@gaoyikeshuer

@gaoyikeshuer gaoyikeshuer commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

after fix:

Screen.Recording.2026-11-23.at.14.30.59.mov

The client's minimum ACR was only checked when login started from the normal login page, so starting from the forgot password link skipped the second factor. now it is read from the client settings whenever it was not recorded.

Closes #55382

@gaoyikeshuer
gaoyikeshuer requested a review from a team as a code owner November 23, 2026 12:58
Copilot AI balanced review requested due to automatic review settings November 23, 2026 12:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Shared ACR/LoA resolution changes require end-to-end validation across reset, action-token, and SSO flows, since integration tests were not run and regression coverage is limited.

No open issues 🎉

What changed in this PR

Addresses #55382 by applying client-configured authentication levels when a login session has no recorded requirement, preventing second-factor checks from being skipped when login starts from the forgot-password page.

Changes:

  • Fall back to the client’s minimum and default ACR settings when the requested authentication level is absent.
  • Add a regression test confirming that returning to login from a direct password-reset link requires OTP for a client with minimum ACR 2.
File Description
tests/​base/​src/​test/​java/​org/​keycloak/​tests/​forms/​LevelOfAssuranceEssentialAcrTest.java Adds an OTP user, minimum-ACR client, and regression test for the password-reset entry point.
services/​src/​main/​java/​org/​keycloak/​authentication/​authenticators/​util/​AcrStore.java Derives the requested authentication level from client configuration when the session note is missing.

Review effort: Balanced

@gaoyikeshuer gaoyikeshuer changed the title Fix second factor got skipped when login started from forgot password… Enforce client minimum ACR for logins not started at the authorization endpoint Nov 23, 2026
… page.

Closes keycloak#55382

Signed-off-by: Yike Gao <yikegao8@gmail.com>
Copilot AI balanced review requested due to automatic review settings November 23, 2026 15:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The shared ACR security fix requires browser/runtime validation across reset-credentials, action-token continuations, and SSO, but the added regression covers only the reset-link-to-login path.

No open issues 🎉

Review effort: Balanced

@rmartinc rmartinc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @gaoyikeshuer! LGTM! Just a nit-pick in the test to finish the login and assert the acr is 2.

Comment on lines +474 to +483
driver.driver().navigate().to(realm.getBaseUrl() + "/login-actions/reset-credentials?client_id=" + minimumAcrOauth.getClientId()
+ "&redirect_uri=" + minimumAcrOauth.getRedirectUri());
resetPasswordPage.assertCurrent();
resetPasswordPage.backToLogin();
loginUsernamePage.fillLoginWithUsernameOnly(otpUser.getUsername());
loginUsernamePage.submit();
passwordPage.fillPassword(otpUser.getPassword());
passwordPage.submit();

loginTotpPage.assertCurrent();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to complete the login and assert the ACR too. Something like the following:

        driver.open(realm.getBaseUrl() + "/login-actions/reset-credentials?client_id=" + minimumAcrOauth.getClientId()
                + "&redirect_uri=" + minimumAcrOauth.getRedirectUri());
        resetPasswordPage.assertCurrent();
        resetPasswordPage.backToLogin();
        loginUsernamePage.assertCurrent();
        loginUsernamePage.fillLoginWithUsernameOnly(otpUser.getUsername());
        loginUsernamePage.submit();
        passwordPage.assertCurrent();
        passwordPage.fillPassword(otpUser.getPassword());
        passwordPage.submit();

        loginTotpPage.assertCurrent();
        loginTotpPage.login(new TimeBasedOTP().generateTOTP("totpsecret"));
        driver.waiting().waitForOAuthCallback();
        EventAssertion.expectLoginSuccess(events.poll());
        AccessTokenResponse tokenResponse = minimumAcrOauth.doAccessTokenRequest(minimumAcrOauth.parseLoginResponse().getCode());
        assertEquals("2", minimumAcrOauth.parseToken(tokenResponse.getAccessToken(), AccessToken.class).getAcr());

Imports are missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CVE-2026-133228] A client's minimum ACR is not applied when the login starts at the credential reset endpoint (Keycloak 26.8.2)

3 participants