6 ms·
The solution i've seen is: sleep(float(hash(request_content)) % n) this assumes that the attacker cannot control any non-relevant part of request_content.
by JonnieCache 12y ago
The solution i've seen is:
sleep(float(hash(request_content)) % n)
this assumes that the attacker cannot control any non-relevant part of request_content.
- nickodell 12y agoThis seems like it's insecure if the attacker can predict request_content, too.
- TheLoneWolfling 12y agoThat's secure as long as the hash is (securely) salted.
- matthewmacleod 12y agoAs far as I can tell, that would not be secure – wouldn't it end up being essentially cryptographically secure random timing noise? We already know that random jitter doesn't work, because it can be averaged out given enough samples. I'm not a cryptography guy though, so I could well be wrong!
- TheLoneWolfling 12y agoIt cannot be averaged out, as there is no way to take multiple samples. Look at it: for any specific input it always sleeps for a deterministic amount of time. Unlike random timing noise, which can be averaged away. You take averages and all you know is the value of (actual time + some unknown value) very precisely. That doesn't help you. (He is, however, missing that it should also have a random salt, generated once and stored.) Of course, this is still breakable most of the time.
- deleted 12y ago[deleted]