CVE-2022-1438: Keycloak: xss on impersonation under specific circumstances

Published Dec 13, 2021
·
Updated

A flaw was found in Keycloak. Under specific circumstances, HTML entities are not sanitized during user impersonation, resulting in a Cross-site scripting (XSS) vulnerability.

Other sources

This issue is the result of code found in the exception here: https://github.com/keycloak/keycloak/blob/48835576daa158443f69917ac309e1a7c951bc87/services/src/main/java/org/keycloak/authentication/AuthenticationProcessor.java#L1045

Reproduction:

1. Sign in as Admin user in first tab. 2. In that tab create new user in keycloak admin section > intercept user creation request and modify it by including malicious js script there (in username field). 3. Sign in as newly created user in second tab (same browser window but second tab). 4. Navigate back to first tab where you are signed in as admin, navigate to admin console which lists all application users. 5. Choose any user (except newly created malicious one) – modify anything for that user in his settings. E.g. navigate to credentials tab and set new credentials for him. Also set new password as temporary. 6. After update for that user is made, use impersonate option on that modified user. 7. You should see window with form which requires providing new credentials – fill it and submit request. 8. Just after submiting request user will get notified that “You are already authenticated as different user ‘[user + payload]’ in this session. Please sign out first.” And malicious payload will be executed instantly.

Red Hat

Affected Software

5 affected componentsFixes available
maven/org.keycloak:keycloak-services<=21.0.0
redhat/rh-sso7-keycloak<0:18.0.6-1.redhat_00001.1.el7
0:18.0.6-1.redhat_00001.1.el7
redhat/rh-sso7-keycloak<0:18.0.6-1.redhat_00001.1.el8
0:18.0.6-1.redhat_00001.1.el8
redhat/rh-sso7-keycloak<0:18.0.6-1.redhat_00001.1.el9
0:18.0.6-1.redhat_00001.1.el9
redhat Keycloak

Event History

Dec 13, 2021
Data Sourced
via Red Hat·04:33 PM
DescriptionSeverityAffected Software
Feb 28, 2023
CVE Published
06:56 PM
Mar 1, 2023
Advisory Published
04:18 PM
Sep 20, 2023
CVE Published
via MITRE·01:34 PM
Data Sourced
via MITRE·01:34 PM
DescriptionSeverityWeakness

Parent advisories

This vulnerability appears in the following advisories.

Frequently Asked Questions

1

What is the vulnerability ID?

The vulnerability ID is CVE-2022-1438.

2

What is the severity of CVE-2022-1438?

The severity of CVE-2022-1438 is medium (6.4).

3

How does CVE-2022-1438 occur?

CVE-2022-1438 occurs when HTML entities are not sanitized during user impersonation in Keycloak, resulting in a Cross-site scripting (XSS) vulnerability.

4

What software is affected by CVE-2022-1438?

The following software versions are affected by CVE-2022-1438: - keycloak-services version 21.0.0 - rh-sso7-keycloak versions up to 0:18.0.6-1.redhat_00001.1.el7, 0:18.0.6-1.redhat_00001.1.el8, and 0:18.0.6-1.redhat_00001.1.el9 - Redhat Keycloak

5

How can CVE-2022-1438 be fixed?

CVE-2022-1438 can be fixed by upgrading Keycloak to a version that includes the necessary fixes. Refer to the provided references for more details.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203