CVE-2021-3461

7.1 HIGH

📋 TL;DR

This vulnerability in Keycloak allows session persistence after logout when using external SAML identity providers with specific Principal Type configurations. Attackers could maintain access to user sessions that should have been terminated. Organizations using Keycloak with SAML identity providers and Attribute Name principal type are affected.

💻 Affected Systems

Products:
  • Keycloak
Versions: All versions before 13.0.0
Operating Systems: All
Default Config Vulnerable: ✅ No
Notes: Only affects configurations using external SAML identity providers with Principal Type set to 'Attribute [Name]'

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Unauthorized users maintain persistent access to authenticated sessions, potentially accessing sensitive data and performing privileged actions as legitimate users.

🟠

Likely Case

Users who should have been logged out retain session access, leading to potential unauthorized data access and privilege misuse.

🟢

If Mitigated

With proper session monitoring and access controls, impact is limited to temporary session persistence that can be detected and terminated.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

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

Exploitation requires specific SAML configuration and logout requests from external identity providers

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Keycloak 13.0.0 and later

Vendor Advisory: https://bugzilla.redhat.com/show_bug.cgi?id=1941565

Restart Required: Yes

Instructions:

1. Upgrade Keycloak to version 13.0.0 or later. 2. Restart Keycloak service. 3. Verify SAML configurations are properly migrated.

🔧 Temporary Workarounds

Change Principal Type Configuration

all

Change Principal Type from 'Attribute [Name]' to 'Subject NameID' in SAML identity provider configurations

Implement Session Timeout

all

Reduce session timeout values to limit potential exposure window

🧯 If You Can't Patch

  • Change SAML identity provider Principal Type configuration to 'Subject NameID' instead of 'Attribute [Name]'
  • Implement aggressive session monitoring and forced logout mechanisms for suspicious sessions

🔍 How to Verify

Check if Vulnerable:

Check Keycloak version and verify if using SAML identity providers with Principal Type set to 'Attribute [Name]'

Check Version:

keycloak/bin/kc.sh --version

Verify Fix Applied:

Verify Keycloak version is 13.0.0 or later and test logout functionality with SAML identity providers

📡 Detection & Monitoring

Log Indicators:

  • Failed logout events from SAML identity providers
  • Extended session durations beyond configured timeouts
  • Multiple active sessions for single user

Network Indicators:

  • SAML logout requests from external identity providers
  • Session persistence after logout attempts

SIEM Query:

source="keycloak" AND (event="LOGOUT_FAILED" OR session_duration > 3600)

🔗 References

📤 Share & Export