Re: [TLS] Kill Finished (and other tricks for hardware)

Henrick Hellström <henrick@streamsec.se> Sun, 20 April 2014 08:47 UTC

Return-Path: <henrick@streamsec.se>
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 A6BD81A004A for <tls@ietfa.amsl.com>; Sun, 20 Apr 2014 01:47:39 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 0.649
X-Spam-Level:
X-Spam-Status: No, score=0.649 tagged_above=-999 required=5 tests=[BAYES_20=-0.001, HELO_EQ_SE=0.35, MIME_8BIT_HEADER=0.3] 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 N_eBacayPu5q for <tls@ietfa.amsl.com>; Sun, 20 Apr 2014 01:47:35 -0700 (PDT)
Received: from vsp4.ballou.se (vsp4.ballou.se [91.189.40.102]) by ietfa.amsl.com (Postfix) with SMTP id 4FBDF1A0045 for <tls@ietf.org>; Sun, 20 Apr 2014 01:47:34 -0700 (PDT)
Received: from nmail1.ballou.se (unknown [10.0.0.116]) by vsp4.ballou.se (Halon Mail Gateway) with ESMTP; Sun, 20 Apr 2014 10:44:23 +0200 (CEST)
Received: from [192.168.0.195] (c-a2c1e555.06-134-73746f39.cust.bredbandsbolaget.se [85.229.193.162]) (Authenticated sender: henrick@streamsec.se) by nmail1.ballou.se (Postfix) with ESMTPSA id C1B041DEB7; Sun, 20 Apr 2014 10:47:26 +0200 (CEST)
Message-ID: <5353899E.8070601@streamsec.se>
Date: Sun, 20 Apr 2014 10:47:26 +0200
From: Henrick Hellström <henrick@streamsec.se>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0
MIME-Version: 1.0
To: Watson Ladd <watsonbladd@gmail.com>, "<tls@ietf.org>" <tls@ietf.org>
References: <CACsn0cm7CU3HBOY-m90+HwGBuw+nZ7vyqRdHZcfDjw7wiTmDMw@mail.gmail.com> <5350BF46.7000608@pobox.com> <535141E7.2000001@streamsec.se> <CACsn0cnQ893h_9wxhVSw6Y0gXL3BoHR9LKw1LDQ8+Smz1c+E0g@mail.gmail.com>
In-Reply-To: <CACsn0cnQ893h_9wxhVSw6Y0gXL3BoHR9LKw1LDQ8+Smz1c+E0g@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"; format="flowed"
Content-Transfer-Encoding: 8bit
Archived-At: http://mailarchive.ietf.org/arch/msg/tls/mTqU-BqQJvTRQrtaZA2TfFEitYU
Subject: Re: [TLS] Kill Finished (and other tricks for hardware)
X-BeenThere: tls@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: henrick@streamsec.se
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: <http://www.ietf.org/mail-archive/web/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: Sun, 20 Apr 2014 08:47:39 -0000

On 2014-04-18 17:39, Watson Ladd wrote:
> On Fri, Apr 18, 2014 at 8:16 AM, Henrick Hellström <henrick@streamsec.se> wrote:
>> On 2014-04-18 07:59, Michael D'Errico wrote:
>>>
>>> This is a much weaker failure indication than checking the Finished
>>> messages, so I'd prefer to keep them.  Can you think of an alternate
>>> construction for the Finished message that doesn't use the PRF?
>>
>>
>> Indeed. The client (being the last peer of the connection to send a random
>> handshake message, and being in a position to pick the pre_master_secret)
>> will have a quadratically improved chance of picking a specific
>> master_secret

Please note that this relevant in the context of removing the Finished 
messages and including the handshake hash in the KDF step, because of 
the following questions:

   #1. How easy is it for an attacker to pick one specific master_secret 
as the output of a handshake?
   #2. How easy is it for an attacker to pick any master_secret, that 
happens to produce the correct finished messages and a partially chosen 
key block (e.g. with only one write key chosen) when the handshake hash 
is not included in the KDF step?
   #3. How easy is it for an attacker to pick any master_secret, that 
happens to produce a partially chosen key block (e.g. with only one 
write key chosen) when the handshake hash is included in the KDF step?

(I am not elaborating on exactly what kind of practical attacks would 
become possible if the attacker picks a partially correct master_secret. 
It suffice to say that it doesn't seem to be something that should be 
easy to do.)

It seems reasonable to assume that case #1 and case #2 are equivalent, 
i.e. since the PRF is invoked three times with the same key material 
(master_secret) and different labels and seeds, picking a partially 
correct master_secret is not easier than picking the exactly correct 
master_secret.

However, if the PRF is only invoked once with the master_secret as key 
material and the handshake hash as seed, it is not self-evident that 
case #3 is as hard as case #1. In particular, #3 might be significantly 
easier for some PRF algorithms than other.

Generally speaking, though, irregardless of the security properties of 
the PRF, the case of collision attacks ought to be considered.

Suppose an attacker is trying to get two different connections to have 
the same client_write_encryption key. With a 128 bit security cipher 
suite, this key will be 128 bits, and getting a collision in 128 bits 
only require an 2^64 effort, even if the PRF is completely perfect.


> Care to expand on this? For noncontributory exchanges you may be
> correct, but ECDHE is contributory.

I am comparing the chances the server has to choose the master_secret, 
to the chances the client has.
   - When the server_key_exchange is sent, the server doesn't know what 
the client will send, so the server has no better chance than random to 
pick the master_secret.
   - When the client_key_exchange is generated, the client will in 
principle be able to predict the master_secret before sending the 
client_key_exchange message.

In particular, if e.g. ECDHE-P256 is used, then presuming the TLS PRF 
preserves entropy up to at least 256 bits, the server will have on 
average a one in 2^255 chance of picking the "right" master_secret, 
because the server is gambling on what 256 bit ephemeral private key the 
client will pick. The client will however be able to pick the pre_master 
secret with a 2*2^128 effort (based solely on the DLP strength of EC-P256).

Now, for the same reason, if someone proposes a cipher suite that 
significantly weakens the PRF/KDF (e.g. by basing it solely on AES 
without ensuring the function is one way), eliminating the finished 
messages will potentially enable a man-in-the-middle to have 
significantly better chance than 1 on 2^256 to pick a master secret that 
is "almost" right and at least results in a chosen client_write_key.