CVE-2023-6927 Overview
A security vulnerability has been identified in Red Hat Keycloak, an open-source identity and access management solution. This flaw allows attackers to steal authorization codes or tokens from OAuth/OIDC clients by exploiting a wildcard handling issue in the JARM (JWT Secured Authorization Response Mode) response mode form_post.jwt. This vulnerability effectively bypasses security measures that were implemented to address CVE-2023-6134, representing a security patch regression.
Critical Impact
Attackers can steal authorization codes and access tokens from legitimate clients, potentially leading to account takeover and unauthorized access to protected resources.
Affected Products
- Red Hat Keycloak
- Red Hat Single Sign-On 7.0
Discovery Timeline
- December 18, 2023 - CVE-2023-6927 published to NVD
- November 21, 2024 - Last updated in NVD database
Technical Details for CVE-2023-6927
Vulnerability Analysis
This vulnerability is classified as an Open Redirect (CWE-601) issue within Keycloak's OAuth 2.0/OpenID Connect implementation. The flaw specifically affects the handling of redirect URIs when the JARM response mode form_post.jwt is used in combination with wildcard-based redirect URI configurations.
When OAuth/OIDC clients are configured with wildcard redirect URIs, an attacker can craft malicious authorization requests that redirect tokens and authorization codes to attacker-controlled endpoints. This issue is particularly concerning because it represents a bypass of previous security controls implemented for CVE-2023-6134, indicating that the original fix did not adequately address all attack vectors related to redirect URI validation.
The vulnerability requires user interaction, as victims must be tricked into clicking a malicious authorization link. However, given that these links often appear legitimate (originating from the trusted Keycloak domain), social engineering attacks become more feasible.
Root Cause
The root cause lies in insufficient validation of redirect URIs when wildcard patterns are used in client configurations combined with the form_post.jwt response mode. The JARM specification extends OAuth 2.0 authorization responses by encoding them as JWTs, and the form_post.jwt mode specifically delivers these responses via HTTP POST to the redirect URI.
The vulnerability occurs because the redirect URI validation logic fails to properly restrict wildcard matching when processing JARM-based responses, allowing attackers to specify arbitrary redirect destinations that match the wildcard pattern but point to malicious servers.
Attack Vector
The attack exploits the network-accessible OAuth/OIDC authorization endpoint. An attacker can construct a specially crafted authorization URL that:
- Targets a client configured with wildcard redirect URIs
- Specifies response_mode=form_post.jwt to trigger JARM processing
- Includes a redirect URI that matches the wildcard pattern but points to an attacker-controlled server
- When a victim clicks this link and authenticates, their authorization code or tokens are sent to the attacker's server via the form POST mechanism
The attacker can then use the stolen authorization code or tokens to impersonate the victim and access protected resources. This attack is particularly effective because the malicious redirect URI technically matches the configured wildcard pattern, bypassing standard validation checks.
Detection Methods for CVE-2023-6927
Indicators of Compromise
- Unusual authorization requests with response_mode=form_post.jwt targeting clients with wildcard redirect URI configurations
- Authorization code exchange attempts from unexpected IP addresses or geographic locations
- Multiple failed or successful token exchanges for the same authorization code
- Suspicious redirect URI patterns that match wildcards but point to external or unexpected domains
Detection Strategies
- Monitor Keycloak audit logs for authorization requests using JARM response modes, particularly form_post.jwt
- Implement alerting for redirect URIs that match wildcard patterns but resolve to external or suspicious domains
- Review client configurations to identify those using wildcard redirect URIs combined with JARM support
- Analyze network traffic for authorization responses being sent to unexpected destinations
Monitoring Recommendations
- Enable comprehensive audit logging in Keycloak for all OAuth/OIDC authorization flows
- Configure SIEM rules to detect anomalous patterns in authorization code and token exchange activities
- Monitor for rapid sequential authorization requests that may indicate an active exploitation attempt
- Review access logs for the presence of unusual response_mode parameter values
How to Mitigate CVE-2023-6927
Immediate Actions Required
- Apply the latest security patches from Red Hat for Keycloak and Single Sign-On immediately
- Review all OAuth/OIDC client configurations and remove or restrict wildcard redirect URI patterns where possible
- Consider disabling JARM response modes (form_post.jwt) for clients that do not require this functionality
- Audit recent authorization activity for signs of exploitation
Patch Information
Red Hat has released multiple security advisories addressing this vulnerability:
- Red Hat Security Advisory RHSA-2024:0094
- Red Hat Security Advisory RHSA-2024:0095
- Red Hat Security Advisory RHSA-2024:0096
- Red Hat Security Advisory RHSA-2024:0097
- Red Hat Security Advisory RHSA-2024:0098
- Red Hat Security Advisory RHSA-2024:0100
- Red Hat Security Advisory RHSA-2024:0101
For additional details, refer to the Red Hat CVE Analysis for CVE-2023-6927 and Red Hat Bug Report #2255027.
Workarounds
- Replace wildcard redirect URI configurations with explicit, fully-qualified redirect URIs for each client
- Disable JARM response modes at the realm or client level if not required for your authentication flows
- Implement additional network-level controls to restrict authorization response destinations to known, trusted URIs
- Consider implementing Content Security Policy headers to limit form POST targets
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


