Re: [tcpinc] Eric Rescorla's Discuss on draft-ietf-tcpinc-tcpcrypt-09: (with DISCUSS and COMMENT)

Eric Rescorla <ekr@rtfm.com> Mon, 13 November 2017 02:10 UTC

Return-Path: <ekr@rtfm.com>
X-Original-To: tcpinc@ietfa.amsl.com
Delivered-To: tcpinc@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 25EA71275FD for <tcpinc@ietfa.amsl.com>; Sun, 12 Nov 2017 18:10:09 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.598
X-Spam-Level:
X-Spam-Status: No, score=-2.598 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=rtfm-com.20150623.gappssmtp.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VP2gOn-u5Dmh for <tcpinc@ietfa.amsl.com>; Sun, 12 Nov 2017 18:10:06 -0800 (PST)
Received: from mail-yw0-x229.google.com (mail-yw0-x229.google.com [IPv6:2607:f8b0:4002:c05::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 7617812714F for <tcpinc@ietf.org>; Sun, 12 Nov 2017 18:10:06 -0800 (PST)
Received: by mail-yw0-x229.google.com with SMTP id c145so668767ywb.9 for <tcpinc@ietf.org>; Sun, 12 Nov 2017 18:10:06 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rtfm-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=uKiFwUqtchuISQUd/hR9CVqrLOlNXbtuGkfdyVVvDRQ=; b=j1F3PZqRaCS/N56gq4xbCw7bVuiFb84Qh7oI/7npJ9TYy4IHp6ysDVXHpk0GyW2mOa Dtp+aJFYbiQzfLi9HPULbiy+tCoHU9IG4RHzIGEmcWXHmGlxC+Fgm2PbiVg84ZEX/iCy M3kKhLQECs5VdHllQwPTOHVsvd81JjFNC68BIsA0JHTZ28jJJ/gO2VJM1k8KIViFAW/I 3V+z2QdkVHFaZIaPeGryuV7Wk01x/PJ1sQNfK8PFzU1i61kV56++/UTkrvg+es1eKOH5 fqtal/2St4jFjIC/AoxyXNRw6dYsLRs3t+l1opyQvexNs6BNE1USBuik9f375/j1mPPE MD0Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=uKiFwUqtchuISQUd/hR9CVqrLOlNXbtuGkfdyVVvDRQ=; b=cb1/8GOOJhEpjk44U6DrfGUKsx0VlkbHgMTqsIgtUGOJKAAGumdv2BoX6urzHDWiiq oyyrAqzWmkoxfV0mgLkau7EpOiFDslJFzSjZBkuoX0NUkRInYLPbc0rr/t6Ri5XCgv80 Vu11yaUBqS6ZAfLTNxDirVg7eW6KjDTeN6os/ISvr67iuIOb1chV9xfHpUvBz+vgT2m5 mkIKToHpGOTVYu0rPHbuuuXsIYCorPNEc+clq5qXpZwjqV4W0yuSe60O08oh6q5R50D3 m9N3jLCMjFtlkeusUxF2/8h9s2hg8r+oxoA9GBST2A0gC6lK5BXeskTfuZSjeGxY0UQC 9mKQ==
X-Gm-Message-State: AJaThX5jDKqWI8nHLi2Gqz9rJehl+qne9aS1DT5RDLc/HJZRq2ylfwbu 1bUR6rz1gNNzvNVq6GN201OJMwTnTwEStHBdhvoUfw==
X-Google-Smtp-Source: AGs4zMbqop2IhhoyTjCB3oXB8bssP0abkHrRGtToSm6VmmzTirb+wrewl9bHaIbJ0VhbcpUJJoGO/SgEfn6iTI77XHc=
X-Received: by 10.129.36.1 with SMTP id k1mr4939431ywk.485.1510539005727; Sun, 12 Nov 2017 18:10:05 -0800 (PST)
MIME-Version: 1.0
Received: by 10.129.61.12 with HTTP; Sun, 12 Nov 2017 18:09:25 -0800 (PST)
In-Reply-To: <CAJU8_nXKpEgvWEZtEPw=wyDmrVteOJaDvmXsDwbUdueMUcaRhA@mail.gmail.com>
References: <151036992713.398.18032326140786383584.idtracker@ietfa.amsl.com> <CAJU8_nXKpEgvWEZtEPw=wyDmrVteOJaDvmXsDwbUdueMUcaRhA@mail.gmail.com>
From: Eric Rescorla <ekr@rtfm.com>
Date: Mon, 13 Nov 2017 10:09:25 +0800
Message-ID: <CABcZeBPaLwD++SPPNwx3Qd9ydOM46h1PwVyiOcw=S-Hif=CO5w@mail.gmail.com>
To: Kyle Rose <krose@krose.org>
Cc: The IESG <iesg@ietf.org>, draft-ietf-tcpinc-tcpcrypt@ietf.org, tcpinc-chairs@ietf.org, tcpinc <tcpinc@ietf.org>
Content-Type: multipart/alternative; boundary="001a1142e4ccdb1d2c055dd3c425"
Archived-At: <https://mailarchive.ietf.org/arch/msg/tcpinc/25xStjIgoJ-MWFU-xHuN3OYJTeQ>
Subject: Re: [tcpinc] Eric Rescorla's Discuss on draft-ietf-tcpinc-tcpcrypt-09: (with DISCUSS and COMMENT)
X-BeenThere: tcpinc@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: "Working group mailing list for TCP Increased Security \(tcpinc\)" <tcpinc.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/tcpinc>, <mailto:tcpinc-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/tcpinc/>
List-Post: <mailto:tcpinc@ietf.org>
List-Help: <mailto:tcpinc-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/tcpinc>, <mailto:tcpinc-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 13 Nov 2017 02:10:09 -0000

On Mon, Nov 13, 2017 at 9:56 AM, Kyle Rose <krose@krose.org>; wrote:

> On Sat, Nov 11, 2017 at 11:12 AM, Eric Rescorla <ekr@rtfm.com>; wrote:
> > ----------------------------------------------------------------------
> > DISCUSS:
> > ----------------------------------------------------------------------
> >
> > https://mozphab-ietf.devsvcdev.mozaws.net/D3970
> >
> >    2^64 bytes in the underlying TCP datastream (which would cause the
> >    "offset" field to wrap) before re-keying.
> >
> > In TLS and other WGs, we have adopted the practice of
> > salting the nonce with a secret per-connection value to avoid
> > large-scale surveillance attacks. Why did you opt to use a weaker
> > construction. See:
> > https://tlswg.github.io/tls13-spec/draft-ietf-tls-tls13.
> html#security-record-layer
> > and https://eprint.iacr.org/2016/564.
>
> I think I need some clarification on the point here. From the relevant
> passage in the TLS 1.3 draft:
>
> q( In order to prevent mass cryptanalysis when the same plaintext is
> repeatedly encrypted by different users under the same key (as is
> commonly the case for HTTP), the nonce is formed by mixing the
> sequence number with a secret per-connection initialization vector
> derived along with the traffic keys. See [BT16] for analysis of this
> construction. )
>
> What is the situation, commonly the case for HTTP, in which different
>
users would be using the same key for encryption?


That's not the assumption. It's a time-space tradeoff. Say you have a
128-bit
key. The attacker computes the value:

  Encrypt(K, "GET / HTTP/1.1") [or whatever]

For a feasible subset of the key space (e.g., 2^80 or so). It then captures
a large fraction of the traffic on the Internet and looks for matches for
one
of these strings. If it has a match, it now immediately knows the key. Given
the amount of traffic on the Internet, this is just maybe barely feasible
with
128-bit keys. However, with a randomized (secret) nonce, it becomes
infeasible.




>    FIN flag set, it MUST immediately send a frame (with empty
> >    application data if necessary) with "rekey = 1".
> >
> > I don't think that the algorithm in this section
> > necessarily works properly, because you have to handle rekeys in
> > sequence:
> >
> > Frame 1 [0:999]
> > Frame 2 [1000:1999, rekey=1]
> > Frame 3 [2000:2999, rekey=1]
> >
> > Now what happens if the frames are re-ordered so you get Frame 3 and
> > then Frame 2. You will try to decrypt Frame 3 with generation 2 and
> > Frame 2 with generation 3, neither of which will work (though you
> > might be able to interpret the text loosely to have you try to decrypt
> > Frame 2 with generation 2). Note that if you were to resequence before
> > processing, this wouldn't happen.
> >
> > At minimum I think some clarification is needed here.
>
> I'm confused. The byte stream will be delivered in-order via TCP
> sequence semantics, so receiving frames (TLV within the TCP
> bytestream) out-of-order should not be possible. If a MitM reordered
> the frames, the receiver would either drop the frame or close the
> connection following a failure to authenticate upon decryption:
>
> q( In the latter case, the implementation MUST
>    either drop the TCP segment(s) containing the frame or abort the
>    connection; but if it aborts, the implementation MUST raise an error
>    condition distinct from the end-of-file condition. )
>

Maybe I'm misunderstanding tcpcrypt, so let me ask a preliminary
question:

Say you have two TCP segments protected using tcpcrypt, N and N+1
If the receiver receives N+1 before N, how does it behave?


> Given that you are allowing P-256 and point reuse, you
> > should be requiring point validation. See:
> > https://tlswg.github.io/tls13-spec/draft-ietf-tls-tls13.
> html#rfc.section.4.2.8.2
> > https://tlswg.github.io/tls13-spec/draft-ietf-tls-tls13.
> html#elliptic-curve-diffie-hellman
> >
> > You should probably also be requiring Curve25519 output validation.
>
> Agreed.
>
> > You still seem to need to specify an MTI symmetric algorithm.
>
> Daniel noted this in his October 25 email, but you are right: I can't
> seem to find it in the latest draft, either. Did that change get lost?
>

I am not sure.



> ----------------------------------------------------------------------
> > COMMENT:
> > ----------------------------------------------------------------------
> >
> >
> > The design of session resumption here essentially precludes doing
> > tcpcrypt resumption across servers (as one does with TLS) because you
> > need extremely tight control of ss[i] or you have catastrophic
> > results. Was this a deliberate choice by the WG?
>
> The idea of doing something more ticket-like was discussed, but David
> pointed out (in the thread here:
> https://www.ietf.org/mail-archive/web/tcpinc/current/msg00919.html)
> that tickets might not meet the charter mandate for forward secrecy. I
> don't recall discussing the implications of mismanaging ss[i], but
> I'll defer to Daniel on that point. Same goes for the following:
>

I don't think the issue here is tickets, but rather the lack of a nonce.
The point is that (say) the implementation fails to properly delete
ss[i] after encrypting some data. Then if an attacker can force
you to reuse ss[i], it can potentially recover data. This would not
be the case if you mixed in a nonce from both sides (the way that
TLS and IKE do).

-Ekr