Re: [TLS] TLSv1.3 Cookies

Eric Rescorla <ekr@rtfm.com> Wed, 13 September 2017 15:59 UTC

Return-Path: <ekr@rtfm.com>
X-Original-To: tls@ietfa.amsl.com
Delivered-To: tls@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id B8E89132949 for <tls@ietfa.amsl.com>; Wed, 13 Sep 2017 08:59:06 -0700 (PDT)
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 I1RFlwEx-HyI for <tls@ietfa.amsl.com>; Wed, 13 Sep 2017 08:59:05 -0700 (PDT)
Received: from mail-io0-x22c.google.com (mail-io0-x22c.google.com [IPv6:2607:f8b0:4001:c06::22c]) (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 E31A9132A89 for <tls@ietf.org>; Wed, 13 Sep 2017 08:59:04 -0700 (PDT)
Received: by mail-io0-x22c.google.com with SMTP id k101so3358530iod.0 for <tls@ietf.org>; Wed, 13 Sep 2017 08:59:04 -0700 (PDT)
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=wd4Q8Lp9oAz6FmY+qPCqTQ+WulXjMIEFWqtsMRQSgrY=; b=P5g5m4PTi5UwGp1KxCi4yFPDC+uAE9QjEtW0rhMds3eAJZUoC/vMSYUk/WlwoUphRo nSzCOj7m4NugXAQCkYE3SYR1yF4JhsXDi/VI55gYhFn73w5fzl4EkJHabjmvGL2Cedu2 QkncM43KK3zx+ZQNn15AJWrpN4DulLSPOPTXt+6vuETsIYQ5Mgn4ZI83mNH3RCrNrwHm ZPU49x5dET+3g6kLW5WAlPWVVDjsAlrOtcRFxDwe2o6o0PRoISwzvYcT1nV++Mlj0FVM F2ftNks+uUUQOT0BZKiUwP+s6Rv3OjssALWu67Kb62OKzdz562r4aCqvEA7VgpmLMr/j TnYA==
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=wd4Q8Lp9oAz6FmY+qPCqTQ+WulXjMIEFWqtsMRQSgrY=; b=Am8royRCYJwJDl0WDNGB9iijbHbRVF1SbwinVEyntXM1BluKSMl8VjihYTIeChKUjm jYAfiWlYNceJ8Kr0IzBaw/P72Z38H7zw4fHjxFIO5twRZHMmzt4zfJX1IC/t4BYd6TSs cirjdnOoFxKdgOi3C4BtRRZX4yGHabENU8oUGtB95a2dDyUNkiWC+SBLh5smB90kzbqT 4GJxYvuJNg3S+Ubuc4CTMTDmGc9mGEKQgyh75Yvr92gthmQ+NK3/Qrz1vZZQGtA0PvRa uWmAWuQzhm3sSyiXC1SY1F4dyI3wy4K1W6RLGsDak0GhtSdaR4Ql0CrQKtmzs2rjPeuK LaYA==
X-Gm-Message-State: AHPjjUisZrqS+Q/8bofpuPr5X81s5pzjG31Q8XppZMQCeZrBRsI5jotA Nw1dCMiOdmLcV4MeOLaQoxU27q8YIZDcQ9uC9vhblg==
X-Google-Smtp-Source: AOwi7QAD5mimPF1Gpqt6dLwVb4Gc8idFvc08LNeH884pmqMygunVLefuhIvf+0vbUL+OwhxTbmJ6x4DEFPcPPbhHY2Y=
X-Received: by 10.202.117.215 with SMTP id q206mr4414374oic.36.1505318344191; Wed, 13 Sep 2017 08:59:04 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.168.74.197 with HTTP; Wed, 13 Sep 2017 08:58:23 -0700 (PDT)
In-Reply-To: <CAMoSCWYUN=M=HdqUG_xmsUxjYXEfp+VqeCvPfYYynwkxyi52_w@mail.gmail.com>
References: <CAMoSCWYXWJMkFAdrcy033_bjMZjRUiU-V5f8MkoTXyvDfw+z6A@mail.gmail.com> <CABcZeBOS5C+oHchVqhOr-ob3t4c8dxqz5b_iUYiNcbXS5ZaCDQ@mail.gmail.com> <CAMoSCWYUN=M=HdqUG_xmsUxjYXEfp+VqeCvPfYYynwkxyi52_w@mail.gmail.com>
From: Eric Rescorla <ekr@rtfm.com>
Date: Wed, 13 Sep 2017 08:58:23 -0700
Message-ID: <CABcZeBMLWyy7e--=8Hc7nfcWhB-30WiY7NpscsW9NPDuUNGM6A@mail.gmail.com>
To: Matt Caswell <frodo@baggins.org>
Cc: "tls@ietf.org" <tls@ietf.org>
Content-Type: multipart/alternative; boundary="001a113e9a682e1c370559143d58"
Archived-At: <https://mailarchive.ietf.org/arch/msg/tls/Wd3GqfsCGWsHqIRJwrUJw5gxGbk>
Subject: Re: [TLS] TLSv1.3 Cookies
X-BeenThere: tls@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: "This is the mailing list for the Transport Layer Security working group of the IETF." <tls.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/tls>, <mailto:tls-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/tls/>
List-Post: <mailto:tls@ietf.org>
List-Help: <mailto:tls-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/tls>, <mailto:tls-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 13 Sep 2017 15:59:07 -0000

On Wed, Sep 13, 2017 at 8:40 AM, Matt Caswell <frodo@baggins.org> wrote:

> On 13 September 2017 at 16:12, Eric Rescorla <ekr@rtfm.com> wrote:
> > On Wed, Sep 13, 2017 at 7:53 AM, Matt Caswell <frodo@baggins.org> wrote:
> >>
> >> I am looking at trying to implement the TLSv1.3 stateless cookie
> >> mechanism (in order to be able to support QUIC stateless retries).
> >>
> >> I am not clear how cookies are supposed to interact with early_data.
> >> Consider the scenario where a server is operating statelessly. Because
> >> there is no state each ClientHello looks like the first one it ever
> >> saw. The server only knows that a particular ClientHello is actually a
> >> ClientHello2 following an HRR because of the state held in the cookie.
> >>
> >> What happens when a client attempts to send early data to such a
> >> server? The server will process the ClientHello and determine that
> >> there is no cookie, sends back an HRR and then forgets all of its
> >> state and waits for the next ClientHello. However what it actually
> >> gets next is early_data. It does not know that that early data
> >> followed an earlier ClientHello (because it is stateless) so it does
> >> not know to skip the records. It just looks like illegal records so,
> >> presumably, it will respond with an alert.
> >
> >
> > It seems like there are three cases here:
> >
> > 1. TLS over TCP -- you won't do this statelessly, and so you can know to
> > dump
> > early data.
> > 2. DTLS -- you can be stateless, but you don't terminate connections on
> > decrypt
> > error, so you just discard the packets as you would any other bogus
> packet.
> > 3. QUIC -- the data looks like an unknown connection (you have dumped the
> > conn_id)
> > so you silently discard.
>
> Right - well that's the case right now - I guess we don't know how
> this feature might be used for in the future?
>

True...


So in case (3) should this be documented somewhere - either in the
> TLSv1.3 spec or the QUIC spec?


I think it should go in the QUIC spec, because it's QUIC's responsibility
to provide
the transport abstraction to TLS.




> Perhaps the TLSv1.3 spec should just
> state that protocols using the cookie feature should specify how
> early_data is to be handled - and then leave it up to QUIC/DTLS to
> define the behaviour in each of their cases.
>

Generally, I'd prefer to keep this in the other specs, because these are
issues
that arise principally when TLS is embedded in other specs.... If someone
has
a PR, I can take a look, though.


>> I am also unclear what protects against cookies being replayed. If an
> >> attacker wishes to perform an amplification attack on a particular IP
> >> it awaits a legitimate ClientHello with a cookie coming from that IP
> >> and records it. It then replays that ClientHello with cookie to the
> >> server many times. The cookie looks valid to the server and it
> >> responds with its ServerHello, full Certificate chain etc back to the
> >> original IP. What have I missed here?
> >
> >
> > Yes. Cookies aren't generally intended to stop that kind of
> amplification,
> > they're just designed to prevent blind attacks on IPs you're not on-path
> > for. Note that QUIC has an additional defense here of requiring that
> > that ClientInitial be a certain minimum size. Note that if you are
> on-path
> > you can still get a lot of amplification even with TCP at the cost of
> > sending SYN, ACK, ClientHello...
>
> Ok - that makes sense. Perhaps this is worth a note somewhere (not
> sure where it would fit).
>

I filed:
https://github.com/tlswg/tls13-spec/issues/1079



>
> Matt
>