CVE-2023-6134 Overview
A security flaw has been identified in Red Hat Keycloak, the popular open-source identity and access management solution. This vulnerability stems from an incomplete fix for a previous issue (CVE-2020-10748) where certain URI schemes are blocked in redirects, but the validation can be bypassed by appending a wildcard character to the token. This bypass allows attackers to craft malicious requests that lead to cross-site scripting (XSS) attacks or potentially enable further exploitation.
The vulnerability affects multiple Red Hat products that utilize Keycloak for authentication services, including Red Hat Single Sign-On, OpenShift Container Platform, and various Enterprise Linux deployments.
Critical Impact
Attackers can bypass redirect URI validation controls to execute cross-site scripting attacks, potentially stealing session tokens, credentials, or performing actions on behalf of authenticated users.
Affected Products
- Red Hat Single Sign-On
- Red Hat Keycloak
- Red Hat Enterprise Linux 7.0, 8.0, 9.0
- Red Hat OpenShift Container Platform 4.11, 4.12
- Red Hat OpenShift Container Platform for Power 4.9, 4.10
- Red Hat OpenShift Container Platform IBM Z Systems 4.9, 4.10
Discovery Timeline
- December 14, 2023 - CVE-2023-6134 published to NVD
- November 21, 2024 - Last updated in NVD database
Technical Details for CVE-2023-6134
Vulnerability Analysis
This vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation) exists in the redirect URI validation logic within Keycloak. The authentication flow relies on redirect URIs to return users to their intended destination after successful authentication. To prevent abuse, Keycloak implements restrictions on certain URI schemes that could be used maliciously.
However, the validation implementation contains a flaw where appending a wildcard character to the token can bypass these scheme restrictions. This incomplete fix from CVE-2020-10748 means that attackers can still craft redirect URIs containing dangerous schemes that the security controls were designed to block.
When exploited, this allows injection of malicious scripts into the authentication flow, which execute in the context of the victim's browser session. This is particularly dangerous in identity management systems where session tokens and authentication credentials are handled.
Root Cause
The root cause is an incomplete security fix for CVE-2020-10748. The original patch implemented scheme restrictions for redirect URIs but failed to account for edge cases involving wildcard characters in tokens. The validation logic does not properly handle these wildcard-appended tokens, allowing previously blocked URI schemes to pass through validation.
This represents a classic case of insufficient input validation where the security control can be circumvented through unexpected input patterns that were not considered during the original remediation.
Attack Vector
The attack is network-based and requires user interaction. An attacker must craft a specially formatted redirect URI that includes a blocked scheme with a wildcard appended to bypass validation. The attack flow involves:
- The attacker creates a malicious authentication request with a crafted redirect URI containing the bypass pattern
- The victim is tricked into clicking the malicious link or visiting a page that initiates the authentication flow
- Keycloak's validation incorrectly allows the malicious redirect URI due to the wildcard bypass
- After authentication, the victim is redirected to the attacker-controlled destination where malicious scripts execute
- The XSS payload can steal session cookies, authentication tokens, or perform actions as the authenticated user
The vulnerability requires low privileges (authenticated user context) but can have significant impact through the cross-site scripting attack, potentially compromising confidentiality and integrity of user sessions across the affected identity management infrastructure.
Detection Methods for CVE-2023-6134
Indicators of Compromise
- Unusual redirect URIs in Keycloak authentication logs containing wildcard patterns or unexpected scheme prefixes
- Authentication requests with abnormally long or complex redirect_uri parameters
- Client-side script execution errors in browser logs related to Keycloak authentication flows
- Unexpected external domain references in authentication redirect chains
Detection Strategies
- Monitor Keycloak access logs for redirect URI parameters containing suspicious patterns, particularly those with wildcard characters (*) adjacent to URI scheme identifiers
- Implement web application firewall (WAF) rules to detect and block malformed redirect URI patterns in authentication requests
- Enable detailed logging for OAuth/OIDC authentication flows to capture full redirect URI values for forensic analysis
- Deploy endpoint detection solutions to identify XSS payloads executing in browser contexts during authentication workflows
Monitoring Recommendations
- Configure alerts for authentication requests with redirect URIs that deviate from expected application patterns
- Implement continuous monitoring of Keycloak audit logs for anomalous authentication flow behaviors
- Establish baseline metrics for normal redirect URI patterns and alert on statistical outliers
- Review client application configurations to ensure redirect URI allowlists are strictly defined
How to Mitigate CVE-2023-6134
Immediate Actions Required
- Apply the latest security patches from Red Hat for all affected Keycloak and Single Sign-On deployments
- Review and restrict redirect URI configurations for all registered OAuth/OIDC clients to use exact matches rather than wildcards where possible
- Implement additional input validation at the application layer for redirect URI parameters
- Enable Content Security Policy (CSP) headers to mitigate the impact of any successful XSS exploitation
Patch Information
Red Hat has released multiple security advisories addressing this vulnerability across different product versions:
- RHSA-2023:7854 - Red Hat Single Sign-On security update
- RHSA-2023:7855 - Red Hat Single Sign-On security update
- RHSA-2023:7856 - Red Hat Single Sign-On security update
- RHSA-2023:7857 - Red Hat Single Sign-On security update
- RHSA-2023:7858 - Red Hat Single Sign-On security update
- RHSA-2024:0798 - Additional security update
- RHSA-2024:0799 - Additional security update
For detailed patch instructions, consult the Red Hat CVE-2023-6134 Details page and Bug Report #2249673.
Workarounds
- Restrict redirect URI configurations to use exact matches instead of wildcard patterns for all registered clients
- Implement a reverse proxy or WAF rule to filter redirect URI parameters containing wildcard characters in combination with scheme identifiers
- Limit authentication to trusted network segments while patches are being applied
- Enable strict Content Security Policy headers to reduce the impact of successful XSS attacks
# Example Keycloak client configuration to restrict redirect URIs
# Update client configuration to use exact redirect URIs instead of wildcards
# In keycloak-cli or Admin Console, modify client settings:
# Avoid wildcard patterns like:
# https://example.com/*
# Use exact redirect URIs:
# https://example.com/callback
# https://example.com/auth/callback
# For containerized deployments, ensure updated images are deployed:
podman pull registry.redhat.io/rh-sso-7/sso76-openshift-rhel8:latest
# or
docker pull registry.redhat.io/rh-sso-7/sso76-openshift-rhel8:latest
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

