It really is a clever attack!
I'm really surprised at the way he mentions the microcontroller tests if the key is correct or not, by simply looping through and breaking on an incorrect number.
It really is a clever attack!
I'm really surprised at the way he mentions the microcontroller tests if the key is correct or not, by simply looping through and breaking on an incorrect number.
The problem, of course, is that in the security realm, coding to break the loop as soon as the answer is known wrong is what provides these types of side channel attacks. But since 99.9% of programmers also do not write code for these environments when tasked to do so they just do what they are used to doing everywhere else (break early, when you know you are done with the checks) without realizing they are leaving an unlocked backdoor as a result.
if hashing_function(unknown_pass) == hashed_pass:
you're doing it wrong...Instead, use the compare function built into your crypto library, which should hopefully be hardened against timing attacks.
In most languages, == and === are not safe against timing attacks.
It's telling that even the very smart person who did such a great write-up made a few mistakes again in initial attempts at demonstrating a corrected algorithm that actually blew the whole thing up again.
Because it's so subtle, the odds are very good that most current systems are fallible to this.
By contrast, if you were comparing my submitted password to a stored password, I could use your response time to know that I got the first n characters right. Since n is a prefix of the password, I've learned something about the password, I can lock down those characters, and then guess more, etc. That much I understand.
But the case you're talking about is a comparison of hashes. In that case, timing attacks can tell me that my guess's hash's first n characters match the password's hash's first n characters. So now what? How do I adapt future guesses to learn more characters? What have I learned about (a preimage of the hash of) the password?
If partial hash collisions were, in any way, helpful in guessing the full collision, Bitcoin mining algorithms would adaptively change their guesses as they discovered that their nonces only led to a partial match.
1. https://security.stackexchange.com/questions/111040/should-i...
https://codahale.com/a-lesson-in-timing-attacks/
tl;dr, the method for doing "secure" string comparison was vulnerable to timing attacks for much of Java's history.