Closed Inch4Tk closed 4 years ago
Yup, this is a security issue. I'll take a look to see if I can replicate it...
Update 1: I've done some tests. It appears this is an issue with SHA-256, not HMAC, as using normal SHA-256 also yields collisions. More updates coming...
Update 2: SHA-224 is also broken. The longer SHA's are fine (384, 512).
It took me a while, but I found the issue. Will publish an update later today.
Fixed on pub. Will publish to GitHub now.
The following code using SHA-256/HMAC/PBKDF2 yielded colliding hashes when the input password did only have a one character difference (see example). I am no cryptography expert, but I suspect this is not correct behavior. No collisions happened after changing the algorithm (tested with scrypt, SHA-384/HMAC/PBKDF2, SHA-512/HMAC/PBKDF2, SHA-3/256/HMAC/PBKDF2).
Example Code:
Outputs:
The test was done on a physical android device with flutter. I did not test if this can be reproduced on another platform.