# Is TLS secure against VM reset attacks?

Is the TLS protocol secure against VM reset attacks?

Background: Imagine running cryptographic software inside a virtual machine (VM). A VM reset attack is one where the the state of the software is checkpointed (snapshot) at one point in time, allowed to run forward, and then reset (rolled back) to the previous snapshot and run forward some more. In some cases, this allows powerful attacks. There exist protocols that are secure in the standard model, but not secure against VM reset attacks.

So, is TLS (as a protocol) secure against this kind of attack? Are there are any attacks? Are any of the TLS ciphersuites vulnerable to VM reset attacks?

Prior work: Ristenpart et al. showed that some TLS implementations are vulnerable to VM reset attacks, in the following paper:

Thomas Ristenpart and Scott Yilek. When Good Randomness Goes Bad: Virtual Machine Reset Vulnerabilities and Hedging Deployed Cryptography. NDSS 2010.

However, their attacks are all against particular implementations of TLS, and exploit failure to reseed the RNG. In other words, they seem to represent a failure of the implementation rather than of the protocol itself. It appears that a sufficiently careful implementation can shield against those attacks by adding additional entropy to the PRNG at appropriate points.

My question is: are there any protocol-level VM reset vulnerabilities in TLS?

Threat model: Here is a more detailed threat model. The software runs inside a VM. The attacker can freely interact with the software over the network, as usual. Also, the attacker gains two additional powers: at any point, the attacker can save a snapshot of the current state of the VM; and at any point, the attacker can roll the VM back to some prior snapshot and then cause it to continue execution from there.

It is easy invent protocols that would be secure in the standard model but insecure in this model. For instance, imagine a protocol that generates an ephemeral keypair $K_A,K_A^{-1}$ for a one-time signature scheme, signs the ephemeral public key $K_A$ with a long-term RSA signing key, receives some message from the attacker, and then signs some message using the ephemeral signing key. In the standard model, this would be as secure as using a RSA signature. But in the VM reset model, this is insecure: an attacker could snapshot the system right after it generates the ephemeral keypair, let it run forward to emit one message signed by the ephemeral private key; then roll it back to the snapshot and run it forward from there, observing a second message signed by the same ephemeral private key. Once the attacker observes two messages signed by the same one-time private key, the attacker can forge other messages. So that's a proof that protocol-level VM reset vulnerabilities can exist. But is the TLS protocol vulnerable?

• was TLS specifically designed to be resistant to these kinds of attacks? Jan 27 '16 at 3:33
• @RichieFrame, as far as I know, the answer is "no": SSL was designed before these attacks were even known in the cryptographic community.
– D.W.
Jan 27 '16 at 3:43

No, TLS is not secure against VM reset attacks. There are at least two attacks that are made possible by VM reset attacks, off the top of my head:

1. AES-GCM nonces are typically generated deterministically from the message counter value. If you set the snap shot prior to the local peer sending a plain text message that will change after resetting to the snap shot, you will have a severe nonce reuse vulnerability. As specified in RFC 5288, the 64 bit explicit nonce that is sent per packet MAY equal the message counter. The current TLS 1.3 draft removes the explicit nonce and replaces it with the implicit message counter xor:ed with the static IV values that were derived from the master secret. The same nonce generation is specified in the chacha20-poly1305 draft, which consequently has the same vulnerability. The traditional CBC cipher suites would be less vulnerable, in particular if used in encrypt-then-mac mode. Edit: In practice, the VM engine might be implemented to automatically close all TCP connections when suspended, and not necessarily reconnect when resumed after a reset. This might help to make the attack less practical against normal TLS connections directly over TCP. TLS over other types of channels and DTLS over UDP might be a different story.

2. Session master secrets are supposed to be discarded after any fatal alert corresponding to the session, such as failures to verify the finished messages. An attacker that is able to reset the local peer would obviously be able to circumvent this. This means e.g. that an attacker might attempt to perform session resumptions using the session id belonging to another peer, even after an initial failure. Such attacks against the session state do not depend on in which state the VM engine leaves the network stack when resetting to a snapshot.

If you break this down in terms of a client/server relationship I think it may offer some insight. TLS is neither explicitly or implicitly vulnerable and, like you said, it depends on the implementation.

For example: if the server utilizing TLS is virtualized, then rolling back to that point may introduce a replay. But if you’re talking about client authenticating with a server, then you don't have that issue unless there is some other factor like a bug or something or a bad implementation – which is why when you log out of a site and restore a VM to the past you are still logged out, but if you were to restore the server to that point (let's say in a backup or something) you may have that problem especially if the cookie hasn't expired yet. Although, with proper security “best practices” that may be mitigated.

If you could spoof the time on the server though there may be an issue there as well. There is nothing inherent though in TLS as there are many protocols that could have an issue with that which is why it's called what it's called. Does that help? My point, in a nutshell, is that there are other factors, as you well know, and the security of the protocol itself may have very little to do with your server getting pwnd.

• You seem to be claiming that there are no protocol-level vulnerabilities. Can you support that claim with evidence, analysis, citations, or other reasoning? (Just because there exist some implementation-level vulnerabilities doesn't mean there are no protocol-level vulnerabilities. Put it another way, just because we know of some implementation-dependent vulnerabilities doesn't mean that there are no vulnerabilities that apply to all implementations.)
– D.W.
Jan 27 '16 at 3:02
• What I was saying was that it's not necessarily dependent on the protocol and that there are no KNOWN inherent bugs in TLS that make it vulnerable but that's implied in the statement. I wasn't saying TLS is immune in any way, at all. At least it has some degree of support. Are you bug hunting? That would be a good one to keep an eye on since it is used so widely.
– jb41
Jan 27 '16 at 3:24
• an attack from a vm on the hypervisor causing a different and specific vm to reset or revert is certainly plausible, and it may be the only malicious (or accidental) thing that can be done, does not mean the server is pwnd but can certainly cause issues as if it was Jan 27 '16 at 3:25
• @RichieFrame right, exactly, BUT that is independent of a bug in the protocol itself, although it may appear as being related. They are still distinct.
– jb41
Jan 27 '16 at 3:27
• The implementation is key here not necessarily the protocol. Check out this OpenSSL bug from 2010: seb.dbzteam.org/crypto/jpake-session-key-retrieval.pdf It is issues like those that are cause for concern, certainly a lot more concern than an exotic issue defined as being a protocol issue, which would certainly be an issue if ever revealed. Probability lends itself to reality: openssl.org/news/vulnerabilities.html
– jb41
Jan 27 '16 at 3:41