CVE-2024-7341

7.1 HIGH

📋 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

Products:
  • Keycloak
Versions: Specific versions mentioned in Red Hat advisories (check references for exact ranges)
Operating Systems: All platforms running Keycloak
Default Config Vulnerable: ✅ No
Notes: Only affects deployments using SAML adapters with turnOffChangeSessionIdOnLogin option configured.

📦 What is this software?

⚠️ 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.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

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

all

Remove 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

📤 Share & Export