[TLS] DTLS Handshake race condition

Michael Tuexen <Michael.Tuexen@lurchi.franken.de> Sun, 11 August 2013 13:24 UTC

Return-Path: <Michael.Tuexen@lurchi.franken.de>
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 81AB321F8CB0 for <tls@ietfa.amsl.com>; Sun, 11 Aug 2013 06:24:37 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.599
X-Spam-Level:
X-Spam-Status: No, score=-2.599 tagged_above=-999 required=5 tests=[BAYES_00=-2.599]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id u-YXkbex9-ap for <tls@ietfa.amsl.com>; Sun, 11 Aug 2013 06:24:37 -0700 (PDT)
Received: from mail-n.franken.de (drew.ipv6.franken.de [IPv6:2001:638:a02:a001:20e:cff:fe4a:feaa]) by ietfa.amsl.com (Postfix) with ESMTP id CD9EC21F9703 for <tls@ietf.org>; Sun, 11 Aug 2013 06:17:57 -0700 (PDT)
Received: from [192.168.1.200] (p508F1653.dip0.t-ipconnect.de [80.143.22.83]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTP id 2BB991C0C069C for <tls@ietf.org>; Sun, 11 Aug 2013 15:17:54 +0200 (CEST)
From: Michael Tuexen <Michael.Tuexen@lurchi.franken.de>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Message-Id: <1CBCCCAF-163A-474B-8DD0-6634460644C1@lurchi.franken.de>
Date: Sun, 11 Aug 2013 15:17:54 +0200
To: "tls@ietf.org" <tls@ietf.org>
Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\))
X-Mailer: Apple Mail (2.1508)
Subject: [TLS] DTLS Handshake race condition
X-BeenThere: tls@ietf.org
X-Mailman-Version: 2.1.12
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: <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, 11 Aug 2013 13:24:37 -0000

Dear all,

while fixing a bug in OpenSSL regarding the DTLS handshake, I thought about
the following scenario (both sides decide to renegotiate at about the same
time):

* A DTLS connection is established.
* The server sends a HelloRequest(MsgSeqNo = 0) and starts the retransmission
  timer, since this is a flight.
* The HelloRequest is dropped by the network.
* The client sends a ClientHello(MsgSeqNo = 0) and start a retransmission timer,
  since it is its first flight.
* The server receives the ClientHello, stops the retransmission timer
  and sends the next flight starting with ServerHello(MsgSeqNo = 1) 
  since it considers the received ClientHello as an ack for the flight.
* The client doesn't process the ServerHello, since it expects the
  MsgSeqNo == 0.

Therefore the client retransmits its ClientHello and the server retransmits
its flight containing the ServerHello. Am I missing something?

The problem is that the server has no way to figure out if the received
ClientHello is a reaction to a HelloRequest or not.
The only way out I see is that the client accepts ServerHellos with
MsgSeqNo=0 and MsgSeqNo=1.
I don't think this is covered in http://tools.ietf.org/html/rfc6347

Any opinions?

Best regards
Michael