CVE-2024-7341
📋 TL;DR
This CVE describes a session fixation vulnerability in Keycloak's SAML adapters where session IDs aren't regenerated during login, even when configured to do so. Attackers who hijack a session before authentication can maintain access after the victim logs in. This affects Keycloak deployments using SAML adapters with the turnOffChangeSessionIdOnLogin option.
💻 Affected Systems
- Keycloak
📦 What is this software?
Keycloak by Redhat
⚠️ Risk & Real-World Impact
Worst Case
Attackers gain unauthorized access to authenticated user sessions, potentially accessing sensitive data or performing privileged actions as legitimate users.
Likely Case
Session hijacking leading to unauthorized access to user accounts and associated resources.
If Mitigated
Limited impact with proper session management controls and monitoring in place.
🎯 Exploit Status
Requires session hijacking capability before authentication.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Check Red Hat advisories for specific patched versions
Vendor Advisory: https://access.redhat.com/errata/RHSA-2024:6493
Restart Required: Yes
Instructions:
1. Review Red Hat advisories for applicable patches. 2. Apply the appropriate patch for your Keycloak version. 3. Restart Keycloak services. 4. Verify the fix is applied.
🔧 Temporary Workarounds
Disable turnOffChangeSessionIdOnLogin
allRemove or disable the turnOffChangeSessionIdOnLogin option in SAML adapter configuration
Edit Keycloak SAML adapter configuration files to remove turnOffChangeSessionIdOnLogin setting
🧯 If You Can't Patch
- Implement additional session validation and monitoring
- Use network segmentation to limit access to Keycloak instances
🔍 How to Verify
Check if Vulnerable:
Check if using Keycloak SAML adapters with turnOffChangeSessionIdOnLogin option enabled
Check Version:
Check Keycloak server version via admin console or server logs
Verify Fix Applied:
Verify patch version is applied and session IDs now regenerate properly during login
📡 Detection & Monitoring
Log Indicators:
- Multiple login attempts from same session ID
- Session ID reuse across authentication events
Network Indicators:
- Unusual session patterns in authentication traffic
SIEM Query:
Search for session ID patterns that persist across authentication boundaries
🔗 References
- https://access.redhat.com/errata/RHSA-2024:6493
- https://access.redhat.com/errata/RHSA-2024:6494
- https://access.redhat.com/errata/RHSA-2024:6495
- https://access.redhat.com/errata/RHSA-2024:6497
- https://access.redhat.com/errata/RHSA-2024:6499
- https://access.redhat.com/errata/RHSA-2024:6500
- https://access.redhat.com/errata/RHSA-2024:6501
- https://access.redhat.com/errata/RHSA-2024:6502
- https://access.redhat.com/errata/RHSA-2024:6503
- https://access.redhat.com/security/cve/CVE-2024-7341
- https://bugzilla.redhat.com/show_bug.cgi?id=2302064