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

Eric Rescorla <ekr@rtfm.com> Fri, 11 August 2017 19:19 UTC

Return-Path: <ekr@rtfm.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 14FC91323C8 for <tls@ietfa.amsl.com>; Fri, 11 Aug 2017 12:19:50 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.61
X-Spam-Level:
X-Spam-Status: No, score=-0.61 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, HTTPS_HTTP_MISMATCH=1.989, 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=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 xovefu9rvMY7 for <tls@ietfa.amsl.com>; Fri, 11 Aug 2017 12:19:47 -0700 (PDT)
Received: from mail-yw0-x236.google.com (mail-yw0-x236.google.com [IPv6:2607:f8b0:4002:c05::236]) (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 8E55A1323A4 for <tls@ietf.org>; Fri, 11 Aug 2017 12:19:47 -0700 (PDT)
Received: by mail-yw0-x236.google.com with SMTP id s143so27869888ywg.1 for <tls@ietf.org>; Fri, 11 Aug 2017 12:19:47 -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=6kcwH5rPal0rQ5fW+JdUVkSc1q5K1fYWlbqgECMoUSU=; b=TKWBgsyM2dgp4agQBB/Kio9GZC3XGV1W8qoasRJEWxIsQrFj4VYrrfEUcZEmt4Or4E D0gKUjp5kLulgMfEfV8SFfYzV6hH3DA1kZNCSxpZKz4bIwY/LvYYJGvrRdTC47bajJ2v UtCZ1BsZZVTycXzxAn2DTEKAHo3OM/M2r3jkMy6tqJFrACWrCxVkjV5V859if2MFIb/v iWUJPSileWl/oyL/385oPgN9TPPQGTHpkwL4RN3yj+65O6Q1N0DPOaDWDTvvP2wSwLen UhrXu9ecHfyGjR4tn8YHE7S9e5k8hDW52mQpfpD2BpyaTcDsbwaopuybT7rrtUACDxp2 DCVw==
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=6kcwH5rPal0rQ5fW+JdUVkSc1q5K1fYWlbqgECMoUSU=; b=twCSRZm2uEkRD4OFUFk8PKvHG2vZmsX2R1GeZ2ivNwzjmPQR364jZjSJfVu6I5s0AS dRm+h5qkYCfFAThKudT0QaSiA6XHsm2KJQgOxk5ZYwkSBVg6s5zojLNlyq1XGK/+ROHT dVN4NIOULVwAH1e9KP50aQpJ3D+xtdznTy3xRGTEjHu7x4t7L3rAMewvUaleuwJz7nNy RrgfuUyUJ9ax8vKe2oNaSQ9y8MwJoLmgvN8IEiZft0bCYuFp4j4vddQB+tuDsEd5ChBz jb0oc4z/09EwfH+wuzscYwDjESYsh1OOwz6JeoDVerz7k+VEgzAEB6eAZJK93s2izN6G N8oQ==
X-Gm-Message-State: AHYfb5h69pA+bjHRcTRm6HXAT6fuevl0EDJojJtF1bHaWBGGlShf8G0M AjHXDlwDuDDLfUPfNMExk3KpatlNV6gD
X-Received: by 10.37.181.25 with SMTP id p25mr12762096ybj.249.1502479186798; Fri, 11 Aug 2017 12:19:46 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.13.218.130 with HTTP; Fri, 11 Aug 2017 12:19:06 -0700 (PDT)
In-Reply-To: <14329E27-DBCC-4A6F-BB4C-7CFAFD7ADF53@akamai.com>
References: <1502460670.3202.8.camel@redhat.com> <CABcZeBOmFTrCEmV20XZe9hO5owdv1SsWaWkZHhQFfpNmfou4VQ@mail.gmail.com> <CADh2w8Trp-7WiVCDzQ6OLiHqE_Fw530bp0gZeRKCJiaGkLfb3w@mail.gmail.com> <CABcZeBNpJ5_03VZot_3hj7KHnJ8609HX-MY62n0+HLXoRg-+=Q@mail.gmail.com> <14329E27-DBCC-4A6F-BB4C-7CFAFD7ADF53@akamai.com>
From: Eric Rescorla <ekr@rtfm.com>
Date: Fri, 11 Aug 2017 12:19:06 -0700
Message-ID: <CABcZeBN7KOZW+nUZcUbvv7pOFFqreQuTiAdBqJ1btoUQ52eC5g@mail.gmail.com>
To: "Short, Todd" <tshort@akamai.com>
Cc: Nikos Mavrogiannopoulos <nmav@redhat.com>, "tls@ietf.org" <tls@ietf.org>
Content-Type: multipart/alternative; boundary="f403045e6ed0367b0b05567f32c8"
Archived-At: <https://mailarchive.ietf.org/arch/msg/tls/a4Lxw97VqrmJ76S5uZFHOf2RKzo>
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: Fri, 11 Aug 2017 19:19:50 -0000

On Fri, Aug 11, 2017 at 11:32 AM, Short, Todd <tshort@akamai.com> wrote:

> If the plaintext length indicates a message type, then this could lead to
> the issue the original query posted. In that an observer might know what
> message type was passed. TLS padding is supposed to prevent this (but it
> doesn’t necessarily).
>
> However, I argue that having TLS do significant padding for a protocol is
> bad design for that protocol. It’s one thing if it’s a few padding bytes,
> but the example given was 1023 bytes of padding.
>
> Also as pointed out by Andrei Popov, the application needs to tell TLS how
> much padding to apply, so either way, the application has to deal with
> determining the padding length. Why not just make it part of the protocol
> in the first place?
>

The consensus was to provide a generic scheme that applications could use,
or not.

-Ekr


>
> OpenSSL has a callback scheme, and a block-based scheme for determining
> the amount of padding. Either way, the application is involved.
>
> But my final point is that we are ignoring the amount of non-TLS
> processing that must be done on various message types (before the response
> is sent), and THAT might be even more of a giveaway than the minuscule
> timing difference due to counting padding in TLS.
>
> --
> -Todd Short
> // tshort@akamai.com
> // "One if by land, two if by sea, three if by the Internet."
>
> On Aug 11, 2017, at 1:20 PM, Eric Rescorla <ekr@rtfm.com> wrote:
>
>
>
> On Fri, Aug 11, 2017 at 9:47 AM, Nikos Mavrogiannopoulos <nmav@redhat.com>
>  wrote:
>
>> On Fri, Aug 11, 2017 at 5:57 PM, Eric Rescorla <ekr@rtfm.com> wrote:
>>
>>>
>>> On Fri, Aug 11, 2017 at 7:11 AM, Nikos Mavrogiannopoulos <nmav@
>>> redhat.com> wrote:
>>>
>>>> Imagine the following scenario, where the server and client have this
>>>> repeated communication N times per day:
>>>>
>>>> client     server
>>>>     --X-->
>>>>     <--Y--
>>>>
>>>>
>>>> the client puts in X a message A of 1 byte or B of 1024 bytes, and pads
>>>> it to the maximum size of TLS record. The server replies with the
>>>> message "ok" (same every time), padded to the maximum size just after
>>>> it reads X.
>>>>
>>>> However, TLS 1.3 detects the message size by iterating through all the
>>>> padding bytes, and thus there is a timing leak observed by the time
>>>> difference between receiving X and sending Y. Thus as an adversary I
>>>> could take enough measurements and be able to distinguish between X
>>>> having the value A or B.
>>>>
>>>> While I'd expect these iterations to be unmeasurable in desktop or
>>>> server hardware, I am not sure about the situation in low-end IoT
>>>> hardware. Is the design choice for having the padding removal depending
>>>> on padding length intentional?
>>>
>>>
>>> Yes, we're aware of this, and it's an intentional design choice. The
>>> reasoning
>>> was that once you have the padding removed, you'll need to operate
>>> on/copy
>>> the unpadded content somewhere, and that's timing dependent anyway.
>>>
>>
>> That is certainly an incorrect assumption. gnutls for example provides a
>> zero-copy API, and I guess it is not the only implementation to have that.
>>
>
> And then the next thing that will happen is that the application will read
> the data, which is length-dependent. The problem is that the plaintext is
> variable length.
>
>
> There is mentioning of possible timing channels in:
>>>> https://tools.ietf.org/html/draft-ietf-tls-tls13-21#appendix-E.3
>>>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__tools.ietf.org_html_draft-2Dietf-2Dtls-2Dtls13-2D21-23appendix-2DE.3&d=DwMFaQ&c=96ZbZZcaMF4w0F4jpN6LZg&r=QBEcQsqoUDdk1Q26CzlzNPPUkKYWIh1LYsiHAwmtRik&m=XJYxN2Gf0rNXPl3yadis8utHDuyRetUCeYdF-OmwAcQ&s=CJUfP5OPl4Uy3Igpm9hvAvuLiJlWdRLxSnagqfNZEZM&e=>
>>>> However I don't quite understand how is this section intended to be
>>>> read. The sentence for example: "Because the padding is encrypted
>>>> alongside the actual content, an attacker cannot directly determine the
>>>> length of the padding, but may be able to measure it indirectly by the
>>>> use of timing channels exposed during record processing", what is its
>>>> intention? Is it to acknowledge the above timing leak?
>>>>
>>>
>>> Yes.
>>>
>>
>> I am not sure if that text is sufficient to cover that issue. It seems as
>> if the cbc timing attack is re-introduced here and pushing the fix to
>> implementers. It may be better no to provide padding functionality with
>> this "feature", as unfortunately it will be used by applications.
>>
>
> I don't believe that this is analysis is correct. This timing channel only
> applies to the data after message integrity has been established (i.e.,
> after AEAD processing), which is different from the situation in Lucky 13.
> It seems like what leaks here is the length of the plaintext, which is also
> what would be leaked if we simply did not have padding.
>
> -Ekr
>
>
>> regards,
>> Nikos
>>
>>
> _______________________________________________
> TLS mailing list
> TLS@ietf.org
> https://www.ietf.org/mailman/listinfo/tls
>
>
>