REDHAT-BUG-2589430: Medium severity Red Hat Keycloak vulnerability
A Missing Authorization flaw was found in the Keycloak Admin REST API users/count endpoint. While the primary users endpoint correctly restricts results based on the view-users permission, the companion count endpoint accepts the same filtering parameters but performs the count across all users in the realm without applying per-user authorization checks. An authenticated attacker with the query-users role can exploit this behavior by sending multiple filtered requests to the GET /admin/realms/{realm}/users/count endpoint. By observing the returned count, the attacker can perform a side-channel attack to reconstruct PII including usernames, email addresses, and first/last names, as well as verify the values of sensitive custom user attributes. This issue only affects realms where fine-grained admin permissions (v2) are not enabled.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Configuration
Enable fine-grained admin permissions (v2) for the realm.
Keycloak fine-grained admin permissions (v2) = enabled
Event History
Frequently Asked Questions
Who can exploit this issue?
An attacker must be authenticated and have the query-users role in an affected realm. The issue is limited to realms where fine-grained admin permissions (v2) are not enabled.
What information could be inferred through the vulnerable endpoint?
By issuing multiple filtered requests and observing count results, an attacker may reconstruct usernames, email addresses, and first and last names. They may also verify values of sensitive custom user attributes.
How can I determine whether a realm is affected?
Check whether fine-grained admin permissions (v2) are enabled for the realm. Realms with those permissions enabled are not affected according to the provided information.