{"id":"CVE-2022-1438","aliases":["CVE-2022-1438","GHSA-w354-2f3c-qvg9"],"related":[],"kind":"vulnerability","state":"published","title":"Keycloak: xss on impersonation under specific circumstances","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","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.","source":"cvelist"},{"lang":"en","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.\n\n## Details\n\nThis 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](https://github.com/keycloak/keycloak/blob/48835576daa158443f69917ac309e1a7c951bc87/services/src/main/java/org/keycloak/authentication/AuthenticationProcessor.java#L1045)\n\n## Steps to reproduce\n\nWhen using the legacy admin console:\n\n1. Sign in as Admin user in first tab.\n2. 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).\n3. Sign in as newly created user in second tab (same browser window but second tab).\n4. Navigate back to first tab where you are signed in as admin, navigate to admin console which lists all application users.\n5. 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.\n6. After update for that user is made, use impersonate option on that modified user.\n7. You should see window with form which requires providing new credentials – fill it and submit request.\n8. 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.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Se encontró una falla en Keycloak. En circunstancias específicas, las entidades HTML no se sanitizan durante la suplantación de usuarios, lo que genera una vulnerabilidad de Cross-Site Scripting (XSS).","source":"nvd"}],"published":"2023-03-01T16:18:55.000Z","modified":"2026-06-17T04:22:27.793Z","severity":{"scorer":"redhat","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:H","score":6.4,"rating":"MEDIUM"},"severities":[{"scorer":"redhat","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:H","score":6.4,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:H","score":6.4,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:L/I:L/A:N","score":4.8,"rating":"MEDIUM"}],"cwes":["CWE-79"],"affected":[{"ranges":[],"vendor":"Red Hat","product":"Red Hat Single Sign-On 7","package":"keycloak-services","cpe":"cpe:/a:redhat:red_hat_single_sign_on:7.6","source":"cvelist"},{"ranges":[{"type":"rpm","introduced":"0:18.0.6-1.redhat_00001.1.el7sso","fixed":"*","status":"unaffected"}],"vendor":"Red Hat","product":"Red Hat Single Sign-On 7.6 for RHEL 7","package":"rh-sso7-keycloak","cpe":"cpe:/a:redhat:red_hat_single_sign_on:7.6::el7","source":"cvelist"},{"ranges":[{"type":"rpm","introduced":"0:18.0.6-1.redhat_00001.1.el8sso","fixed":"*","status":"unaffected"}],"vendor":"Red Hat","product":"Red Hat Single Sign-On 7.6 for RHEL 8","package":"rh-sso7-keycloak","cpe":"cpe:/a:redhat:red_hat_single_sign_on:7.6::el8","source":"cvelist"},{"ranges":[{"type":"rpm","introduced":"0:18.0.6-1.redhat_00001.1.el9sso","fixed":"*","status":"unaffected"}],"vendor":"Red Hat","product":"Red Hat Single Sign-On 7.6 for RHEL 9","package":"rh-sso7-keycloak","cpe":"cpe:/a:redhat:red_hat_single_sign_on:7.6::el9","source":"cvelist"},{"ranges":[{"type":"rpm","introduced":"7.6-20","fixed":"*","status":"unaffected"}],"vendor":"Red Hat","product":"RHEL-8 based Middleware Containers","package":"rh-sso-7/sso76-openshift-rhel8","cpe":"cpe:/a:redhat:rhosemc:1.0::el8","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","lastAffected":"21.0.0"}],"ecosystem":"Maven","package":"org.keycloak:keycloak-services","purl":"pkg:maven/org.keycloak/keycloak-services","source":"ghsa"},{"ranges":[],"vendor":"redhat","product":"keycloak","cpe":"cpe:2.3:a:redhat:keycloak:-:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://access.redhat.com/errata/RHSA-2023:1043","tags":["vendor-advisory","web","x-refsource-redhat","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://access.redhat.com/errata/RHSA-2023:1044","tags":["vendor-advisory","web","x-refsource-redhat","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://access.redhat.com/errata/RHSA-2023:1045","tags":["vendor-advisory","web","x-refsource-redhat","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://access.redhat.com/errata/RHSA-2023:1047","tags":["vendor-advisory","web","x-refsource-redhat","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://access.redhat.com/errata/RHSA-2023:1049","tags":["vendor-advisory","web","x-refsource-redhat","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://access.redhat.com/security/cve/CVE-2022-1438","tags":["vdb-entry","vendor-advisory","x-refsource-redhat","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://bugzilla.redhat.com/show_bug.cgi?id=2031904","tags":["issue-tracking","vendor-advisory","web","x-refsource-redhat","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/keycloak/keycloak/security/advisories/GHSA-w354-2f3c-qvg9","tags":["web"],"sources":["ghsa"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-1438","tags":["advisory"],"sources":["ghsa"]},{"url":"https://access.redhat.com/security/cve/cve-2022-1438","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/keycloak/keycloak","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/keycloak/keycloak/blob/48835576daa158443f69917ac309e1a7c951bc87/services/src/main/java/org/keycloak/authentication/AuthenticationProcessor.java#L1045","tags":["web"],"sources":["ghsa"]}],"credits":["Red Hat would like to thank Grzegorz Tworek (SISOFT s.c.) for reporting this issue."],"assigner":"redhat","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2024-09-24T15:05:51.617Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2022-1438","url":"https://www.cve.org/CVERecord?id=CVE-2022-1438","licence":"CVE Terms of Use","modified":"2024-09-24T15:06:01.676Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-w354-2f3c-qvg9","url":"https://github.com/advisories/GHSA-w354-2f3c-qvg9","licence":"CC-BY-4.0","modified":"2024-02-16T08:03:41.978Z"},{"source":"nvd","name":"NVD","id":"CVE-2022-1438","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-1438","licence":"Public domain","modified":"2026-06-17T04:22:27.793Z"}],"updatedAt":"2026-11-25T22:58:19.619Z","epss":{"score":0.0078,"percentile":0.52435,"date":"2026-11-29T12:00:22.000Z"}}