The vulnerability existed within Mattermost's Slack import functionality. When users were imported from a Slack export, the system would generate new passwords for them. The functions SlackImporter.slackAddUsers and SlackImporter.slackAddBotUser were responsible for creating these users and their passwords. The core of the vulnerability is that these functions would then write the newly generated passwords to a log file. An attacker with access to these logs could retrieve the passwords and impersonate the imported users. The entry point for this vulnerable operation is the App.SlackImport function, which handles the API request for the import.
The patch rectifies this by removing the password generation and logging. Instead of creating a password, the user is created with an empty password, and a password reset process is initiated by sending them an email. This ensures that no passwords are ever logged, mitigating the information disclosure vulnerability.