Replies: 1 comment 3 replies
-
Are you saying or proposing that the token that is sent in the email is the same as is stored in the database? If so, a database leak would compromise accounts. For this reason, the email should include the random plaintext token, and the database should store a hash (e.g. Edit: Laravel stores a |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
https://github.com/laravel/framework/blob/8.x/src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php#L214
It is all about this code snippet. First we create a 40 byte random string with a 62 character alphabet (base64 - 2 characters) and then hashing it (with or without hmac does not change a thing hashing a random string will return a random string) with sha256 (16 character alphabet with 64 byte).
4062 = 2,126764793×10⁹⁹6240 = 4,962123625×10⁷¹
1664 = 1,157920892×10⁷⁷
We are using more space (in the link; in the database etc.) and get less security. Is there any particular reason? If we want to add more security we have to send the random string and store a bcrypt in the database. The random string is already url save.
Edit: sorry, I calculated the wrong things. Anyway: the fact that hashing just increases the required space and cpu cycles remains.
Beta Was this translation helpful? Give feedback.
All reactions