|
|
|
|
|
by tbrowbdidnso
3401 days ago
|
|
The author is mistaken about the side channel existing. In the most common case of login and token generation it just doesn't. With logins you compare the hashed password to a stored hash. The author mentions that you can tell how much of the hashes match because the compare function exits early if they do. This might be true, but it doesn't give you anything. When using a secure hash function with a salt, the attacker being able to guess how much of the two hashes match gives him no information because: 1) he doesn't know what hash is stored
2) he doesn't know what his password attempt hashed to
3) he doesn't know the salt The only thing that the attacker knows is that he created a hash with his attempt that matches the first few bytes of the real hash. If you use a strong hashing algorithm this is useless information and will happen at random. |
|
There's another unrelated solution to the problem: make the tokens be AEAD [1] output from a scheme with a global (perhaps rotated) secret or signed output from an asymmetric cryptosystem. Then you're protected by the usual AEAD or digital signature guarantees as long as you properly verify the token before doing something silly like looking up the ciphertext in a database.
[1] Strictly speaking, encryption may be unnecessary depending on what's in the token.