REDHAT-BUG-2590883: Medium severity Red Hat Keycloak vulnerability
A padding oracle vulnerability was discovered in the SAML identity brokering implementation of Keycloak. When Keycloak is configured as a SAML service provider, it processes incoming SAML responses that contain encrypted assertions. If a response is unsigned, Keycloak performs decryption of the assertion before any integrity or signature checks are executed. The endpoint returns a distinguishable empty HTTP 400 error when decryption fails due to an invalid CBC padding, compared to other responses when decryption succeeds. An unauthenticated remote attacker who has captured an encrypted SAML assertion can exploit this discrepancy to perform a padding oracle attack. By sending a large number of crafted requests and observing the response patterns, the attacker can recover the plaintext of the encrypted assertion byte by byte. This allows the attacker to access sensitive user identity information and attributes, bypassing the confidentiality protections provided by assertion encryption.
Affected Software
Event History
Frequently Asked Questions
Which deployments are exposed to this issue?
Deployments are exposed when Keycloak is configured as a SAML service provider and processes incoming SAML responses containing encrypted assertions. The described oracle condition applies to unsigned responses.
What does an attacker need to exploit it?
An unauthenticated remote attacker needs to have captured an encrypted SAML assertion. They then send a large number of crafted requests and distinguish invalid-CBC-padding failures from responses indicating successful decryption.
What information can be recovered through the oracle?
The attacker can recover the plaintext of the encrypted assertion byte by byte. This can expose sensitive user identity information and attributes contained in the assertion.
How can I identify the vulnerable response behavior?
Send a SAML response with an encrypted assertion whose CBC padding is invalid and observe the endpoint response. The affected behavior is a distinguishable empty HTTP 400 response for padding-related decryption failures, unlike responses when decryption succeeds.