Miggo Logo

CVE-2022-2668:
Keycloak SAML javascript protocol mapper: Uploading of scripts through admin console

7.2

CVSS Score
3.1

Basic Information

EPSS Score
0.46429%
CWE
-
Published
9/23/2022
Updated
1/8/2023
KEV Status
No
Technology
TechnologyJava

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
org.keycloak:keycloak-parentmaven< 19.0.219.0.2

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stemmed from three key issues: 1) The isScriptForSpi method in KeycloakProcessor failed to properly distinguish SAML mappers from other mappers, allowing SAML script uploads even when disabled. 2) ScriptBasedMapper lacked feature flag enforcement, making SAML script execution always available. 3) The new SAML_MAPPERS infrastructure in ScriptProviderDescriptor provided a pathway for script injection that bypassed existing security controls. The commit patched these by introducing SAML_MAPPERS separation, adding feature checks in ScriptBasedMapper, and modifying SPI validation logic in KeycloakProcessor.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

*n issu* w*s *is*ov*r** in K*y*lo*k *llows *r*itr*ry J*v*s*ript to ** uplo**** *or t** S*ML proto*ol m*pp*r *v*n i* t** `UPLO**_S*RIPTS` ***tur* is *is**l**

Reasoning

T** vuln*r**ility st*mm** *rom t*r** k*y issu*s: *) T** isS*ript*orSpi m*t*o* in K*y*lo*kPro**ssor **il** to prop*rly *istin*uis* S*ML m*pp*rs *rom ot**r m*pp*rs, *llowin* S*ML s*ript uplo**s *v*n w**n *is**l**. *) S*ript**s**M*pp*r l**k** ***tur* *l