Lucky Thirteen: Breaking the TLS and DTLS Record Protocols
isg.rhul.ac.uk
isg.rhul.ac.uk
The original "good enough" timing fix (in response to Vaudenay) was based on the assumption that an attacker would not realistically be able to measure the small remaining timing differences.
This paper has demonstrated that it is possible to measure the small remaining timing differences, but it seems as if that requires:
1) The server not to be doing anything else or processing any other TLS sessions.
2) The attacker to be in a hyper-controlled networking environment with extremely low latency to the server and zero interference.
Do you see this attack ever being possible in a practical situation?
Against TLS it's tougher. The paper is suggesting a difference of ~10000 cycles, which may be ~5us. So, yes, you need to have a good connection to the server to be able to measure that difference, but that's not unthinkable to me. I know that you could get such a connection to a Google server if you were willing to pay some money to get a machine hosted in the right place.
But it also appears that it's fairly easy to get a process instantiated on the same EC2 host as a target application. Or maybe your server is running on a small ARM device and so the difference is much larger.
Don't get me wrong - this is a trivial issue compared to, say, the Java vulnerabilities that we've seen recently. But it's huge compared to the level of security that plain TLS should be providing. Saying that it's secure as long as you don't allow the attacker to be close by, or you don't run it on a slow machine isn't good enough for me.
But I admit that it's unlikely to anyone will ever actually perform this attack in anger. Although I would have said the same about MD5 collisions at the beginning of 2012 :)
(And yeah, I have little faith in DTLS generally).
However, many large sites have several serving locations, testing servers etc. If a location is drained of frontend traffic, or the testing server isn't being used all the time then you may well be able to find an idle server. After all, the attacker gets to choose where the traffic goes.
Of course, you do need a victim which automatically reconnects or uses DTLS, both of which are somewhat questionable.
The attacker can then alter the encrypted record and send it onwards to the server. Because the record has been altered, the server will reject it and close the connection. However, the amount of time that it takes to reject the record reveals something about the plaintext padding. If the client will repeatedly send the same plaintext secret (e.g. HTTP cookie) over many connections (e.g. a web browser repeatedly requesting a resource) then the attacker can learn a little from each connection and, after thousands of connections, start to decrypt the secret.
This is the part I don't get. Symmetric cyphers in CBC mode don't traditionally behave that way. You encrypt the block and get your answer. Is there a variable-length HMAC in there somewhere or something?
Since CBC mode needs to pad its input, this means that the padding is outside of the authentication.
So, when decrypting, the padding has to be removed and then the MAC can be checked. But the number of blocks hashed in the MAC depends on the padding. So the attacker can setup the padding such that a valid padding means that it's removed and one less hash block is calculated. An invalid padding isn't removed and the MAC takes one more hash-block worth of time.
Thus the attacker can tell whether a padding was valid and that's sufficient to completely break TLS.
If you need to encrypt something, I recommend NaCl: http://nacl.cr.yp.to/
Also, I'm under the impression that NaCl achieves impressive speeds, but at the cost of using implementations tuned to a specific CPU. This makes the amount of code that has to be reviewed considerably larger.