Re: [TLS] close_notify and TLS 1.3

David Benjamin <davidben@chromium.org> Mon, 13 November 2017 13:38 UTC

Return-Path: <davidben@google.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 5BC2C1296D2 for <tls@ietfa.amsl.com>; Mon, 13 Nov 2017 05:38:06 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.998
X-Spam-Level:
X-Spam-Status: No, score=-1.998 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=chromium.org
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 jOzILgAh0rSJ for <tls@ietfa.amsl.com>; Mon, 13 Nov 2017 05:38:03 -0800 (PST)
Received: from mail-qt0-x232.google.com (mail-qt0-x232.google.com [IPv6:2607:f8b0:400d:c0d::232]) (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 E3C44129584 for <tls@ietf.org>; Mon, 13 Nov 2017 05:38:02 -0800 (PST)
Received: by mail-qt0-x232.google.com with SMTP id v41so19462667qtv.12 for <tls@ietf.org>; Mon, 13 Nov 2017 05:38:02 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0WMI/FyifQAB7AW8EVpX+jQOqOrysCdrALyRRcpiX4Y=; b=aNLvYHvj3qDm981atUKtvdED58+pQZsO4XCkaEJ3y3y8vVHVXviHfPdT+GQcOkNKio fkJWY1geKvfOFPCGZtyy2XUSmGtfoH9acWkRK2Fpsp9j4L9PuoeA2ldbTsYAvnmN2Ilf 9DifW9TftCGNSUuCCqTrshiRC8gGZbGmVdCS0=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0WMI/FyifQAB7AW8EVpX+jQOqOrysCdrALyRRcpiX4Y=; b=hXdT4oWu/4CH+LLm2OhNf9H3ACjSyKSbPO3IbPzQ5orob2h0pQ2utpuamRhMFcgSWb 61ejOuvC+LeYPZSDnytRBMRY9cARHTfD1TJ+Rnr9kgzIZicoPiB++640YzvsKleIIgnb VvUqDfsZLRvO3cC8z7pYZWTyfHl2aJHn5/0i6MbJRA0u7y5Fl0T010Hv/rhklouw53Nc OEqRpL3bE/RTZk+Fny3mflgzeoZaSqHyt/wpw4O+DuPYJzMCi1EdMazE1FLDS11PQecX l5qVlOImxh7QV4YsZ6klwb6XuWtULi9rs78ob2lFa3S4YRBb3Z6VQGbbMscprXN466uO vBfQ==
X-Gm-Message-State: AJaThX5f240zaD1KP/VXOwpPVRCIgB2znLCkPXNdC/tYsTdiWelugJVm lI551F8ZUGDiYjjnIlGEZrq8iigCyxMXdySxUlLW
X-Google-Smtp-Source: AGs4zMY/J2LrC5hDhGChbveHP0gd3GfGAAZF2X+FHNg6UBSgH0+UfhgS3YPI5VEH5DSW6yhZvu15TPOvd2eXGzOQgVc=
X-Received: by 10.237.34.151 with SMTP id p23mr922264qtc.194.1510580281908; Mon, 13 Nov 2017 05:38:01 -0800 (PST)
MIME-Version: 1.0
References: <A6C599ED-3F3D-462F-9B39-1FEF6A0B549B@apple.com> <3025542.QI1GADQRnG@pintsize.usersys.redhat.com> <CABcZeBPczGOafQk-hokrxALWUwWAaegDoK_Ed+wcvxx9Jor5vw@mail.gmail.com>
In-Reply-To: <CABcZeBPczGOafQk-hokrxALWUwWAaegDoK_Ed+wcvxx9Jor5vw@mail.gmail.com>
From: David Benjamin <davidben@chromium.org>
Date: Mon, 13 Nov 2017 13:37:49 +0000
Message-ID: <CAF8qwaAM9auHrVvsgkU8-3aonfB_bttPgKqd9bTWuXwAV1M+pQ@mail.gmail.com>
To: Eric Rescorla <ekr@rtfm.com>
Cc: Hubert Kario <hkario@redhat.com>, "tls@ietf.org" <tls@ietf.org>
Content-Type: multipart/alternative; boundary="001a113c721c1c1b11055ddd618c"
Archived-At: <https://mailarchive.ietf.org/arch/msg/tls/tBjF5VSkAv0xEVn70NpFxDVm1go>
Subject: Re: [TLS] close_notify and TLS 1.3
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: Mon, 13 Nov 2017 13:38:06 -0000

On Mon, Nov 13, 2017 at 8:25 PM Eric Rescorla <ekr@rtfm.com> wrote:

> On Mon, Nov 13, 2017 at 11:37 AM, Hubert Kario <hkario@redhat.com> wrote:
>
>> On Saturday, 11 November 2017 10:21:11 CET David Schinazi wrote:
>> > Hello all,
>> >
>> > Currently TLS 1.3 specifies close_notify in the same way that TLS 1.2
>> did.
>> > I believe that has issues and this might be the right time to fix them.
>> > The purpose of close_notify is to protect against data truncation
>> attacks,
>> > each side is required to send close_notify before closing the write
>> side of
>> > the transport connection so the other side knows that the data was not
>> > truncated. As such, close_notify only needs half-close semantics to
>> prevent
>> > truncation.
>> >
>> > However, the specification contains the following text:
>> > << Each party MUST send a “close_notify” alert before closing the write
>> side
>> > of the connection, unless some other fatal alert has been transmitted.
>> The
>> > other party MUST respond with a “close_notify” alert of its own and
>> close
>> > down the connection immediately, discarding any pending writes. >>
>> >
>> > This means that an application-layer client can't send a query then
>> close
>> > their write transport when they know that they're done, because the
>> server
>> > would terminate the TLS session before sending the reply. On top of
>> this,
>> > when the server receives the close_notify, it may have already sent
>> part of
>> > the reply (or wrote it to the socket send buffer) so the responding
>> > close_notify would in effect be inflicting a truncation attack on the
>> > client.
>> >
>> > This doesn't make much difference for HTTP because clients already
>> > don't close their write transport after sending a reply, however having
>> the
>> > option do do this could allow innovation in new protocols that can
>> define
>> > the semantics of when they use close_notify. An example is DNS PUSH:
>> > https://tools.ietf.org/html/draft-ietf-dnssd-push
>> > <https://tools.ietf.org/html/draft-ietf-dnssd-push>
>> >
>> > A proposal to solve this problem would be to give close_notify
>> half-close
>> > semantics: we keep the requirements that a close_notify be sent before
>> > closing the transport, and that any data received after a close_notify
>> is
>> > ignored, but we simply remove the requirement to immediately reply
>> > with a close_notify. This has the advantage that current implementations
>> > are already compliant but future ones can leverage this improvement.
>> >
>> > What do you think? Is this worth discussing on Thursday?
>>
>> what about alerts?
>
>
>> if you half-closed the connection for write and then received key-update,
>
>
> I assume you mean with update_requested set. in any case, you do nothing:
>
> If the request_update field is set to "update_requested" then the receiver
> MUST
> send a KeyUpdate of its own with request_update set to
> "update_not_requested" prior
> to sending its next application data record.
>
>
>
>> or
>> message with an invalid tag, how are you supposed to react to it?
>>
>
> I think it would be fine to either silently tear down the connection or to
> send an alert.
>

The latter seems better to me. The peer isn't going to parse it anyway,
since it was preceded by a closure alert, and it keeps the invariant that
one does not send anything after a closure alert.

But this problem isn't caused by this proposal and exists regardless. The
proposal is about whether the party which closes *second* must *send* a
close_notify after *receiving* one. This problem is if the party which
closes *first* *receives* garbage after *sending* a close_notify and
waiting for the corresponding one. That case is unavoidable so long as
waiting for the peer's close_notify after sending one is a supported
operation. The peer may send garbage.

David