The vulnerability identified is a combination of a weak password policy (CWE-521) and insufficient session expiration after a password change (CWE-613). The analysis of the provided commit, 89c17d3b23e2a23320ad135b4e8f0a14fdd91bda, reveals changes that address the weak password policy.
The commit modifies two main functions, UserResetPassword and UserChangePassword, which are the API endpoints for resetting and updating a user's password, respectively. The patch introduces password validation in both of these flows. Specifically:
- In
pkg/routes/api/v1/user_password_reset.go, a call to c.Validate(pwReset) is added within the UserResetPassword function.
- In
pkg/routes/api/v1/user_update_password.go, the UserPassword struct is updated with validation rules (valid:"bcrypt_password" minLength:"8" maxLength:"72") for the NewPassword field, and a corresponding c.Validate(newPW) call is added to the UserChangePassword function.
These changes confirm that prior to the patch, these two functions were vulnerable as they did not enforce minimum password strength, allowing an attacker (or user) to set a weak password. These functions would therefore appear in a runtime profile when the password change functionality is invoked.
The second part of the vulnerability, persistent sessions after a password change, is not addressed in the provided commit. The functions UserResetPassword and UserChangePassword would be the correct place to implement session invalidation logic. The absence of such changes in the patch suggests this aspect of the vulnerability might be fixed in a different commit or was not fixed at the same time. Nevertheless, the identified functions are central to the exploitation of the reported vulnerability.