Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulnerability problem in password recovery #416

Closed
WelisonR opened this issue May 5, 2021 · 0 comments · Fixed by #417
Closed

Vulnerability problem in password recovery #416

WelisonR opened this issue May 5, 2021 · 0 comments · Fixed by #417
Assignees
Labels

Comments

@WelisonR
Copy link
Contributor

WelisonR commented May 5, 2021

Describe the security problem
At the moment, the recovery password module generates a pseudo-random hash that is vulnerable. The code uses the timestamp and the user e-mail (filled by user to recover password), public information, to generate hashs to recovery password. Futhermore, the code uses MD5 hash that has a lot of vulnerabilities known today.

Related Code

class EncryptService():
    def generate_verification_code(self, email):
        datetime_now = datetime.now()
        today =  '{}{}{}{}{}{}{}'.format(datetime_now.year, datetime_now.month, datetime_now.day, datetime_now.hour, datetime_now.minute, datetime_now.second, datetime_now.microsecond)
        decrypt_code = str(today) + (email * 4)
        verification_code = self.generate_hash_code(decrypt_code)
        return verification_code

    def generate_hash_code(self, decrypt_code):
        hash_code = hashlib.md5(bytes(decrypt_code, encoding='utf-8'))
        return hash_code.hexdigest()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants