Re: [TLS] Encrypting record headers: practical for TLS 1.3 after all?

Jacob Appelbaum <jacob@appelbaum.net> Mon, 30 November 2015 12:26 UTC

Return-Path: <jacob@appelbaum.net>
X-Original-To: tls@ietfa.amsl.com
Delivered-To: tls@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id A8C841A00A0 for <tls@ietfa.amsl.com>; Mon, 30 Nov 2015 04:26:11 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 1.422
X-Spam-Level: *
X-Spam-Status: No, score=1.422 tagged_above=-999 required=5 tests=[BAYES_50=0.8, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FM_FORGED_GMAIL=0.622] autolearn=no
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 hlMYRWu37kFj for <tls@ietfa.amsl.com>; Mon, 30 Nov 2015 04:26:10 -0800 (PST)
Received: from mail-wm0-x230.google.com (mail-wm0-x230.google.com [IPv6:2a00:1450:400c:c09::230]) (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 7EE571A008A for <tls@ietf.org>; Mon, 30 Nov 2015 04:26:09 -0800 (PST)
Received: by wmww144 with SMTP id w144so127051122wmw.1 for <tls@ietf.org>; Mon, 30 Nov 2015 04:26:08 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=appelbaum-net.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ffa/2pQg2aEkvrAgxdK+BSwmQZJDqTpT7xIPcm+6hLg=; b=T6aYYm9dIj9JxfW5B5LIJI8lDTP0zCsigpCQ42QquGYSx6/XRbsHRm6Dlk9lv+0qL4 VnP/+Wo8To3qJQPhDVG7/e4gLVlLDw1ay1Mq2npUEhLW/bynJwrCK6TrX4tv+4MfqQNw GDNXAucWglVSJGsyT5kUEVjz7fl0nWMglsQpDy/bQCkA9w0qM3vu5trtxyQNam9vtdJz OO2MF10SNG6g0E2qRA0dKFjiH4MVW6osB8LUxAcVn7WlCfgYioolasxqaGDfQ15YwGUT GtGmpeX1bwBpWgwaTOODyCi7fKvNe0cc6nXSgLBoo/wQK8KQ4Qp+Sf57YaT54xhl56Mx CMcA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=ffa/2pQg2aEkvrAgxdK+BSwmQZJDqTpT7xIPcm+6hLg=; b=QMboyxTN9nBPoSlHHUpXB7/O3ZWyqjlxqOmppiHgWNy1OoPw037kCfLd6vyxrj0P07 PwmdyfmkzHY0ybAeMPNZTLE8tp8k1bzQCj5eiBL4M5ISsSkF0ytXXVR7+RLPbxeapdMR sdiY52ssGIvZEWJI38tFO7WU1sByQ77P2++YFggFpHFoJCddBInL659Qeh7O9r+q1GRI immSLNPvPmsAGoo7ZvViI7DoosDZvfhgjRnP73b1dRy559ArKJm5Ev+LeZtGF79VeMDJ 7gWkJo5jDLp7QD2MXhtVEAzECETdOVuOF+wHJw5aq03tevHMIyBfbw9cYYhNaA8r3jV8 YHXQ==
X-Gm-Message-State: ALoCoQkWK16Vbz5vSofgxPzhTqh17SHZxXJunMxsesqA77dbT2TsIA7ruAn0elpg8EpquBKZnqLD
MIME-Version: 1.0
X-Received: by 10.28.172.129 with SMTP id v123mr27429682wme.47.1448886367980; Mon, 30 Nov 2015 04:26:07 -0800 (PST)
Received: by 10.28.173.80 with HTTP; Mon, 30 Nov 2015 04:26:07 -0800 (PST)
X-Originating-IP: [193.90.12.89]
In-Reply-To: <565C21EF.1060600@gmail.com>
References: <56586A2F.1070703@gmail.com> <565882FE.80205@streamsec.se> <565AC9D1.700@gmail.com> <565AE180.70101@streamsec.se> <565AEB5A.9000503@gmail.com> <CAH9QtQEK0NjPMD7cV=xEGjRc5UbKGu2FeTHQXF7kxFg+pTLW3A@mail.gmail.com> <565C21EF.1060600@gmail.com>
Date: Mon, 30 Nov 2015 12:26:07 +0000
Message-ID: <CAFggDF3LyD=XMS-99oH4CgP2A-rM-_=GOURaCMR_fBKEE+Y1Wg@mail.gmail.com>
From: Jacob Appelbaum <jacob@appelbaum.net>
To: Bryan A Ford <brynosaurus@gmail.com>
Content-Type: text/plain; charset="UTF-8"
Archived-At: <http://mailarchive.ietf.org/arch/msg/tls/bTHmS01SiqbClSvvSya8ZOZ0yvc>
Cc: "tls@ietf.org" <tls@ietf.org>
Subject: Re: [TLS] Encrypting record headers: practical for TLS 1.3 after all?
X-BeenThere: tls@ietf.org
X-Mailman-Version: 2.1.15
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, 30 Nov 2015 12:26:11 -0000

Dear Bryan,

On 11/30/15, Bryan A Ford <brynosaurus@gmail.com> wrote:
> Thanks Bill for the feedback.
>
> On 11/29/15 6:11 PM, Bill Cox wrote:
>> Thanks for the detailed description of why we might want to obfuscate
>> TLS record lengths.  From a security point of view, the only potential
>> attack vector this might create is that the attacker will know in many
>> cases the plain text of the first 5 bytes.  A weakness in the stream
>> cipher might be more easily exploited in this case.  IIUC, we feel
>> pretty good about the latest AEAD ciphers, and guessing the clear text
>> of many bytes in the record already is not too hard.  Is that right?
>> So, from my fairly uninformed point of view, this seems like a
>> reasonable upgrade.
>
> Just a nitpicky semantic correction: my proposal doesn't "create" the
> attack vector you describe (that the attacker will know the plaintext of
> the 5-byte header).  That weakness is already there in TLS 1.3 as
> currently specified, because the TLS header is unencrypted so the
> attacker will *definitely* know the 5-byte header. :)  This is merely an
> existing weakness that is not fixed by my proposal.

That is my read as well. I think your proposal sounds pretty interesting.

>> I have one concern.  These same boxes that hide record lengths by
>> merging and breaking up packets arbitrarily likely would deliver the
>> packets not well aligned to record boundaries.  Is this already the
>> case?
>
> It's already the case that middleboxes of various kinds re-segment
> (merge and break up along different boundaries) TCP streams for various
> reasons, often as an unintentional side-effect of interposing on the
> stream by "accepting" the TCP connection (pretending to be an endpoint)
> on one of the middlebox's interfaces and opening a new outgoing
> connection on the other interface, and just forwarding the traffic
> between them. In fact, Performance Enhancing Proxies (PEPs) are one
> class of middlebox that often do this intentionally, so they can get
> better control over and fiddle with the way congestion control works
> over "troublesome" types of links like high-bandwidth-delay-product
> (e.g., satellite) links.
>
>> If these boxes currently inspect packets when breaking them up to
>> split packets along record boundaries, encrypting the lengths will
>> defeat this efficiency hack.  We might cause an increase in network
>> latency in this case.  Do any of the routers out there currently use the
>> record length field when splitting up packets?
>
> If I understand your question correctly, you're asking if encrypting TLS
> record lengths might break middleboxes that currently want to track TLS
> records for some reason, e.g., perhaps to re-segment the TCP stream to
> correspond to TLS records (which might "fix" or "revert" the effect of
> another middlebox in the path that re-segments TCP in a TLS-oblivious
> fashion).  I don't know of any middleboxes that do precisely this, but
> it's not inconceivable that they could exist.

Why would that concern anyone other than to help an attacker?

If my ISP requires me to use such a box, I should use it as a proxy or
configure it manually. If they use it on me without my consent, it is
an attack. I want TLS to break and to do so in a way that fails
closed. If another ISP, backbone ISP, or XKeyscore would have a harder
job, I fail to see why we should care at all.

They're the adversary, we should not give them anything. We should
make their job as difficult as possible technically as well as in most
other ways as well. I have no sympathy for the
what-about-poor-NSAT&T's-big-networks of the world.

> More generally, since basically all manner of evil/broken middleboxes do
> exist, it's entirely possible that most any change to TLS's wire
> encoding *could* disagree with some middleboxes.  That's not specific to
> the change I'm proposing; any wire-visible change could trigger unknown
> middlebox badness.  The only solution to this I'm aware of is empirical:
> try the change, deploy it experimentally at first, and see what the pain
> level is, i.e., see if we find any middleboxes that complain and if so
> how prevalent they are.  But since TLS 1.3 is already changing a lot of
> other prominently wire-visible stuff with respect to prior versions of
> TLS that might equally well break middleboxes, it's not clear that my
> proposed change in particular is more likely to cause pain than any of
> the other changes already made, and in general I don't think we should
> let a few broken/evil middleboxes prevent meaningful evolution of the
> TLS protocol.
>

Agreed entirely. TLS should also be able to be composed with anonymity
networks in a way that we solve complementary problems, as you've
said. The less a hostile Tor exit can learn about a person's TLS 1.3
flow, the better. One could even imagine a key setup over one Tor
circuit and then a seemingly unrelated connection using the negotiated
key over another Tor circuit.

In an ideal world, we'd have two basic phases...

setup/keyex/etc:
  which is distinguishable

transfer of data/tear down:
  which if done correctly, should almost all look the same unless we
have a full network view with reassembly.

It would be nice if the biggest problem for traffic analysis was then
TCP/IP related, though we're far from that point with TLS 1.3 or any
other general purpose protocol.

It is true that to beat traffic analysis, we need to tackle that
problem directly and I very much agree with you that we still should
make these positive changes. Your suggested changes will also assist
others who are dealing with those problems directly.

All the best,
Jacob