Re: [TLS] Verify data in the RI extension?

Michael D'Errico <mike-list@pobox.com> Sun, 29 November 2009 04:42 UTC

Return-Path: <mike-list@pobox.com>
X-Original-To: tls@core3.amsl.com
Delivered-To: tls@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id B48B83A6844 for <tls@core3.amsl.com>; Sat, 28 Nov 2009 20:42:14 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.513
X-Spam-Level:
X-Spam-Status: No, score=-2.513 tagged_above=-999 required=5 tests=[AWL=0.086, BAYES_00=-2.599]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id drpIeKZwlorK for <tls@core3.amsl.com>; Sat, 28 Nov 2009 20:42:13 -0800 (PST)
Received: from sasl.smtp.pobox.com (a-pb-sasl-quonix.pobox.com [208.72.237.25]) by core3.amsl.com (Postfix) with ESMTP id 948123A67E3 for <tls@ietf.org>; Sat, 28 Nov 2009 20:42:12 -0800 (PST)
Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 979EE83EDA for <tls@ietf.org>; Sat, 28 Nov 2009 23:42:05 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=message-id :date:from:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; s=sasl; bh=rbq6Q5XmDCIk YIw2oyLtnb8fFO4=; b=BLLRLf5bGVQY7i9FEW2pi3VI8EDXb5b9vb0rionFKzU0 8uIhLNNJllAeFnbSramiznR4/GDOFDFn52Akgnthe2ejRgXp6pIvf1zksFYw7k0x THP1nCHumQkz5/sn2P6J6KQoZPm6bFfmYuHwZsAsYfQLxngTxYtNSJJTKedpXPs=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=message-id:date :from:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; q=dns; s=sasl; b=uFbVPP bmd9fwkJaDFE0ABK85C81Tst8dGd0E2CJvpvXRSS/+1BoKkKck/Aj5/pbNq6430f GPW9dvbpz0s25v6BeDcnzZA1FzT6m2S3E/fIELxNTUyl6gpdq7S4cY4HIib96TMu CzNk5A3f74AjTwPTSvwEzjUPxj8LQ0I3uAhtU=
Received: from a-pb-sasl-quonix. (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 946BC83ED9 for <tls@ietf.org>; Sat, 28 Nov 2009 23:42:05 -0500 (EST)
Received: from administrators-macbook-pro.local (unknown [24.234.114.35]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 1F15083ED8 for <tls@ietf.org>; Sat, 28 Nov 2009 23:42:04 -0500 (EST)
Message-ID: <4B11FBF8.8080400@pobox.com>
Date: Sat, 28 Nov 2009 20:43:36 -0800
From: Michael D'Errico <mike-list@pobox.com>
User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812)
MIME-Version: 1.0
To: tls@ietf.org
References: <9923D81D-BABA-4897-A0E3-6938FFB70045@checkpoint.com> <C7355261.6BB2%stefan@aaa-sec.com> <20091127151113.BDEF16C3795@kilo.networkresonance.com> <4B10E225.4010501@jacaranda.org> <4B117AF2.20703@pobox.com> <4B11C156.7060204@jacaranda.org>
In-Reply-To: <4B11C156.7060204@jacaranda.org>
Content-Type: text/plain; charset="UTF-8"; format="flowed"
Content-Transfer-Encoding: 7bit
X-Pobox-Relay-ID: 8B7CCFE2-DCA1-11DE-AF24-9F3FEE7EF46B-38729857!a-pb-sasl-quonix.pobox.com
Subject: Re: [TLS] Verify data in the RI extension?
X-BeenThere: tls@ietf.org
X-Mailman-Version: 2.1.9
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/listinfo/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, 29 Nov 2009 04:42:14 -0000

David-Sarah Hopwood wrote:
> Michael D'Errico wrote:
>> David-Sarah Hopwood wrote:
>>> Eric Rescorla wrote:
>>>> I also share [David-Sarah] Hopwood's concern about ambiguity in the
>>>> handshake hashes stream created by having data which is not properly
>>>> formatted injected into the hash
>>>> (http://www.ietf.org/mail-archive/web/tls/current/msg04857.html),
>>>> so I don't think the particular approach in Martin's draft is
>>>> really satisfactory.
>>> That potential weakness can be avoided by encoding the data to be added
>>> into the hash as follows:
>>>
>>>    struct {
>>>        enum { fake_finished(20) } fake_handshake_type;
>>>        enum { zero(0), (2^24-1) } fake_length;
>>>        opaque previous_client_verify_data<12..255>;
>>>        opaque previous_server_verify_data<12..255>;
>>>    } PreviousVerifyData;
>> I like the direction this is going, but think that using a length of
>> zero doesn't quite patch the potential weakness.
> 
> It does: as I said, for an implementation to be vulnerable it would
> have to violate two existing 'MUST's -- failing to abort the handshake
> on an out-of-order handshake message, and failing to check the correctness
> of the verify_data in a Finished message. If it gets the latter wrong,
> then it's clearly insecure anyway. What is sent after the fake Finished
> message doesn't matter for avoiding this weakness.

The theoretical weakness, as I understand it, is that inserting the previous
verify_data directly into the handshake message stream would allow an
attacker to send the previous data to an unpatched peer at the point where
it would get inserted by a patched peer.  If (and it's a big if) that peer
ignores that data, then the handshake has the possibility of completing.

Your fix is to insert a "fake" header in front of the verify_data to make
the attack impossible.  The problem with using a zero length is that the
4-byte header you inserted is a _valid zero-length Finished message_.  If
you believe that the theoretical attack can work, then you have to also
believe that it's possible for that broken peer to ignore a zero-length
Finished message.

Using any length that is longer than the inserted data should completely
plug this hole.

Mike


> (Since the previous_{client,server}_verify_data are variable-length,
> I chose to encode their length explicitly, but that's a separate issue.)
> 
>> So instead of zero, why not use 0xFFFFFF?
> 
> That would work as well, but only for the same reason, i.e. that
> 0xFFFFFF is not a valid length for the content of a correct Finished
> message.