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

Colm MacCárthaigh <colm@allcosts.net> Tue, 15 August 2017 16:27 UTC

Return-Path: <colm@allcosts.net>
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 114F613234E for <tls@ietfa.amsl.com>; Tue, 15 Aug 2017 09:27:32 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.6
X-Spam-Level:
X-Spam-Status: No, score=-2.6 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=allcosts-net.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 WQO-JCs-sfFU for <tls@ietfa.amsl.com>; Tue, 15 Aug 2017 09:27:29 -0700 (PDT)
Received: from mail-yw0-x22c.google.com (mail-yw0-x22c.google.com [IPv6:2607:f8b0:4002:c05::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 05862132357 for <tls@ietf.org>; Tue, 15 Aug 2017 09:27:29 -0700 (PDT)
Received: by mail-yw0-x22c.google.com with SMTP id s143so7726645ywg.1 for <tls@ietf.org>; Tue, 15 Aug 2017 09:27:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=allcosts-net.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=SpxpZc9jCPwdAQyZ979ETDtz8uMHm4ZYpJWy2dhp4Nw=; b=ubn9FPRMCsiCTGNZ6e0au45hCl0xEjedNQPUTaFmN4MB6xBFAQ1DAPALBMXsi1QIDH egAg+9j/3NX12YReeZr0owMRDqw8bWTmOcMkfJIHQj5tiBHpOKJgBxpHdBAjLQjNmffD Ft782/ulzhY3JDbqYyuPFFNLadfSg0MlzL2AtgMQtn1ztKZMr+aaMyoweK4LJnN0TCy5 TipbW98zBvhYwxSL1L5iXnQosU0MWnaPs6jzBlh0ssX0jPn4AdxaaAla830ZHs44vDVl TKuS/Bx5r3p4Px+Taek5Mf/kf3zUw3yjwEBjBsUPzUT0OFKKx5JfoEzwftwFf7jRJFXj 5ISA==
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:content-transfer-encoding; bh=SpxpZc9jCPwdAQyZ979ETDtz8uMHm4ZYpJWy2dhp4Nw=; b=aJWDdTXJVphpPi3dW6mG2DjIBMzSHENfn+uEWQtsYDfZvdZ1FHIcBKb2noR1SOOHaf QnC356faBaDlA3CdJf3gNgrJSyr/crN5OHUCZjJfkgaY1rWPZzGRqh8/fflq+WH926ma r9o9gLzECEIFOrgfubngG8dzSNza5eswFfMi06NcfTMKy2ZJWiXpzyxgSdnCiTzH25XG NSf9IEE0sbmFUkSNmDpKhAOPPrAJ6RTlvmx4YOyJta652155nKLtZkszPa+P7tE3Spwu i5I2EBGdMS7jAlKQyGoemWHN0jGzGVssGFUeNHC+2jz9XUwAiN4IXuHzJ6fd4UfnMz0M 91NA==
X-Gm-Message-State: AHYfb5h8Cu0KW7+dKKMYNSqFkamqLJ9F4k3U43l0bAjG67pp+1F5Oig/ HJDHGFfJeAjcZ5TGM0jvv2WVGY44CI2s
X-Received: by 10.37.164.68 with SMTP id f62mr22250623ybi.25.1502814448032; Tue, 15 Aug 2017 09:27:28 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.129.154.71 with HTTP; Tue, 15 Aug 2017 09:27:27 -0700 (PDT)
In-Reply-To: <2019211.eGXEvq8HFX@pintsize.usersys.redhat.com>
References: <1502460670.3202.8.camel@redhat.com> <2492694.vcgQpB2T86@pintsize.usersys.redhat.com> <CAAF6GDcsRpC1m2P9v9BF6=5CRiS8eP-B7awZ_x4RoUkOc09DEQ@mail.gmail.com> <2019211.eGXEvq8HFX@pintsize.usersys.redhat.com>
From: Colm MacCárthaigh <colm@allcosts.net>
Date: Tue, 15 Aug 2017 18:27:27 +0200
Message-ID: <CAAF6GDfkaNPswhKrov_rL_3mrHSgGXGPCYX1hh_UjFDdctW2ug@mail.gmail.com>
To: Hubert Kario <hkario@redhat.com>
Cc: "tls@ietf.org" <tls@ietf.org>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/tls/py3F_rsNd1oH-B116r-qTYizbSA>
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 16:27:32 -0000

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:
>> > the difference in processing that is equal to just few clock cycles is
>> > detectable over network[1]
>>
>> The post you reference actually says the opposite; "20 CPU cycles is
>> probably too small to exploit"
>
> exactly what we though about cbc padding at the time TLS 1.1 was published...

I'm not going to defend the poor design of TLS1.1 padding, but it does
remain unexploitable over real-world networks. The Lucky13 attack that
you reference is practical against DTLS, but not TLS. It is worth
understanding the nuance, because the differences can help us continue
to make TLS more robust and hint where to optimize. The property that
has protected has TLS Vs DTLS is non-replayability, so it's important
we keep that.

>> ... 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.

>> 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.

> 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.

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.

-- 
Colm