CVE-2023-6563

7.7 HIGH

📋 TL;DR

An unconstrained memory consumption vulnerability in Keycloak allows attackers to cause denial of service by triggering excessive resource usage when accessing the admin UI's consents tab in environments with millions of offline tokens. This affects Keycloak deployments with over 500,000 users each having at least two saved sessions, potentially leading to system crashes. Administrators and users of vulnerable Keycloak instances are at risk if the admin interface is accessible.

💻 Affected Systems

Products:
  • Keycloak
Versions: Specific versions are not detailed in the CVE description; refer to Red Hat advisories for exact ranges (e.g., RHSA-2023:7854 to RHSA-2023:7858).
Operating Systems: All operating systems running Keycloak
Default Config Vulnerable: ⚠️ Yes
Notes: Vulnerability is triggered in environments with millions of offline tokens (e.g., >500,000 users with at least 2 saved sessions). Default configurations may be vulnerable if such token counts are reached.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system crash due to memory exhaustion, resulting in denial of service for all Keycloak services and dependent applications.

🟠

Likely Case

Temporary performance degradation or service interruption when the admin UI is accessed under high-load conditions, impacting authentication and authorization functions.

🟢

If Mitigated

Minimal impact if patches are applied or workarounds implemented, with potential for minor resource spikes but no system-wide failure.

🌐 Internet-Facing: MEDIUM, as exploitation requires access to the admin UI, which may be exposed but often protected by authentication and network controls.
🏢 Internal Only: HIGH, if internal attackers or misconfigured access allows exploitation, leading to resource exhaustion affecting internal systems.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: LOW, as it involves accessing the admin UI's consents tab with existing user sessions, but requires specific conditions (high token counts).

Exploitation is dependent on having a large number of offline tokens and access to the admin interface, making it situational but straightforward if conditions are met.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Refer to Red Hat advisories (e.g., RHSA-2023:7854 to RHSA-2023:7858) for specific patched versions; typically, updates to Keycloak versions that address the vulnerability.

Vendor Advisory: https://access.redhat.com/errata/RHSA-2023:7854

Restart Required: Yes

Instructions:

1. Check the Red Hat advisories for applicable patches. 2. Update Keycloak to the patched version via your package manager or manual installation. 3. Restart the Keycloak service to apply the fix.

🔧 Temporary Workarounds

Limit Admin UI Access

all

Restrict access to the Keycloak admin UI to trusted networks or users only to reduce attack surface.

Configure firewall rules or access controls (e.g., using iptables or network security groups) to block unauthorized access to admin UI ports.

Monitor and Clean Up Offline Tokens

all

Regularly monitor and reduce the number of offline tokens to below the vulnerable threshold (e.g., <500,000 users with minimal sessions).

Use Keycloak admin CLI or API to review and revoke unnecessary offline tokens; schedule cleanup tasks.

🧯 If You Can't Patch

  • Implement strict access controls to the admin UI, such as IP whitelisting and multi-factor authentication, to prevent unauthorized exploitation.
  • Deploy resource monitoring and alerting for memory and CPU usage spikes, with automated scaling or restart procedures to mitigate denial of service.

🔍 How to Verify

Check if Vulnerable:

Check if your Keycloak instance has over 500,000 users with at least two saved offline tokens and if the admin UI is accessible; review version against Red Hat advisories.

Check Version:

keycloak --version or check the Keycloak admin console for version information.

Verify Fix Applied:

After patching, verify the Keycloak version matches the patched release from Red Hat advisories and test accessing the consents tab under simulated high-token conditions to ensure no resource exhaustion.

📡 Detection & Monitoring

Log Indicators:

  • Log entries showing high memory or CPU usage spikes, especially when admin UI consents tab is accessed; error logs related to out-of-memory conditions.

Network Indicators:

  • Unusual traffic patterns to the admin UI endpoints, particularly repeated access to consents-related URLs.

SIEM Query:

Example: 'source="keycloak.log" AND ("memory exhaustion" OR "CPU spike") AND uri="/admin/consents"'

🔗 References

📤 Share & Export