The vulnerability exists in the Statamic CMS user fieldtype, which allowed a control panel user without 'view users' permissions to access the email addresses of other users. The root cause is a lack of authorization checks in the API endpoint that serves data to the user fieldtype component.
The analysis of the security patches reveals several key functions:
-
Statamic\Fieldtypes\Users->getIndexItems(): This function is responsible for fetching and formatting the list of users displayed in the user fieldtype selector. The patch e70af0f32875e56937e637e936decae12107a585 introduces a permission check ($this->canViewUsers()) to conditionally include the email field in the returned data. Additionally, patch 6dd8a21625382dcf05d9371498382213f767f52d wraps the email search logic in the same permission check, preventing users from inferring emails via search queries. This indicates the function was a primary source of the information leak.
-
Statamic\Fieldtypes\Users->toItemArray(): This function prepares the data for a single selected user. The patch e70af0f32875e56937e637e936decae12107a585 replaces a direct call to $user->name() with a new helper method, $this->userTitle(). This new method contains logic to only show the email as a fallback to the name if the current user has the appropriate permissions; otherwise, it shows the user ID. This change directly addresses the information disclosure.
-
Statamic\Auth\User->name(): This model-level function was modified in patch 49cc2069bd5dbc69a16ffcf2bf785e4fe58f4fd2 to stop falling back to the user's email address if the name field was empty. While not a security control itself, its previous behavior contributed to the vulnerability by causing any part of the UI that displayed a user's "name" to potentially leak their email address.
During exploitation, a malicious but authenticated low-privileged user would make a request to the user fieldtype's data endpoint. This would trigger a call to Statamic\Fieldtypes\Users->getIndexItems(), which, prior to the patch, would return a JSON response containing the names and email addresses of all users.