News for hackers. Stuff that matters.
Re:OpenSSL vulnerable to timing attack? by Nexxxeh on Thursday April 10, 2014 @06:50PM (#7570213)
Heartbleed I just about understand, as despite this not being my field, smart people successfully summarized it in an easily digestible way so that I could even explain it to my mum. Can someone ELI5 this too please?
Re:OpenSSL vulnerable to timing attack? by pipeep on Thursday April 10, 2014 @06:58PM (#7570240)
memcmp compares two blocks of memory byte-by-byte. If the first two bytes don't match, the function can return early, otherwise it has to check the next byte. By measuring the execution times for all 256 possible bytes, one should be able to guess the first byte. Repeat this for the length of the memory being compared, and you should be able to essentially read the entire block of memory you're being compared against.

These attacks are usually done over a fast connection (maybe buy a machine in the same datacenter as your target), and through lots of measurements averaged together and measured for statistical significance.

We don't know where this function is used, so this might actually be a non-issue. We need someone more familiar with OpenSSL to comment.

Re:OpenSSL vulnerable to timing attack? by solarexplorer on Thursday April 10, 2014 @07:24PM (#7570332)
What kind of connection is fast enough to detect the difference of a single loop iteration inside memcmp()? I get that this is type of attack is possible if you share the same machine with the attacker. But over the network? Are there any credible sources for this?
Re:OpenSSL vulnerable to timing attack? by gsnedders on Thursday April 10, 2014 @07:53PM (#7570435)
You don't need fast — you need predictable latency, that's all. Once you have predictable latency, you can work out compute time. And latency can become predictable through a large number of samples.

Brumley and Boneh's 2003 paper ("Remote timing attacks are practical") on this is the typical reference: http://crypto.stanford.edu/~dabo/papers/ssl-timing.pdf

Re:OpenSSL vulnerable to timing attack? by solarexplorer on Thursday April 10, 2014 @08:27PM (#7570554)
My point is that to receive a single packet, you have an external interrupt, you go through the device driver, the ip stack, etc. And in all that you are looking for a difference of a single cycle. That won't work. Even with a zero latency network. There is just too much code involved.

You can measure differences of thousands or maybe even hundreds of cycles, but not single cycles. That's below the noise level of a modern computer.

Re:OpenSSL vulnerable to timing attack? by nitrogen on Thursday April 10, 2014 @08:43PM (#7570608)
Noise can be filtered out by averaging many samples.
Re:OpenSSL vulnerable to timing attack? by gsnedders on Saturday April 12, 2014 @02:30PM (#7578677)
Go read the paper. They show (through doing it!) that it's practical.
Re:OpenSSL vulnerable to timing attack? by CanSpice on Thursday April 10, 2014 @07:53PM (#7570436)
You probably want to read this: http://codahale.com/a-lesson-in-timing-attacks/

Particularly the section titled "You can’t possibly measure that, can you?"

Re:OpenSSL vulnerable to timing attack? by solarexplorer on Thursday April 10, 2014 @08:09PM (#7570487)
Thanks for the link. They claim that they can measure differences as small as 100ns, which is pretty impressive. A single iteration in memcmp is still a lot faster: about 1ns. I have a hard time to see how there is a realistic remote attack in this case.
Re:OpenSSL vulnerable to timing attack? by dragonwriter on Thursday April 10, 2014 @08:01PM (#7570461)
> What kind of connection is fast enough to detect the difference of a single loop iteration inside memcmp()?

Any, really, if you hit it with enough copies of each potential input so that you can get enough results to separate the timing difference from the noise. Though the faster, the more samples you can do per unit time, and the closer in network topology, the less sources of variability in latency that make it take more samples you'll have. At least, that's my understanding.

Re:OpenSSL vulnerable to timing attack? by tptacek on Friday April 11, 2014 @11:44AM (#7573558)
No, there's a threshold below which you can't effectively distinguish noise from signal even with many samples; theoretically, you can try to overcome this problem with more samples, but there are practical limits, and often actual constraints on the number of samples you can collect and the window of time you have to collect them.

Read Crosby and Wallach's "Opportunities and Limits" paper; the shorthand result of the paper is that across Ethernet you have a window of 100ns, and across an IP network something closer to 30us. The memcmp distinguisher is well below the IP network threshold.

Re:OpenSSL vulnerable to timing attack? by deadfa11 on Thursday April 10, 2014 @06:53PM (#7570225)
Basically, measure the time difference in the memory comparison. Typically, comparisons will short-circuit. That is, stop as soon as a difference is detected. But this is a problem for security situations like key comparisons. If 10 out of 20 bytes match, it will take a little bit longer to compare then if 5 out of 20 bytes match. With enough iterations, the key can be recovered due to these differences in time. The correct solution is to use a constant time comparison that always runs through the entire sequence of bytes.
Re:OpenSSL vulnerable to timing attack? by Moral_ on Thursday April 10, 2014 @06:55PM (#7570233)
memcmp does a binary level comparison of data.

On many versions, memcmp will return exactly when it sees a difference between the two buffers. Because it returns immediately one can figure out what byte it failed at due to timing and construct the correct input.

Some others have pointed out that it's a static function, which I stupidly overlooked. Others have pointed out it's not really used anymore so the title doesn't accurately reflect the issue. -- I will probably delete this thread.

Re:OpenSSL vulnerable to timing attack? by pipeep on Thursday April 10, 2014 @06:59PM (#7570247)
It wasn't static for older versions of OpenSSL, so this still might be an issue if someone was using that function with the assumption of it being constant-time.
Re:OpenSSL vulnerable to timing attack? by Rygu on Thursday April 10, 2014 @06:55PM (#7570231)
See that the memcmp() comparison takes longer as you guess the next byte correctly. Repeat until all bytes known.