Subject: [tcpinc] Resumption safety (was "Eric Rescorla's Discuss on draft-ietf-tcpinc-tcpcrypt-09: (with DISCUSS and COMMENT)")

From: Kyle Rose <[email-masked]>
Date: Wed, 29 Nov 2017 18:12:20 -0500

In the IETF LC thread referenced in the thread subject (CC'ed to the tcpinc
list), Ekr (acting as security AD) raised an issue on which we need to seek
rough consensus from the WG: that of the key-reuse risk potential in the
resumption key schedule.

Please see that thread for more details (especially Ekr's email from Nov
18, in the archives at
https://www.ietf.org/mail-archive/web/tcpinc/current/msg01471.html), but a
brief summary is that, with the catastrophic loss of security inherent in
AEAD modes like GCM when the same key and nonce are used to encrypt
multiple blocks, the construction of ss[i] (see section 3.3 of
draft-ietf-tcpinc-tcpcrypt-10) depending only on ss[i-1] and some
constants, and in particular *not* depending on fresh randomness from each
party, will inevitably break confidentiality and authentication should an
implementation not strictly prevent the reuse of ss[i] on multiple
connections.

There is language in the draft prohibiting reuse of ss[i]:

q( A session secret may not be used to secure more than one TCP
connection.  To prevent this, a host MUST NOT resume with a session
secret if it has ever enabled encryption in the past with the same
secret, in either role. )

but there is concern that this language is not strong enough: first, that
it does not explain the reason for the prohibition; and second, because the
prohibition refers only to "a host" and does not directly address the
threat posed by sharing of resumption state across machines.

Given the absence of a mechanism for stateless resumption in tcpcrypt (such
as that provided by TLS session tickets), this prohibition essentially
precludes resumption across a server pool via periodic state sharing, as
there would be a race condition between use of ss[i] on one server and
invalidation of that value throughout the rest of the pool.

The chairs are looking for direction from the WG on how to proceed. From
the discussion in the other thread, I see a number of basic options,
ranging from least- to most-invasive:

(1) Strengthening the language around this prohibition.
(2) Adding a 0-RT mechanism for adding fresh randomness to the resumption
key schedule.
(3) Adding a 1-RT mechanism for adding fresh randomness to the resumption
key schedule (that also provides a measure of replay protection at the cost
of an additional round trip).
(4) Switching to a stateless resumption mechanism, which would necessarily
involve fresh randomness (but at the cost of requiring an additional round
trip for resumption owing to insufficient option space for encoding state).

I would like the WG to discuss the risks and benefits of each option and
decide how to proceed. I believe we already have rough consensus on
sticking with a stateful resumption scheme given the latency costs of
stateless resumption under the constraints of TCP, but the WG can always
reopen that question if there is rough consensus to do so.

Thanks,
Kyle

---

From: "Black, David" <[email-masked]>
Date: Thu, 30 Nov 2017 14:55:27 +0000

Expanding on this:

> but there is concern that this language is not strong enough: first, that it does
> not explain the reason for the prohibition; and second, because the prohibition
> refers only to "a host" and does not directly address the threat posed by sharing
> of resumption state across machines.

Here are a few ways in which this can go wrong in practice:

1)      State extraction, including session secrets, to resume on a different physical or virtual host, possibly as part of failover.

a.       This is the server cluster case in Ekr’s original review of this draft.

2)      Copying a running virtual machine, including memory, which creates a copy of the session secrets.  Such copies are routinely stored on non-volatile storage, from which the VM can be resumed.

a.       The text in the draft that says “Hosts SHOULD NOT write any session secrets to non-volatile storage” seems unlikely to affect this sort of data center operational practice.

3)      Implementation bug that reuses session secrets.

a.       Such reuse violates the MUST NOT requirement quoted above, but that’s not an absolute bar to code bugs.

My take as an individual is that while it’s plausible to write “MUST NOT” text for state extraction (1), the other two situations are much more difficult to avoid/prevent.

An additional reason for concern is that the encryption provided by the mandatory AEAD algorithm for tcpcrypt, AEAD_AES_128_GCM, is a stream cipher (AES GCM), for which reuse of a <nonce, key> pair is catastrophic - XOR-ing the two ciphertexts removes encryption.

Thanks, --David

From: Tcpinc [mailto:[email-masked]] On Behalf Of Kyle Rose
Sent: Wednesday, November 29, 2017 6:12 PM
To: tcpinc <[email-masked]>
Cc: Eric Rescorla <[email-masked]>; Mirja Kuehlewind (IETF) <[email-masked]>
Subject: [tcpinc] Resumption safety (was "Eric Rescorla's Discuss on draft-ietf-tcpinc-tcpcrypt-09: (with DISCUSS and COMMENT)")

In the IETF LC thread referenced in the thread subject (CC'ed to the tcpinc list), Ekr (acting as security AD) raised an issue on which we need to seek rough consensus from the WG: that of the key-reuse risk potential in the resumption key schedule.

Please see that thread for more details (especially Ekr's email from Nov 18, in the archives at https://www.ietf.org/mail-archive/web/tcpinc/current/msg01471.html), but a brief summary is that, with the catastrophic loss of security inherent in AEAD modes like GCM when the same key and nonce are used to encrypt multiple blocks, the construction of ss[i] (see section 3.3 of draft-ietf-tcpinc-tcpcrypt-10) depending only on ss[i-1] and some constants, and in particular *not* depending on fresh randomness from each party, will inevitably break confidentiality and authentication should an implementation not strictly prevent the reuse of ss[i] on multiple connections.

but there is concern that this language is not strong enough: first, that it does not explain the reason for the prohibition; and second, because the prohibition refers only to "a host" and does not directly address the threat posed by sharing of resumption state across machines.

Given the absence of a mechanism for stateless resumption in tcpcrypt (such as that provided by TLS session tickets), this prohibition essentially precludes resumption across a server pool via periodic state sharing, as there would be a race condition between use of ss[i] on one server and invalidation of that value throughout the rest of the pool.

The chairs are looking for direction from the WG on how to proceed. From the discussion in the other thread, I see a number of basic options, ranging from least- to most-invasive:

(1) Strengthening the language around this prohibition.
(2) Adding a 0-RT mechanism for adding fresh randomness to the resumption key schedule.
(3) Adding a 1-RT mechanism for adding fresh randomness to the resumption key schedule (that also provides a measure of replay protection at the cost of an additional round trip).
(4) Switching to a stateless resumption mechanism, which would necessarily involve fresh randomness (but at the cost of requiring an additional round trip for resumption owing to insufficient option space for encoding state).

I would like the WG to discuss the risks and benefits of each option and decide how to proceed. I believe we already have rough consensus on sticking with a stateful resumption scheme given the latency costs of stateless resumption under the constraints of TCP, but the WG can always reopen that question if there is rough consensus to do so.

Thanks,
Kyle

---

From: Tero Kivinen <[email-masked]>
Date: Fri, 1 Dec 2017 00:01:23 +0200

Black, David writes:
> 2)      Copying a running virtual machine, including memory, which creates a
> copy of the session secrets.  Such copies are routinely stored on non-volatile
> storage, from which the VM can be resumed.

I think this kind of behavior is so common, (and is getting even more
common in future) that the protocol needs to be resistant to this. I
mean, the person doing the cloning does not have any knowledge about
the tcpcrypt used in the machine, and quite often this is something
that is even impossible to detect inside the machine, so
implementation cannot do anything for this. As this will cause
catastrophic failure for the security it is something we should deal
with even when it will cost us something.

Note, that attacker might be able to trigger this also on purpose, but
as those would require active attacks, they are mostly outside the
scope of what tcpcrypt is trying to protect.

But I still think accidental cases (i.e., where old VM is restored
even when no real attack), are common enough that we should cope with
them. So I think we should add protection against accidental reuse.
-- 
[email-masked]

---

From: "Valery Smyslov" <[email-masked]>
Date: Fri, 1 Dec 2017 09:54:44 +0300

Hi,

> > storage, from which the VM can be resumed.

[...]

> > An additional reason for concern is that the encryption provided by the mandatory 
>> AEAD algorithm for tcpcrypt, AEAD_AES_128_GCM, is a stream cipher (AES GCM), 
>> for which reuse of a <nonce, key> pair is catastrophic - XOR-ing the two ciphertexts removes encryption.

This is not tcpcrypt problem. The same problem applies to any
security protocol (IPsec, TLS, etc.) that uses counter based cipher modes (GCM, CCM, etc.). 
Switch to nonce-misuse resistant modes.

Regards,
Valery Smyslov.