REDHAT-BUG-2317440: Low severity keycloak/keycloak vulnerability
Keycloak versions 26 and earlier are vulnerable to a denial-of-service (DoS) attack through improper handling of proxy headers. When Keycloak is configured to accept incoming proxy headers, it may accept non-IP values, such as obfuscated identifiers, without proper validation. This can lead to costly DNS resolution operations, which an attacker could exploit to tie up IO threads and potentially cause a denial of service.
The attacker must have access to send requests to a Keycloak instance that is configured to accept proxy headers, specifically when reverse proxies do not overwrite incoming headers, and Keycloak is configured to trust these headers.
For Keycloak version 26, for successful exploitation includes: the realm must have SslRequired=EXTERNAL (the default), HTTP must be enabled, the instance must not be using a full hostname URL, access must come from behind a proxy (assuming the proxy overwrites the X-Forwarded-For header), and trusted proxies must not be set or must incorrectly trust the client from which the request is originating.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Configuration
For Keycloak 26, ensure the realm SslRequired is set to EXTERNAL (default) and not less restrictive.
Keycloak SslRequired = EXTERNAL - Configuration
Configure Keycloak so it does not trust incoming reverse-proxy headers from untrusted sources: ensure trusted proxies are set correctly (or not set), and that Keycloak only trusts proxy headers when the request is coming from the configured proxy that overwrites X-Forwarded-For.
Keycloak proxy header handling (accept incoming proxy headers / trusted proxies) = Do not accept or correctly validate proxy headers - Compensating control
Place the Keycloak instance behind a reverse proxy that overwrites X-Forwarded-For (do not allow the client to supply values for proxy headers), so that Keycloak cannot be tricked by attacker-supplied proxy header values.
Event History
Frequently Asked Questions
What is the severity of REDHAT-BUG-2317440?
The severity of REDHAT-BUG-2317440 is classified as high due to the potential for a denial-of-service attack.
How do I fix REDHAT-BUG-2317440?
To fix REDHAT-BUG-2317440, upgrade your Keycloak installation to version 27 or later, which includes proper handling of proxy headers.
Which versions of Keycloak are affected by REDHAT-BUG-2317440?
Keycloak versions 26 and earlier are affected by REDHAT-BUG-2317440.
What type of attack is associated with REDHAT-BUG-2317440?
REDHAT-BUG-2317440 is associated with a denial-of-service (DoS) attack.
What does improper handling of proxy headers lead to in REDHAT-BUG-2317440?
Improper handling of proxy headers in REDHAT-BUG-2317440 can lead to costly service disruptions.