[TLS] MITM Attacks on Client Authentication after Resumption

Karthikeyan Bhargavan <karthikeyan.bhargavan@inria.fr> Mon, 03 March 2014 15:21 UTC

Return-Path: <karthikeyan.bhargavan@inria.fr>
X-Original-To: tls@ietfa.amsl.com
Delivered-To: tls@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com []) by ietfa.amsl.com (Postfix) with ESMTP id 94E431A004A for <tls@ietfa.amsl.com>; Mon, 3 Mar 2014 07:21:04 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.096
X-Spam-Status: No, score=-7.096 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HELO_EQ_FR=0.35, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, RP_MATCHES_RCVD=-0.547] autolearn=ham
Received: from mail.ietf.org ([]) by localhost (ietfa.amsl.com []) (amavisd-new, port 10024) with ESMTP id CF2mtcMvPZ2R for <tls@ietfa.amsl.com>; Mon, 3 Mar 2014 07:21:01 -0800 (PST)
Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr []) by ietfa.amsl.com (Postfix) with ESMTP id 47F971A0133 for <tls@ietf.org>; Mon, 3 Mar 2014 07:21:00 -0800 (PST)
X-IronPort-AV: E=Sophos; i="4.97,577,1389740400"; d="scan'208,217"; a="61079042"
Received: from dhcp-a4d4.meeting.ietf.org ([]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/AES128-SHA; 03 Mar 2014 16:20:56 +0100
From: Karthikeyan Bhargavan <karthikeyan.bhargavan@inria.fr>
Content-Type: multipart/alternative; boundary="Apple-Mail=_E1B0B893-1C31-4973-B05B-7AF81CC5604F"
Message-Id: <BB2FE60E-A7CA-4EA7-BFC8-AB794EC6FF00@inria.fr>
Date: Mon, 03 Mar 2014 15:20:55 +0000
To: tls@ietf.org
Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\))
X-Mailer: Apple Mail (2.1874)
Archived-At: http://mailarchive.ietf.org/arch/msg/tls/e_jsCEATXnkPHJ7CCK5YOZoL9IQ
Subject: [TLS] MITM Attacks on Client Authentication after Resumption
X-BeenThere: tls@ietf.org
X-Mailman-Version: 2.1.15
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: Mon, 03 Mar 2014 15:21:04 -0000

We are going to present some new man-in-the-middle attacks on TLS
applications in Tuesday’s working group meeting. These attacks were
found as part of our research on trying to prove cryptographic
security for a TLS implementation [1].  We presenting some of the
materials here to kick-start some discussion and get early comments on
our proposed countermeasure. Some people on the list already know of
these attacks but this is the first public disclosure.

More details are at https://secure-resumption.com [2]

Consider a client C that normally authenticates to a server S using a
client certificate.  If C uses the same certificate to authenticate to
a malicious server M, then we show that M can use C’s certificate to
authenticate its own connection to S.

The attack relies on the combination of an initial RSA or DHE
handshake, followed by session resumption on a new connection,
followed by a client-authenticated renegotiation. During the first two
handshakes, C has a connection to M and M has a connection to
S. During the third handshake, M is able to authenticate as C to S and
as S to C.

This server-based man-in-the-middle attack should normally have been
prevented by the Renegotiation Indication (RI) extension [3] but by
injecting session resumption between the two full handshakes, we are
able to bypass the renegotiation countermeasure.

Triple Handshake Attack
I’ll briefly summarise the attack below for an initial RSA key
exchange.  The webpage [2] has diagrams that will be easier to follow,
describes more attack variants, and provides some disclosure status.

The attack proceeds in three steps:

Step 1. (Initial Handshakes C-M, M-S)
- C connects to M and M connects to S, both handshakes use RSA.
- M forwards C’s and S’s client hellos to each other.
- M receives an encrypted PMS from C and reencrypts it towards S.
- Both handshakes complete with new sessions and record keys.
  Both sessions have the same master secret, random nonces, and session id.
  (M knows the master secret and record keys since it participated in both handshakes)

Step 2. (Session Resumption C-M, M-S)
- C resumes its session with M on a new connection.	     
- M resumes its session with S on a new connection.
- M forwards all the abbreviated handshake messages unchanged between C and S.
- Note that the RI extensions on both handshakes are empty, 
  since it is the first handshake on the connection
- Both handshakes complete with new record keys (and reuse old sessions)
  Both connections have the same record keys and handshake logs (verify data)
  (M still knows the record keys and can send messages in either direction.)

Step 3. (Renegotiation C-M-S)
- S requests M for renegotiation with client certificate. 
  M requests C for renegotiation with client certificate.
- M forwards all renegotiation messages unchanged between C and S 
- Note that since the handshake logs in the preceding handshake were the same, 
  the RI extensions on both handshakes will be the same.
- Both handshakes complete with new mutually-authenticated sessions and record keys.
  C now thinks it is connected to S and S thinks it is connected to C.
  (M does not know the new record keys but its previous messages to S on the same connection 
  may be treated as authenticated by C.)

At the end of Step 3, S has an incoming connection on which it
initially received data from an anonymous client (M) and later
received data from an authenticated client (C). This breaks the
intended guarantees of the RI extension.

During Step 3, C has a connection on which it first received M’s
certificate and later S’s certificate. If C refuses to accept this
change of server identity, then it can prevent Step 3 of the
attack. Indeed, we recommend mainstream web browsers and HTTPS
libraries should systematically forbid the change of server identities
during renegotiation.

However, already at the end of Step 2, a number of connection and
session parameters, such as the tls-unique channel binding for the two
connections are the same. So any application-level mechanism that
relies on the TLS master secret [4] or channel bindings [5] or exports
TLS keying material [6] is vulnerable to a similar man-in-the-middle

We argue that the core vulnerability here is that the TLS master
secret is not bound to enough elements of the TLS session. We propose
a new TLS extension that binds the master secret to the hash of the
all relevant handshake messages in the initial handshake.

The proposed draft is available at:

The key idea is that each full handshake is associated with a session
hash, computed as
	session_hash = Hash(handshake_messages) 
where handshake_messages consist of all messages up to and including
the ClientKeyExchange.  The extended master secret computation enabled
by the extension is then computed as
	master_secret = PRF(pre_master_secret, 
                                        "extended master secret", 
                                         session_hash) [0..47]; 
We’ve implemented this extension in OpenSSL without much difficulty.
Changing the master secret derivation may seem radical, but we believe
it is the main way to counter future attacks that may rely on the
session synchronization (step 1) that we exploit here.

An alternative countermeasure would be an extension (along the lines
of [3]) that includes the session hash as defined above in the
ClientHello and ServerHello messages of the abbreviated
handshake. This would provide an explicit link between the resumption
handshake and its original full handshake, and hence prevent the
renegotiation attack described above.

We welcome comments and suggestions.
-Karthik Bhargavan, Antoine Delignat-Lavaud, and Alfredo Pironti

[1] http://mitls.org
[2] https://secure-resumption.com
[3] RFC5746: Transport Layer Security Renegotiation Indication Extension
[4] The Compound Authentication Binding Problem (draft-puthenkulam-eap-binding-04)
[5] RFC5929: Channel Bindings for TLS
[6] RFC5705: Keying Material Exporters for Transport Layer Security