CVE-2023-6841

7.5 HIGH

📋 TL;DR

This CVE describes a denial-of-service vulnerability in Keycloak where attackers can send repeated HTTP requests with excessive attributes, causing resource exhaustion by forcing the application to process and return rows with long attribute values. This affects all Keycloak deployments that haven't applied the security patch. The vulnerability allows attackers to degrade or disrupt Keycloak service availability.

💻 Affected Systems

Products:
  • Keycloak
Versions: All versions before the security patch
Operating Systems: All operating systems running Keycloak
Default Config Vulnerable: ⚠️ Yes
Notes: All default Keycloak configurations are vulnerable as the attribute limit is not enforced by default.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete service outage of Keycloak, preventing authentication and authorization for all dependent applications, potentially causing business disruption and user lockouts.

🟠

Likely Case

Degraded performance and intermittent service disruptions affecting authentication flows, with potential cascading impact on applications relying on Keycloak for identity management.

🟢

If Mitigated

Minimal impact with proper rate limiting, monitoring, and network controls in place to detect and block excessive attribute requests.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires sending repeated HTTP requests with excessive attributes, which can be automated with simple scripts.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Check Red Hat advisory for specific patched versions

Vendor Advisory: https://access.redhat.com/security/cve/CVE-2023-6841

Restart Required: Yes

Instructions:

1. Check the Red Hat advisory for patched Keycloak versions. 2. Update Keycloak to the patched version. 3. Restart the Keycloak service. 4. Verify the fix is applied.

🔧 Temporary Workarounds

Implement Rate Limiting

all

Configure rate limiting at the network or application level to restrict repeated HTTP requests

# Configure rate limiting in your reverse proxy (e.g., nginx)
limit_req_zone $binary_remote_addr zone=keycloak:10m rate=10r/s;
limit_req zone=keycloak burst=20 nodelay;

Web Application Firewall Rules

all

Deploy WAF rules to detect and block requests with excessive attributes

# Example ModSecurity rule
SecRule ARGS "@rx .{1000,}" "id:1001,phase:2,deny,status:400,msg:'Excessive attribute length detected'"

🧯 If You Can't Patch

  • Implement strict rate limiting and request size limits at the network perimeter
  • Monitor for unusual patterns of repeated HTTP requests to Keycloak endpoints

🔍 How to Verify

Check if Vulnerable:

Check Keycloak version against patched versions in Red Hat advisory. If running unpatched version, assume vulnerable.

Check Version:

# For Keycloak standalone, check version file or admin console
cat $KEYCLOAK_HOME/version.txt
# Or check via admin console at /auth/admin/master/console/

Verify Fix Applied:

Verify Keycloak version is updated to patched version and test that excessive attribute requests are properly handled or rejected.

📡 Detection & Monitoring

Log Indicators:

  • Multiple HTTP requests with similar patterns in short timeframes
  • Increased memory/CPU usage on Keycloak servers
  • Error logs related to request processing or memory exhaustion

Network Indicators:

  • Unusual spikes in HTTP traffic to Keycloak endpoints
  • Repeated POST/GET requests with large payloads

SIEM Query:

source="keycloak-access.log" | stats count by src_ip, uri | where count > 100

🔗 References

📤 Share & Export