Miggo Logo

CVE-2021-20222: Code injection in keycloak

8.4

CVSS Score
3.1

Basic Information

EPSS Score
0.65479%
Published
5/13/2021
Updated
1/29/2023
KEV Status
No
Technology
TechnologyJava

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
org.keycloak:keycloak-parentmaven>= 9.0.0, < 12.0.312.0.3

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot 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.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

* *l*w w*s *oun* in k*y*lo*k. T** n*w ***ount *onsol* in k*y*lo*k **n *llow m*li*ious *o** to ** *x**ut** usin* t** r***rr*r URL. T** *i***st t*r**t *rom t*is vuln*r**ility is to **t* *on*i**nti*lity *n* int**rity *s w*ll *s syst*m *v*il**ility.

Reasoning

T** vuln*r**ility st*ms *rom improp*r n*utr*liz*tion o* t** r***rr*r URI p*r*m*t*r in t** ***ount *onsol* t*mpl*t*. T** *ommit *i** s*ows t** vuln*r**l* lin* w*s usin* *r**M*rk*r's ?no_*s* *ir**tiv* to output r*w r***rr*r_uri, w*i** *oul* *ont*in *tt