Bug 2031904 (CVE-2022-1438)

Summary: CVE-2022-1438 keycloak: XSS on impersonation under specific circumstances
Product: [Other] Security Response Reporter: mulliken
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: boliveir, chazlett, drieden, pdrozd, pjindal, pskopek, security-response-team, sthorger
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
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.
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-03-02 01:48:02 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2031906    

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