Re: [TLS] Possible timing attack on TLS 1.3 padding mechanism

Eric Rescorla <> Thu, 01 March 2018 22:27 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 40288124BFA for <>; Thu, 1 Mar 2018 14:27:57 -0800 (PST)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: 3.102
X-Spam-Level: ***
X-Spam-Status: No, score=3.102 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, GB_SUMOF=5, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, URIBL_BLOCKED=0.001] autolearn=no autolearn_force=no
Authentication-Results: (amavisd-new); dkim=pass (2048-bit key)
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id YRv6JUv86yVF for <>; Thu, 1 Mar 2018 14:27:55 -0800 (PST)
Received: from ( [IPv6:2607:f8b0:400d:c0d::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by (Postfix) with ESMTPS id 792C41242EA for <>; Thu, 1 Mar 2018 14:27:55 -0800 (PST)
Received: by with SMTP id d26so9678055qtk.10 for <>; Thu, 01 Mar 2018 14:27:55 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=+jjYBOGWp0LT+7LFWykItI7+mSuPpf/ONq57ZmiHZYg=; b=owcpp6Ev7d7QLQ6pXoD6BX6NUlXzYCQb4nohDI2q9U/9VJwT0vwJlI4qkOEXCXz0d3 VuCHPwwJEQT39SJYUQ6+Sdk6GcsR077n6O8K/7RgNtnfOCgbAQffLpzk0P02zuT9B1gh Is42E4/HsAJfO8bXOtGpWOb3GDDCB4BhvQPtgTqBMoPsNZi17WmFt6YkBXczyXARK457 iXI/gAsdYdQ/BShIlnYgT/X8yjBcvAHDwBBwP9ktWuIkQwC2x4RWvjMVULMNF/6mZV7a Dd/o+i0xzag0XQCOgdKuZM+0msRhRTWdFpdxFGs9GPW/pKMAXQF6erhRiadmwsse2kQe UDMw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=+jjYBOGWp0LT+7LFWykItI7+mSuPpf/ONq57ZmiHZYg=; b=MjLpaI5E7DKXLp7XS5y+76GFPh61ztwdbdZj0fX4Zz5L/69Hk6jB3PiKIeqWYkjg/c GuIGiWNItuy8qeASxMQ1yL4fMAawvy99YAe2fsAY6MDTh0kF7KyplZN5sondmlCYARS1 N5P7FvHI5u+9TtHlrMgDxR7twaQe+eN7bCk+Y+I4vp3NS99K8bYyUzj6kFqU8f1umI9E GHDjEKSqIgRDcluWIS+B0/eYiLIVSRYVEn1Wg1fS0PdOI0hgxhpt3SmhHV8amCQ+Fwb7 9E2Fpw9SPWAJCzkKE8+AGqpS0U3aYRZC6oIRpae+vWfNvjXJesplDBIvSuOret+rEmIT sFhw==
X-Gm-Message-State: AElRT7GZqs5IOYpXh2zMho8eKV7jm0HUUkjVh4IgOB9pA9ijk01OMOhq S/oM5g6qrGdjHfdcAcmgWTFKoIoJAmx4OzexpVcdaMbuHNs=
X-Google-Smtp-Source: AG47ELtwdAGyXUCV0j9DQQd2ZW2fPMMdsx/zf9lSg7o2iMrayRbKMUGapgtQQV39tLIDV/d4HsSY80KhkzcXvdI1/ls=
X-Received: by with SMTP id h45mr5460277qtf.225.1519943274463; Thu, 01 Mar 2018 14:27:54 -0800 (PST)
MIME-Version: 1.0
Received: by with HTTP; Thu, 1 Mar 2018 14:27:13 -0800 (PST)
In-Reply-To: <>
References: <>
From: Eric Rescorla <>
Date: Thu, 01 Mar 2018 14:27:13 -0800
Message-ID: <>
To: "Paterson, Kenny" <>
Cc: "<>" <>
Content-Type: multipart/alternative; boundary="001a113520e0f41ef90566615e5f"
Archived-At: <>
Subject: Re: [TLS] Possible timing attack on TLS 1.3 padding mechanism
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." <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Thu, 01 Mar 2018 22:27:57 -0000

Hi Kenny,

Yes, this is something we are aware of. Here's the relevant text from the

I don't think we're likely to change the protocol, but if you have some
proposed text
that you think would be informative above and beyond what we already have,
send it along.


On Thu, Mar 1, 2018 at 1:52 PM, Paterson, Kenny <>

> Hi,
> I've been analysing the record protocol spec for TLS 1.3 a bit,
> specifically the new padding mechanism. I think there's a possible timing
> attack on a naïve implementation of de-padding. Maybe this is already known
> to people who've been paying more attention than me!
> Recall that the padding mechanism permits an arbitrary number of 00 bytes
> to be added after the plaintext and content type byte, up to the max record
> size. This data is then encrypted using whichever AEAD scheme is specified
> in the cipher suite. This padding scheme is quite important for TLS 1.3
> because the current AEAD schemes do leak the length of record plaintexts.
> There should be no padding oracle style attack possible because of the
> integrity guarantees of the AEAD schemes in use.
> The idea for the timing attack is as follows.
> The natural way to depad (after AEAD decryption) is to remove the 00 bytes
> at the end of the plaintext structure one by one, until a non-00 byte is
> encountered. This is then the content type byte. Notice that the amount of
> time needed to execute this depadding routine would be proportional to the
> number of padding bytes. If there's some kind of response record for this
> record, then measuring the time taken from reception of the target record
> to the appearance of the response record can be used to infer information
> about the amount of padding, and thereby, the true length of the plaintext
> (since the length of the padded plaintext is known from the ciphertext
> length).
> The timing differences here would be small. But they could be amplified by
> various techniques. For example, the cumulative timing difference over many
> records could allow leakage of the sum of the true plaintext lengths. Think
> of a client browser fetching a simple webpage from a browser. The page is
> split over many TLS records, each of which is individually padded, with the
> next GET request from the client being the "response record". (This is a
> pretty simplistic view of how a web browser works, I know!). The total
> timing difference might then be sufficient for webpage fingerprinting, for
> example.
> I'm not claiming this is a big issue, but maybe something worth thinking
> about and addressing in the TLS 1.3 spec.
> There's at least a couple of ways to avoid the problem:
> 1. Do constant-time depadding - by examining every byte in the plaintext
> structure even after the first non-00 byte is encountered.
> 2. Add an explicit padding length field at the end of the plaintext
> structure, and removing padding without checking its contents. (This should
> be safe because of the AEAD integrity guarantees.)
> Option 2 is probably a bit invasive at this late stage in the
> specification process. Maybe a sentence or two on option 1 could be added
> to the spec.
> Thoughts?
> Cheers,
> Kenny
> _______________________________________________
> TLS mailing list