Re: [Unbearable] 0-RTT Token Binding: When to switch exporters?

Eric Rescorla <ekr@rtfm.com> Tue, 21 March 2017 00:38 UTC

Return-Path: <ekr@rtfm.com>
X-Original-To: unbearable@ietfa.amsl.com
Delivered-To: unbearable@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 1AB89129417 for <unbearable@ietfa.amsl.com>; Mon, 20 Mar 2017 17:38:28 -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 BD7pbTwK0ogq for <unbearable@ietfa.amsl.com>; Mon, 20 Mar 2017 17:38:25 -0700 (PDT)
Received: from mail-yw0-x22a.google.com (mail-yw0-x22a.google.com [IPv6:2607:f8b0:4002:c05::22a]) (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 6CCBC12940F for <unbearable@ietf.org>; Mon, 20 Mar 2017 17:38:25 -0700 (PDT)
Received: by mail-yw0-x22a.google.com with SMTP id p77so100810348ywg.1 for <unbearable@ietf.org>; Mon, 20 Mar 2017 17:38:25 -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=/6/OGgQ9oOGta4teJMijgzj4BtU7oqf5kyRXLfC2WSk=; b=bSEwXO1x4iLpvfW3oGfeWcalZMe1RCWXih/PjMEGttUb+VfvNjxNSVbbkFQNrhkrPC K6mWr2VkluMQakxZIwU57U3sS3iVPDyX0Ngx5TxAprdMkKWF/dofEfdjD9cRkOwccTzt XjgiWa7m14ExwstsNB5DhqMUi7hsdpVM/Nr4aSGX0l82ywC7VsR0AyYte3zGyIrzlKI3 BFULXdOBEzhZIsLLK299CIjvnhWXUL367PM0GmAiPKhap0P8xbzHAKyY0X69IPcz1yJ6 mfqN7W0xt5MGxTvgf+Vu/+NkCSRWUP0Ru7V9rHpgFDVZ5JfI7B98RLRsyc9s7YAylWax poXg==
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=/6/OGgQ9oOGta4teJMijgzj4BtU7oqf5kyRXLfC2WSk=; b=TGDxMrSA5GIlAqGAJElmBJtcSjWUxyOsx6crxaQ+aABlDCczhTv/KH1x+1ssV6FSj4 sDDXsQONhOrsu5WeTs4z/wZiUqj0l6zELkQ5u8GNY2b7N9aRxUJxYInaW7gwFDk9jnXY UznLfLJLtuIeInDS3wHST2erwgacHdjHMJ1Q4oG+f0MGufoZ5j0jB45OnFVNwib298Mo 0b5w7g9qZD2JqCx7SkYi8STX7uzzadaTJb2LaWJ223TaXsoPbEUvULUf7sG6TNCXBvDL YAwMlRAk/XUfLVB67Wtw4PYgxilAQs1EL2ePVYT5lWHAkfdmmQEaomTKeUUUWl6wAP84 z4EQ==
X-Gm-Message-State: AFeK/H1VrrFzTZkmlftpaMeEayhWEz+JcZ7kTRFV5Gl6LXDAsLEgH6D3uQDbSB00hGvOA6q28uDc87CJ06RyHg==
X-Received: by 10.37.78.195 with SMTP id c186mr20811347ybb.180.1490056704576; Mon, 20 Mar 2017 17:38:24 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.129.154.210 with HTTP; Mon, 20 Mar 2017 17:37:43 -0700 (PDT)
In-Reply-To: <CACdeXi+rbsKf7zbpe4n49BUmj1ay0GSg_A48ZrAztKPY9+Fm2A@mail.gmail.com>
References: <CACdeXiK2Hs=Kz_5OFryWR+9_t6nDL_p7NKjw=CwRsua_E5S9Mw@mail.gmail.com> <DM2PR0301MB084793F58146F8574BF36EE18C780@DM2PR0301MB0847.namprd03.prod.outlook.com> <CACdeXiJGcsTxrSWmd5BZrfoWTHhFF3+RisQFD628iYNMzZakhQ@mail.gmail.com> <CACdeXiJFe7-jM9qEnNB+Wp3joGxF_X1z+-dPywb9SRZuSNmAzQ@mail.gmail.com> <DM2PR21MB0091E3F087E1AECA3A63A3788C560@DM2PR21MB0091.namprd21.prod.outlook.com> <CACdeXi+YjLaXtoX47LtVK4Ay2y-mCOOraV46gbbbuQPL40ngXg@mail.gmail.com> <DM2PR21MB00910C83983BEE885B0E04288C560@DM2PR21MB0091.namprd21.prod.outlook.com> <CACdeXiLON5OAjfFCNsenCeaGV3a_LDoi17VAk=fSzF0YA5=f7Q@mail.gmail.com> <CACdeXiLNCrPSz0_hZSpQ6tsoHB7ryJ2dCnHjUYwu5vu5fO4XBg@mail.gmail.com> <SN1PR21MB0096D7426A4E230E284F0D058C560@SN1PR21MB0096.namprd21.prod.outlook.com> <CACdeXiKuzNh0fP9b-jEF82m-6mX+i04To96GMa_tFNcuznGn+A@mail.gmail.com> <DM2PR21MB00914BA07BA984E931B88FEB8C290@DM2PR21MB0091.namprd21.prod.outlook.com> <CACdeXiKQjaoAArLBcjRj+kUJUqH+f1bA5yeCCiQ6GMXzWJURBw@mail.gmail.com> <CABkgnnV0+vumfkZAMRZ_8q5pTkwf_CqhZ+deeVWdbF9SFaHoJw@mail.gmail.com> <DM2PR21MB0091DE5B213D2363FAF353CF8C280@DM2PR21MB0091.namprd21.prod.outlook.com> <CACdeXiKweRaZEKi4kqmPfUc2JLyZLGbp8tFRpkTfmJisPCMWRg@mail.gmail.com> <CACdeXiL6riBRb1-UDhVK-R5CvopzisJnYTRjWsvpimWA2G3DhQ@mail.gmail.com> <CABcZeBN2RhBsyj8_1F6bBnw9j10qdABwdZVdgwVcUr4Tf6sLtA@mail.gmail.com> <CACdeXiLZQSMxSqTPSHVqUwZomUpaMadUNYEEzF2to9Rx6nLMWQ@mail.gmail.com> <CABcZeBPvxX-8PuoV1oV-k5BnH3sjbWuuHfeAfh7FRhgtuVPkCQ@mail.gmail.com> <CACdeXi+rbsKf7zbpe4n49BUmj1ay0GSg_A48ZrAztKPY9+Fm2A@mail.gmail.com>
From: Eric Rescorla <ekr@rtfm.com>
Date: Mon, 20 Mar 2017 17:37:43 -0700
Message-ID: <CABcZeBNxvTS7sBTOLySoJt_RWv4_B6FKpR2yG7we8LuG8e84rg@mail.gmail.com>
To: Nick Harper <nharper@google.com>
Cc: Andrei Popov <Andrei.Popov@microsoft.com>, IETF Tokbind WG <unbearable@ietf.org>, Martin Thomson <martin.thomson@gmail.com>
Content-Type: multipart/alternative; boundary="001a113e88fa929980054b32dc36"
Archived-At: <https://mailarchive.ietf.org/arch/msg/unbearable/CtLDPBh7sgmUS6Wbn6UfKymOlyI>
Subject: Re: [Unbearable] 0-RTT Token Binding: When to switch exporters?
X-BeenThere: unbearable@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: "\"This list is for discussion of proposals for doing better than bearer tokens \(e.g. HTTP cookies, OAuth tokens etc.\) for web applications. The specific goal is chartering a WG focused on preventing security token export and replay attacks.\"" <unbearable.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/unbearable>, <mailto:unbearable-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/unbearable/>
List-Post: <mailto:unbearable@ietf.org>
List-Help: <mailto:unbearable-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/unbearable>, <mailto:unbearable-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 21 Mar 2017 00:38:28 -0000

On Mon, Mar 20, 2017 at 4:32 PM, Nick Harper <nharper@google.com> wrote:

> On Mon, Mar 20, 2017 at 4:12 PM, Eric Rescorla <ekr@rtfm.com> wrote:
> >
> >
> > On Mon, Mar 20, 2017 at 12:18 PM, Nick Harper <nharper@google.com>
> wrote:
> >>
> >> On Mon, Mar 20, 2017 at 9:56 AM, Eric Rescorla <ekr@rtfm.com> wrote:
> >> > I'm not quite sure I understand the reasoning here, so let me try to
> >> > walk
> >> > through it.
> >> >
> >> > The HTTP stack tells the TLS stack to initiate a connection and starts
> >> > streaming
> >> > requests down to the TLS stack. At this point, it can only use the
> 0-RTT
> >> > exporter,
> >> > so it has to do that. At some point in this process, the client
> receives
> >> > the
> >> > 1-RTT
> >> > Finished and can then switch to the 1-RTT exporter, but the serves has
> >> > no
> >> > way
> >> > of knowing at which point that is.
> >>
> >> As the client's HTTP stack is streaming requests down to the TLS stack
> >> (expecting that they be sent as 0-RTT data), a few things could
> >> happen:
> >> - The TLS stack could have received the server's Finished, so the TLS
> >> stack decides to finish the handshake and send all future data
> >> streamed from the HTTP stack post-handshake. If the HTTP stack starts
> >> preparing the request just before the TLS stack receives the server's
> >> Finished, the HTTP stack will generate a Token-Binding header using
> >> the 0-RTT exporter, and then stream it to the TLS stack which sends it
> >> post-handshake. We could try to assume that the TLS stack will fail
> >> any requests to stream data once the handshake is complete and require
> >> the HTTP stack to call a different function to send non-0-RTT data.
> >> However, this runs into another problem.
> >> - The TLS stack can choose how to fragment messages. When the HTTP
> >> stack streams a request (which contains a Token-Binding header) to be
> >> sent over 0-RTT, the TLS stack could fragment the HTTP request in a
> >> way that splits the Token-Binding header between TLS records, and puts
> >> half of it in 0-RTT data and the other half in post-handshake
> >> application data. (Or, if the "stream early data" function call
> >> returns an error if the HTTP stack tries to send 0-RTT data after the
> >> handshake is complete, the HTTP stack is now stuck with half of a
> >> request sent and a field it needs to change but has already sent half
> >> of.)
> >> - This split of a Token-Binding header across 0-RTT and non-0-RTT data
> >> could also be caused by the TLS stack hitting the max early data size
> >> required by the server.
> >> - In QUIC, even if the HTTP/QUIC/TLS stack provides some way to
> >> guarantee that an HTTP request will end up entirely in 0-RTT data, a
> >> packet containing part of the Token-Binding header could get lost
> >> until after the TLS handshake is complete, at which point QUIC will
> >> retransmit it under the new keys. Given this possibility of
> >> retransmission, how is the server to know which exporter to enforce
> >> use of?
> >
> >
> > I feel like this text argues for why you need to have a "which exporter
> was
> > used"
> > flag, right?
>
> This is more an argument for allowing the client to continue using the
> early_exporter_secret for a short time after exchanging Finished
> messages. But if the protocol has any point where the client might be
> able to use multiple exporters, then it's probably a good idea to have
> the "which exporter was used" flag.
> >
> >
> >
> >> > In the current rule, the client MUST switch when it sees app data from
> >> > the
> >> > server,
> >>
> >> I assume you're referring to paragraph two of section 2.1.1 of
> >> draft-ietf-tokbind-tls13-0rtt-01? Now that I re-read that, it does not
> >> convey what I meant it to mean. I think what I meant to say is that
> >> after a client receives an application-layer response from the server,
> >> it must use the exporter_secret for all future token bindings in
> >> application messages that are in response to the received
> >> application-layer message from the server.
> >
> >
> > Do we really want to allow inversions? E.g., I send request A with the
> 1-RTT
> > token binding and request B afterwards w the 0-RTT token binding? Becase
> > this text would allow this.
>
> Probably not. If we can't guarantee that the order in which a client
> starts building HTTP requests matches the order they're sent on the
> wire, then there's not an obvious way for the server to enforce that
> requirement.
> >
> >
> >> Essentially, the problem I'm trying to work around is that there is a
> >> non-zero amount of time between the HTTP stack building a request
> >> (specifically, the part of that where it builds the Token-Binding
> >> header) and the HTTP stack sending that request to the TLS stack. (If
> >> the HTTP stack is streaming the request to the TLS stack as the
> >> request is being generated, this end time is when the last byte of the
> >> HTTP request hits the TLS stack.) During this time, the TLS handshake
> >> could have completed. If a client starts building an HTTP request
> >> after it has seen application data from the server, then we can
> >> guarantee that the client will be able to use the 1-RTT exporter.
> >> However, the client could start building an HTTP request before it has
> >> seen application data (and before the TLS stack has seen a Finished
> >> message from the server), but send that after the client's TLS stack
> >> sends its Finished message. This is the case that I want to allow.
> >
> >
> > This does seem reasonable. Note that it's not directly observable by the
> > server when you do this one way or the other. Let me think if there's a
> > way to write this that relies less on request/response semantics.
> >
> > Perhaps:
> > Any HTTP requests which the client initiates after sending its Finished
> > MUST...?
> >
> > -Ekr
> >
> Something like that could work. A client initiating a request could
> mean putting it on the wire, or starting to build the request, and I'd
> like some clarity that it's the latter.
>
> How's this:
> All HTTP requests which the client starts processing to send after the
> client sends its Finished message MUST use the exporter_secret for
> their token bindings.
>

This LGTM.

-Ekr