CVE-2024-5967: Keycloak ldap federation Keycloak Leaks Configured LDAP Bind Vulnerability

LOW
Advisory Identifier: GHSA-c25h-c27q-5qpv
CVSS 2.7
CWE-276
Published
Advisory Summary

CVE-2024-5967 is a LOW (CVSS 2.7) keycloak leaks configured ldap bind vulnerability (CWE-276: Incorrect Default Permissions) affecting Keycloak ldap federation libraries in the Maven ecosystem. The issue involves keycloak leaks configured ldap bind credentials through the keycloak admin console. Remediation is available by upgrading affected packages to version 25.0.1, 22.0.12, 24.0.6.

CVE-2024-5967 at a Glance

CVE Identifier CVE-2024-5967
GHSA Identifier GHSA-c25h-c27q-5qpv
Severity LOW
CVSS v3.1 Base Score 2.7
CWE Classification CWE-276: Incorrect Default Permissions
Affected Product Keycloak ldap federation
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 2.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required High (PR:H)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2024-5967

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.

org.keycloak:keycloak-ldap-federation fixed: 25.0.1
<dependency>
    <groupId>org.keycloak</groupId>
    <artifactId>keycloak-ldap-federation</artifactId>
    <version>25.0.1</version>
</dependency>
org.keycloak:keycloak-ldap-federation fixed: 22.0.12
<dependency>
    <groupId>org.keycloak</groupId>
    <artifactId>keycloak-ldap-federation</artifactId>
    <version>22.0.12</version>
</dependency>
org.keycloak:keycloak-ldap-federation fixed: 24.0.6
<dependency>
    <groupId>org.keycloak</groupId>
    <artifactId>keycloak-ldap-federation</artifactId>
    <version>24.0.6</version>
</dependency>
Verify Direct and Transitive Dependencies

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-2024-5967, 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 25.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-276: Incorrect Default Permissions, where during installation, installed file permissions are set to allow anyone to modify those files. 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

### Impact The LDAP testing endpoint allows to change the Connection URL independently of and without having to re-enter the currently configured LDAP bind credentials. An attacker with admin access (permission manage-realm) can change the LDAP host URL ("Connection URL") to a machine they control. The Keycloak server will connect to the attacker's host and try to authenticate with the configured credentials, thus leaking them to the attacker. As a consequence, an attacker who has compromised the admin console/compromised a user with sufficient privileges can leak domain credentials and can now attack the domain. ### Acknowledgements Special thanks to Simon Wessling for reporting this issue and helping us improve our project

CVE-2024-5967 Affected Keycloak ldap federation Versions

3 component(s)
Fixed Versions:
25.0.122.0.1224.0.6
Product / Package Ecosystem Affected Versions Fixed Version
org.keycloak:keycloak-ldap-federation
Maven
≥ 25.0.0
< 25.0.1
All 1 versions
25.0.0
25.0.1
org.keycloak:keycloak-ldap-federation
Maven
< 22.0.12
22.0.12
org.keycloak:keycloak-ldap-federation
Maven
≥ 23.0.0
< 24.0.6
24.0.6

References

Frequently Asked Questions

What is CVE-2024-5967?
CVE-2024-5967 is a security vulnerability in Keycloak ldap federation involving Keycloak leaks configured LDAP bind credentials through the Keycloak admin console under CWE-276: Incorrect Default Permissions.
Which Keycloak ldap federation versions are affected?
Affected versions include releases prior to 25.0.1, 22.0.12, 24.0.6 across affected packages: org.keycloak:keycloak-ldap-federation.
What version fixes CVE-2024-5967?
Upgrading to 25.0.1, 22.0.12, 24.0.6 (or the latest patched release for your respective branch) resolves the vulnerability.
Is keycloak-ldap-federation affected?
Yes, org.keycloak:keycloak-ldap-federation is affected in releases prior to 25.0.1, 22.0.12, 24.0.6. Upgrade your dependency to 25.0.1, 22.0.12, 24.0.6 or later.
What is the CVSS score of CVE-2024-5967?
CVE-2024-5967 has a CVSS v3.1 base score of 2.7 (LOW) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:N/A:N.
What CWE is associated with CVE-2024-5967?
CVE-2024-5967 is classified under CWE-276: Incorrect Default Permissions (During installation, installed file permissions are set to allow anyone to modify those files.).
How can I check Maven dependencies for CVE-2024-5967?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.keycloak'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-c25h-c27q-5qpv",
  "modified" : "2024-07-01T14:39:53Z",
  "published" : "2024-06-21T15:52:38Z",
  "aliases" : [ "CVE-2024-5967" ],
  "summary" : "Keycloak leaks configured LDAP bind credentials through the Keycloak admin console",
  "details" : "### Impact\n\nThe LDAP testing endpoint allows to change the Connection URL independently of and without having to re-enter the currently configured LDAP bind credentials. An attacker with admin access (permission manage-realm) can change the LDAP host URL (\"Connection URL\") to a machine they control. The Keycloak server will connect to the attacker's host and try to authenticate with the configured credentials, thus leaking them to the attacker.\nAs a consequence, an attacker who has compromised the admin console/compromised a user with sufficient privileges can leak domain credentials and can now attack the domain.\n\n### Acknowledgements\n\nSpecial thanks to Simon Wessling for reporting this issue and helping us improve our project",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.keycloak:keycloak-ldap-federation"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "25.0.0"
      }, {
        "fixed" : "25.0.1"
      } ]
    } ],
    "versions" : [ "25.0.0" ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.keycloak:keycloak-ldap-federation"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "22.0.12"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 22.0.11"
    }
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.keycloak:keycloak-ldap-federation"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "23.0.0"
      }, {
        "fixed" : "24.0.6"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 24.0.5"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/keycloak/keycloak/security/advisories/GHSA-c25h-c27q-5qpv"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-5967"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/keycloak/keycloak/issues/30434"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/keycloak/keycloak/commit/0d0530046b9cb4b0d74d2fdefc9bd04f1d20cac0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/keycloak/keycloak/commit/1f56a9e48bf96c3bcb18dfc6cd93e3dd16f281f1"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/keycloak/keycloak/commit/bde8568d4174a7072f7c7bb507d2c7d05824b1a6"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/security/cve/CVE-2024-5967"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=2292200"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/keycloak/keycloak"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-276" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-06-21T15:52:38Z",
    "nvd_published_at" : null
  }
}