CVE-2022-2232: Keycloak ldap federation Keycloak Vulnerable To LDAP Injection Vulnerability
LOWCVE-2022-2232 is a LOW keycloak vulnerable to ldap injection vulnerability (CWE-90: Improper Neutralization of Special Elements used in an LDAP Query ('LDAP Injection')) affecting Keycloak ldap federation libraries in the Maven ecosystem. The issue involves keycloak vulnerable to ldap injection on usernameform login. Remediation is available by upgrading affected packages to version 23.0.1.
CVE-2022-2232 at a Glance
How to Fix CVE-2022-2232
To remediate this vulnerability, upgrade all affected Keycloak ldap federation dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-ldap-federation</artifactId>
<version>23.0.1</version>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-services</artifactId>
<version>23.0.1</version>
</dependency>
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
mvn dependency:tree -Dincludes=org.keycloak
How to Check if You Are Affected
To determine whether your Java application is affected by CVE-2022-2232, inspect your build dependencies using the Maven Dependency Plugin:
mvn dependency:tree -Dincludes=org.keycloak
Analyze the terminal output to locate any version of Keycloak ldap federation in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 23.0.1), your application is affected.
Note: The mvn dependency:tree -Dincludes=org.keycloak command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-90: Improper Neutralization of Special Elements used in an LDAP Query ('LDAP Injection'), where the product constructs all or part of an ldap query using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended ldap query when it is sent to a downstream component. In Keycloak ldap federation, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2022-2232 Affected Keycloak ldap federation Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
org.keycloak:keycloak-ldap-federation
|
Maven |
< 23.0.1
|
23.0.1
|
|
org.keycloak:keycloak-services
|
Maven |
< 23.0.1
|
23.0.1
|
References
Frequently Asked Questions
What is CVE-2022-2232?
Which Keycloak ldap federation versions are affected?
What version fixes CVE-2022-2232?
Is keycloak-ldap-federation affected?
Is keycloak-services affected?
What CWE is associated with CVE-2022-2232?
How can I check Maven dependencies for CVE-2022-2232?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-8hc5-rmgf-qx6p",
"modified" : "2023-11-29T21:33:07Z",
"published" : "2023-11-29T21:33:07Z",
"aliases" : [ "CVE-2022-2232" ],
"summary" : "Keycloak vulnerable to LDAP Injection on UsernameForm Login",
"details" : "A flaw was found in the Keycloak package. This flaw allows an attacker to benefit from an LDAP query and access existing usernames in the server.",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "Maven",
"name" : "org.keycloak:keycloak-ldap-federation"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "23.0.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.keycloak:keycloak-services"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "23.0.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/keycloak/keycloak/security/advisories/GHSA-8hc5-rmgf-qx6p"
}, {
"type" : "WEB",
"url" : "https://github.com/keycloak/keycloak/commit/4252e394cf725b16f7e4e19aa32b03fd3fe13fde"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/keycloak/keycloak"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-90" ],
"severity" : "LOW",
"github_reviewed" : true,
"github_reviewed_at" : "2023-11-29T21:33:07Z",
"nvd_published_at" : null
}
}