Bug 2031904 (CVE-2022-1438) - CVE-2022-1438 keycloak: XSS on impersonation under specific circumstances
Summary: CVE-2022-1438 keycloak: XSS on impersonation under specific circumstances
Keywords:
Status: CLOSED ERRATA
Alias: CVE-2022-1438
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 2031906
TreeView+ depends on / blocked
 
Reported: 2021-12-13 16:33 UTC by mulliken
Modified: 2023-09-11 20:44 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
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.
Clone Of:
Environment:
Last Closed: 2023-03-02 01:48:02 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2023:1043 0 None None None 2023-03-01 21:42:44 UTC
Red Hat Product Errata RHSA-2023:1044 0 None None None 2023-03-01 21:45:09 UTC
Red Hat Product Errata RHSA-2023:1045 0 None None None 2023-03-01 21:47:37 UTC
Red Hat Product Errata RHSA-2023:1047 0 None None None 2023-03-01 21:50:25 UTC
Red Hat Product Errata RHSA-2023:1049 0 None None None 2023-03-01 21:58:34 UTC

Description mulliken 2021-12-13 16:33:46 UTC
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.

Comment 6 errata-xmlrpc 2023-03-01 21:42:43 UTC
This issue has been addressed in the following products:

  Red Hat Single Sign-On 7.6 for RHEL 7

Via RHSA-2023:1043 https://access.redhat.com/errata/RHSA-2023:1043

Comment 7 errata-xmlrpc 2023-03-01 21:45:07 UTC
This issue has been addressed in the following products:

  Red Hat Single Sign-On 7.6 for RHEL 8

Via RHSA-2023:1044 https://access.redhat.com/errata/RHSA-2023:1044

Comment 8 errata-xmlrpc 2023-03-01 21:47:35 UTC
This issue has been addressed in the following products:

  Red Hat Single Sign-On 7.6 for RHEL 9

Via RHSA-2023:1045 https://access.redhat.com/errata/RHSA-2023:1045

Comment 9 errata-xmlrpc 2023-03-01 21:50:23 UTC
This issue has been addressed in the following products:

  RHEL-8 based Middleware Containers

Via RHSA-2023:1047 https://access.redhat.com/errata/RHSA-2023:1047

Comment 10 errata-xmlrpc 2023-03-01 21:58:32 UTC
This issue has been addressed in the following products:

  Red Hat Single Sign-On

Via RHSA-2023:1049 https://access.redhat.com/errata/RHSA-2023:1049

Comment 11 Product Security DevOps Team 2023-03-02 01:48:00 UTC
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):

https://access.redhat.com/security/cve/cve-2022-1438


Note You need to log in before you can comment on or make changes to this bug.