ghsa-w354-2f3c-qvg9
Vulnerability from github
Published
2023-03-01 16:18
Modified
2023-09-25 17:19
Summary
Keycloak vulnerable to Cross-site Scripting
Details

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.

Details

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

Steps to reproduce

When using the legacy admin console:

  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.
Show details on source website


{
   affected: [
      {
         package: {
            ecosystem: "Maven",
            name: "org.keycloak:keycloak-services",
         },
         ranges: [
            {
               events: [
                  {
                     introduced: "0",
                  },
                  {
                     last_affected: "21.0.0",
                  },
               ],
               type: "ECOSYSTEM",
            },
         ],
      },
   ],
   aliases: [
      "CVE-2022-1438",
   ],
   database_specific: {
      cwe_ids: [
         "CWE-79",
      ],
      github_reviewed: true,
      github_reviewed_at: "2023-03-01T16:18:55Z",
      nvd_published_at: "2023-09-20T14:15:12Z",
      severity: "MODERATE",
   },
   details: "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.\n",
   id: "GHSA-w354-2f3c-qvg9",
   modified: "2023-09-25T17:19:40Z",
   published: "2023-03-01T16:18:55Z",
   references: [
      {
         type: "WEB",
         url: "https://github.com/keycloak/keycloak/security/advisories/GHSA-w354-2f3c-qvg9",
      },
      {
         type: "ADVISORY",
         url: "https://nvd.nist.gov/vuln/detail/CVE-2022-1438",
      },
      {
         type: "WEB",
         url: "https://access.redhat.com/errata/RHSA-2023:1043",
      },
      {
         type: "WEB",
         url: "https://access.redhat.com/errata/RHSA-2023:1044",
      },
      {
         type: "WEB",
         url: "https://access.redhat.com/errata/RHSA-2023:1045",
      },
      {
         type: "WEB",
         url: "https://access.redhat.com/errata/RHSA-2023:1047",
      },
      {
         type: "WEB",
         url: "https://access.redhat.com/errata/RHSA-2023:1049",
      },
      {
         type: "WEB",
         url: "https://access.redhat.com/security/cve/cve-2022-1438",
      },
      {
         type: "WEB",
         url: "https://bugzilla.redhat.com/show_bug.cgi?id=2031904",
      },
      {
         type: "PACKAGE",
         url: "https://github.com/keycloak/keycloak",
      },
      {
         type: "WEB",
         url: "https://github.com/keycloak/keycloak/blob/48835576daa158443f69917ac309e1a7c951bc87/services/src/main/java/org/keycloak/authentication/AuthenticationProcessor.java#L1045",
      },
   ],
   schema_version: "1.4.0",
   severity: [
      {
         score: "CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:H",
         type: "CVSS_V3",
      },
   ],
   summary: "Keycloak vulnerable to Cross-site Scripting",
}


Log in or create an account to share your comment.

Security Advisory comment format.

This schema specifies the format of a comment related to a security advisory.

UUIDv4 of the comment
UUIDv4 of the Vulnerability-Lookup instance
When the comment was created originally
When the comment was last updated
Title of the comment
Description of the comment
The identifier of the vulnerability (CVE ID, GHSA-ID, PYSEC ID, etc.).



Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.