The analysis of the provided patch reveals a critical authorization flaw in the ZITADEL platform. The vulnerability, as described, allowed users to bypass email and phone verification processes by directly calling the UpdateHumanUser API on their own user profile and setting the respective fields to a verified state. The root cause was an insufficient permission check within the (*Commands).ChangeUserHuman function located in internal/command/user_v2_human.go.
The provided commit 0261536243e500dccfd8c7f547d592c822478327 clearly shows the fix. Before the patch, the decision to enforce a stricter permission check was based solely on whether user metadata was being changed. The act of setting an email or phone number to 'verified' was not considered a metadata change, allowing the operation to proceed under the user's own, lower-privileged context. The patch rectifies this by introducing a new variable, requireWritePermission, which becomes true if a user attempts to set the Verified flag on their email or phone. This triggers the stricter permission check, checkPermissionUpdateUser, which correctly denies the operation in a self-management context. The added integration and unit tests in the same commit confirm this behavior by asserting that an error is returned when a user tries to self-verify their contact information.
Therefore, the function (*Commands).ChangeUserHuman is the specific location of the vulnerability. During exploitation, this function would be present in runtime profiles and stack traces as it is the core component responsible for processing the malicious request and failing to enforce proper authorization.