Re: [TLS] draft-ietf-tls-tls13-21: TLS 1.3 record padding removal leaks padding size

Hubert Kario <hkario@redhat.com> Tue, 15 August 2017 17:02 UTC

Return-Path: <hkario@redhat.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 EFFEF132376 for <tls@ietfa.amsl.com>; Tue, 15 Aug 2017 10:02:19 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.901
X-Spam-Level:
X-Spam-Status: No, score=-6.901 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_PASS=-0.001] autolearn=ham autolearn_force=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 XVpJQqgC-yNr for <tls@ietfa.amsl.com>; Tue, 15 Aug 2017 10:02:18 -0700 (PDT)
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 13EE5132194 for <tls@ietf.org>; Tue, 15 Aug 2017 10:02:17 -0700 (PDT)
Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E5F3272D8F; Tue, 15 Aug 2017 17:02:16 +0000 (UTC)
DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E5F3272D8F
Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=hkario@redhat.com
Received: from pintsize.usersys.redhat.com (unknown [10.34.247.178]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 290E5516F0; Tue, 15 Aug 2017 17:02:16 +0000 (UTC)
From: Hubert Kario <hkario@redhat.com>
To: Colm MacCárthaigh <colm@allcosts.net>
Cc: "tls@ietf.org" <tls@ietf.org>
Date: Tue, 15 Aug 2017 19:02:13 +0200
Message-ID: <4822293.CXcAoRAZci@pintsize.usersys.redhat.com>
In-Reply-To: <CAAF6GDfkaNPswhKrov_rL_3mrHSgGXGPCYX1hh_UjFDdctW2ug@mail.gmail.com>
References: <1502460670.3202.8.camel@redhat.com> <2019211.eGXEvq8HFX@pintsize.usersys.redhat.com> <CAAF6GDfkaNPswhKrov_rL_3mrHSgGXGPCYX1hh_UjFDdctW2ug@mail.gmail.com>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart375709707.fL5kNvt3Ml"; micalg="pgp-sha512"; protocol="application/pgp-signature"
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 15 Aug 2017 17:02:17 +0000 (UTC)
Archived-At: <https://mailarchive.ietf.org/arch/msg/tls/1EElVSx_fV7wbt5KFYSPUQmRRgo>
Subject: Re: [TLS] draft-ietf-tls-tls13-21: TLS 1.3 record padding removal leaks padding size
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: Tue, 15 Aug 2017 17:02:20 -0000

On Tuesday, 15 August 2017 18:27:27 CEST Colm MacCárthaigh wrote:
> On Tue, Aug 15, 2017 at 1:55 PM, Hubert Kario <hkario@redhat.com> wrote:
> > On Tuesday, 15 August 2017 00:55:50 CEST Colm MacCárthaigh wrote:
> >> On Mon, Aug 14, 2017 at 8:16 PM, Hubert Kario <hkario@redhat.com> wrote:
> >> ... and even today with very low
> >> latency networks and I/O schedulers it remains very difficult to
> >> measure that kind of timing difference remotely.
> > 
> > simply not true[1], you can measure the times to arbitrary precision with
> > any real world network connection, it will just take more tries, not
> > infinite tries
> 
> Surely the Nyquist limits apply? The fundamental resolution of
> networks is finite. Clock cycles are measured in partial billionths of
> a second, but even 10Gbit/sec networks use framing (85 byte minimum)
> in a way that gives you a resolution of around 70 billionths of a
> second. Nyquist says that to measure a signal you need a sampling
> resolution twice that of the signal itself ... that's about 2 orders
> of magnitude of distance to cover in this case.

Nyquist applies to a single sample, not to multiple sampling of the same 
signal.

In other words, if I sample a signal 4 times, and once I get 0 and 3 times I 
get 1, then assuming uniform distribution[1] I can deduce that the signal is 
closer to 0.75 than it is to 1, 0 or 0.5.

 1 - yes, it's a "spherical cow in a vacuum" example

> >> But per the post, the
> >> larger point is that it is prudent to be cautious.
> > 
> > exactly, unless you can show that the difference is not measurable, under
> > all conditions, you have to assume that it is.
> > 
> >> > When you are careful on the application level (which is fairly simple
> >> > when
> >> > you just are sending acknowledgement message), the timing will still be
> >> > leaked.
> >> 
> >> There are application-level and tls-implementation-level approaches
> >> that can prevent the network timing leak. The easiest is to only write
> >> TLS records during fixed period slots.
> > 
> > sure it is, it also limits available bandwidth and it will always use that
> > amount of bandwidth, something which is not always needed
> 
> Constant-time schemes work by taking the maximum amount of time in
> every case. This fundamentally reduces the throughput; because small
> payloads don't get a speed benefit.

My point is that if I don't care about the side channel of presence or absence 
of the communication, then I am limited by the size of the maximal record, not 
amount of records I can send in a second. So my bandwidth is limited in 
"Transaction Per Second" sense, not actual bandwidth (measured in bytes per 
second)
 
> > we are not concerned if the issue can be workarouded, we want to be sure
> > that the TLS stack does not undermine application stack work towards
> > constant time behaviour
> 
> The TLS stack can take a constant amount of time to encrypt/decrypt a
> record, regardless of padding length, but it's very difficult to see
> how it can pass data to/from the application in constant time; besides
> the approach I outlined, which you don't like.

As I said in a different email, in C you pass a pointer and length, that can 
be returned in constant time quite easily (even in read(3)-like API).

encryption is indeed much harder

> Note that these problems get harder with larger amounts of padding.
> Today the lack of padding makes passive traffic analysis attacks very
> easy. It's extremely feasible for an attacker to categorize request
> and content lengths (e.g. every page on Wikipedia) and figure out what
> page is user is browsing. That's a practical attack, that definitely
> works, today, and it's probably the most practical and most serious
> attack that we do know works. The fix for that attack is padding, and
> quite large amounts are needed to defeat traffic analysis. But that
> will make the timing challenges harder. In that context: it's
> important to remember; so far those timing attacks have not been
> practical. We don't want to optimize for the wrong problem.

True, that being said, I'd prefer if we did release protocol in which we can't 
poke holes before the official release...
-- 
Regards,
Hubert Kario
Senior Quality Engineer, QE BaseOS Security team
Web: www.cz.redhat.com
Red Hat Czech s.r.o., Purkyňova 115, 612 00  Brno, Czech Republic