CVE-2025-2559

4.9 MEDIUM

📋 TL;DR

This vulnerability in Keycloak allows denial of service through memory exhaustion when JWT tokens with excessively long expiration times are cached indefinitely. Systems using Keycloak with JWT token authentication are affected. The issue can prevent legitimate users from accessing the system.

💻 Affected Systems

Products:
  • Keycloak
Versions: Specific versions not specified in CVE description, but referenced in Red Hat advisories
Operating Systems: All platforms running Keycloak
Default Config Vulnerable: ✅ No
Notes: Only affects configurations using JWT tokens for authentication with long expiration times.

⚠️ Manual Verification Required

This CVE does not have specific version information in our database, so automatic vulnerability detection cannot determine if your system is affected.

Why? The CVE database entry doesn't specify which versions are vulnerable (no version ranges provided by the vendor/NVD).

🔒 Custom verification scripts are available for registered users. Sign up free to download automated test scripts.

Recommended Actions:
  1. Review the CVE details at NVD
  2. Check vendor security advisories for your specific version
  3. Test if the vulnerability is exploitable in your environment
  4. Consider updating to the latest version as a precaution

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system outage due to OutOfMemoryError, rendering Keycloak unavailable and blocking all authentication requests.

🟠

Likely Case

Gradual performance degradation leading to intermittent authentication failures and increased response times.

🟢

If Mitigated

Minimal impact with proper token expiration limits and monitoring in place.

🌐 Internet-Facing: MEDIUM - Attackers could craft malicious JWT tokens to trigger the condition, but requires understanding of the system configuration.
🏢 Internal Only: MEDIUM - Internal users could inadvertently cause the issue with misconfigured tokens, but easier to monitor and control.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: LOW - Requires ability to generate JWT tokens with long expiration times.

Exploitation requires access to create or modify JWT tokens used for authentication.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Refer to Red Hat advisories RHSA-2025:4335 and RHSA-2025:4336

Vendor Advisory: https://access.redhat.com/security/cve/CVE-2025-2559

Restart Required: Yes

Instructions:

1. Check current Keycloak version. 2. Apply patches from Red Hat advisories. 3. Restart Keycloak service. 4. Verify fix by monitoring cache behavior.

🔧 Temporary Workarounds

Limit JWT Token Expiration

all

Configure maximum token expiration time to prevent indefinite caching.

Configure in Keycloak admin console: Realm Settings -> Tokens -> Access Token Lifespan

Implement Cache Eviction Policy

all

Add cache size limits or time-based eviction for JWT token cache.

Configure cache settings in Keycloak standalone.xml or ha.xml

🧯 If You Can't Patch

  • Implement strict JWT token expiration policies (max 1-2 hours)
  • Monitor memory usage and JWT cache size with alerts for abnormal growth

🔍 How to Verify

Check if Vulnerable:

Check if using JWT tokens with expiration > 24 hours and monitor JWT cache memory usage.

Check Version:

keycloak/bin/kc.sh --version or check Keycloak admin console

Verify Fix Applied:

After patching, test with long-expiration JWT tokens and verify cache doesn't grow indefinitely.

📡 Detection & Monitoring

Log Indicators:

  • OutOfMemoryError in logs
  • Increasing JWT cache size metrics
  • High memory usage alerts

Network Indicators:

  • Increased authentication latency
  • Failed authentication requests

SIEM Query:

source="keycloak.log" AND ("OutOfMemoryError" OR "JWT cache" AND "size")

🔗 References

📤 Share & Export