The vulnerability allows a user to change their email address to one they do not control, as the system does not perform any verification of ownership. This could lead to information disclosure through system notifications being sent to an incorrect address.
The analysis of the patch commit 21e9fbedde8553c29c0d3156e84f78157fc4f22e reveals that the core of the vulnerability was the direct update of the user's email in the database without a verification step. This was possible through two main code paths:
-
Web Interface: A user editing their profile via account_page.php would trigger a POST request to account_update.php. This script would then call the user_set_email() function. The original implementation of user_set_email() in core/user_api.php is considered vulnerable because it updated the email address after only performing basic validation checks (like format and uniqueness), but not ownership. It was the final function that committed the unverified email to the database.
-
API/Command Layer: The UserUpdateCommand class in core/commands/UserUpdateCommand.php provided another way to update user data. Its process() method would call a private update_user() method, which directly constructed and executed an UPDATE SQL query. This method was vulnerable as it blindly updated the email field with the provided data.
The patch rectifies this by introducing a token-based email verification flow. Instead of updating the email directly, the system now sends a verification link to the new email address. The update is only completed when the user clicks this link. This new logic was implemented in both the web (account_update.php) and command (UserUpdateCommand) flows, replacing the direct, unsafe updates.