CVE-2023-6563
📋 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
- Keycloak
📦 What is this software?
Keycloak by Redhat
Openshift Container Platform For Ibm Linuxone by Redhat
View all CVEs affecting Openshift Container Platform For Ibm Linuxone →
Openshift Container Platform For Ibm Linuxone by Redhat
View all CVEs affecting Openshift Container Platform For Ibm Linuxone →
Openshift Container Platform For Power by Redhat
View all CVEs affecting Openshift Container Platform For Power →
⚠️ 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.
🎯 Exploit Status
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
allRestrict 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
allRegularly 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
- https://access.redhat.com/errata/RHSA-2023:7854
- https://access.redhat.com/errata/RHSA-2023:7855
- https://access.redhat.com/errata/RHSA-2023:7856
- https://access.redhat.com/errata/RHSA-2023:7857
- https://access.redhat.com/errata/RHSA-2023:7858
- https://access.redhat.com/security/cve/CVE-2023-6563
- https://bugzilla.redhat.com/show_bug.cgi?id=2253308
- https://github.com/keycloak/keycloak/issues/13340
- https://access.redhat.com/errata/RHSA-2023:7854
- https://access.redhat.com/errata/RHSA-2023:7855
- https://access.redhat.com/errata/RHSA-2023:7856
- https://access.redhat.com/errata/RHSA-2023:7857
- https://access.redhat.com/errata/RHSA-2023:7858
- https://access.redhat.com/security/cve/CVE-2023-6563
- https://bugzilla.redhat.com/show_bug.cgi?id=2253308
- https://github.com/keycloak/keycloak/issues/13340