CVE-2022-4361 Keycloak vulnerable to cross-site scripting when validating URI-schemes on SAML and OIDC

Critical 10.0 Published Updated

Attackers can execute malicious scripts in Keycloak SAML or OIDC providers via crafted URLs, potentially compromising user accounts.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2022-4361?

CVE-2022-4361 is a critical cross-site scripting vulnerability in Redhat Keycloak, published on 7 Jul 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

Keycloak, an open-source identity and access management solution, has a cross-site scripting (XSS) vulnerability in the SAML or OIDC providers. The vulnerability can allow an attacker to execute malicious scripts by setting the AssertionConsumerServiceURL value or the redirect_uri.

Weakness: CWE-79, CWE-81

Which versions are affected by CVE-2022-4361?

2 open source packages ship an affected version, including org.keycloak:keycloak-services. It affects 5 products.

PackageAffectedFixed in
org.keycloak:keycloak-services MavenAll versions21.1.2
org.keycloak:keycloak-services MavenAll versions21.1.2

Products include Redhat Keycloak, Redhat Openshift Container Platform, Redhat Openshift Container Platform for Ibm Linuxone, Redhat Openshift Container Platform for Power, Redhat Single Sign-On.

How do I fix CVE-2022-4361?

Upgrade org.keycloak:keycloak-services to 21.1.2 or later.

Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.

Is CVE-2022-4361 being exploited?

There is no known exploitation of CVE-2022-4361 in the wild and no public exploit code.

Public exploit code: 2 proofs of concept on GitHub.

All Redhat Keycloak vulnerabilities

Sources

Also known as GHSA-3p62-6fjh-3p5h.

Is CVE-2022-4361 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free