CVE-2021-20222: Code injection in keycloak
8.4
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.65479%
CWE
Published
5/13/2021
Updated
1/29/2023
KEV Status
No
Technology
Java
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:H
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
org.keycloak:keycloak-parent | maven | >= 9.0.0, < 12.0.3 | 12.0.3 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from improper neutralization of the referrer URI parameter in the account console template. The commit diff shows the vulnerable line was using FreeMarker's ?no_esc directive to output raw referrer_uri, which could contain attacker-controlled JavaScript. The patched version removes the unsafe escaping directive and adds proper sanitization. This matches the CWE-79 (XSS) description and the test case demonstrating reflected XSS via referrer URL manipulation.