<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
     
<!ENTITY RFC6101 SYSTEM
"http://xml.resource.org/public/rfc/bibxml/reference.RFC.6101.xml">
<!ENTITY RFC5246 SYSTEM
"http://xml.resource.org/public/rfc/bibxml/reference.RFC.5246.xml">
<!ENTITY RFC5226 SYSTEM
"http://xml.resource.org/public/rfc/bibxml/reference.RFC.5226.xml">
<!ENTITY RFC2119 SYSTEM
"http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC6066 SYSTEM
"http://xml.resource.org/public/rfc/bibxml/reference.RFC.6066.xml">
<!ENTITY RFC5280 SYSTEM
"http://xml.resource.org/public/rfc/bibxml/reference.RFC.5280.xml">
<!ENTITY RFC5480 SYSTEM
"http://xml.resource.org/public/rfc/bibxml/reference.RFC.5480.xml">
<!ENTITY RFC4492 SYSTEM
"http://xml.resource.org/public/rfc/bibxml/reference.RFC.4492.xml">
]>
     
<?rfc rfcedstyle="yes" ?>
<?rfc compact="yes"?>
<?rfc subcompact="no" ?>
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>

<rfc category="std" ipr="trust200902" docName="draft-mavrogiannopoulos-tls-cross-protocol-00" submissionType="IETF">
   <front>
      <title abbrev="Preventing TLS cross-protocol attacks">Preventing cross-protocol attacks in TLS protocol</title>
      <author initials="N." surname="Mavrogiannopoulos" fullname="Nikos
      Mavrogiannopoulos">
         <organization abbrev="KU Leuven - IBBT">KU Leuven ESAT/SCD/COSIC - IBBT</organization>
         <address>
            <postal>
               <street>Kasteelpark Arenberg 10, bus 2446</street>
               <city>Leuven-Heverlee</city>
               <region></region>
               <code>B-3001</code>
               <country>Belgium</country>
            </postal>
            <email>nikos.mavrogiannopoulos@esat.kuleuven.be</email>
         </address>
      </author>

      <date month="June" year="2012"/>
      <area>Security</area>

<!-- [rfced] Please note that after you have approved the document,
post-xml2rfc changes will be made to update the header and boilerplate as
described in RFC 5741. -->

      <abstract>
         <t>
This memo proposes a fix in the TLS ServerKeyExchange message signature, to prevent cross-protocol attacks.
         </t>
      </abstract>
   </front>

   <middle>
      <section anchor="intro" title="Introduction">
        <t>
The TLS protocol <xref target="RFC5246"/> suffers from an issue in the ServerKeyExchange message signature
discovered by Wagner and Schneier in <xref target="WS-ATTACK"/>.
They describe a cross-protocol attack on the SSL 3.0 <xref target="RFC6101"/> protocol,
that re-uses a signed ServerKeyExchange packet in another session with a different key exchange algorithm.
In effect the attack uses a server as an oracle to obtain signed ServerKeyExchange messages that
are relayed to another, unrelated, session. The described attack turned to be impossible to implement in 
practice, but the underlying idea is applicable to all TLS protocol versions, and as the supported
key exchange algorithms increase, it provides a tool for new attacks on the protocol [ref needed].
        </t>

        <t>
          In this document we propose a fix for the TLS protocol that does not require a protocol version upgrade.
<!-- For more information on the details on the Wagner Schneier and newer attacks we refer to [ref needed]. -->
        </t>
     </section>

     <section anchor="terms" title="Terminology">
        <t>
         This document uses the same notation and terminology used in the TLS Protocol specification
         <xref target="RFC5246"/>.
        </t>
        <t>
         The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
         NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED",  "MAY", and
         "OPTIONAL" in this document are to be interpreted as described in
         <xref target="RFC2119"/>.
        </t>
      </section>


<section anchor="the-attack" title="The Wagner and Schneier attack">
<t>
Wagner and Schneier in <xref target="WS-ATTACK"/> describe a cross-protocol 
attack (The authors refer to it as "key exchange algorithm rollback attack")
based on the observation that the digital signature in a Diffie-Hellman 
key exchange does not cover any identifier of the negotiated ciphersuite.
According to the SSL 3.0 protocol <xref target="RFC6101"/> when a Diffie-Hellman key 
exchange has been negotiated, the group parameters are
sent by the server in the ServerKeyExchange message as shown below. 

     <figure>
      <artwork><![CDATA[
    struct {
        select (KeyExchangeAlgorithm) {
            case diffie_hellman:
                opaque dh_p<1..2^16-1>;
                opaque dh_g<1..2^16-1>;
                opaque dh_Ys<1..2^16-1>;
                Signature signed_params;
            case rsa:
                opaque rsa_modulus<1..2^16-1>;
                opaque rsa_exponent<1..2^16-1>;
                Signature signed_params;
        };
    } ServerKeyExchange;
]]></artwork>
</figure>

The signature on that message is calculated on the algorithm
parameters, and the nonces exchanged by both peers.
The crucial observation is that the negotiated key exchange algorithm is not 
part of this signature.
</t>
<t>
This omission allows an adversary to re-use a signed ServerKeyExchange packet in another session, with another
key exchange algorithm, by initiating a parallel connection to the server.  In particular,
the described in <xref target="WS-ATTACK"/>  attack deceives a client who advertises a TLS_RSA_EXPORT ciphersuite and expects temporary RSA parameters in the ServerKeyExchange message,
into receiving Diffie-Hellman parameters from a TLS_DHE_RSA ciphersuite. 
</t>

<t>
The attack is based on a wrong assumption in the TLS packet parsing, which prevents
it from being practical. It demonstrates, however, the idea of a cross-protocol attack 
utilizing two of the SSL 3.0 key exchange methods, the Diffie-Hellman and 
the RSA-EXPORT key exchanges.
</t>


</section>

      <section anchor="mac:idea" title="The new ServerKeyExchange signature">  
        <t>
The goal of this memo is to restrict the applicability of the server provided signed 
ServerKeyExchange to the current session.  A simple fix may be to include the negotiated ciphersuite into the
signature. However, the TLS protocol is complex and a key exchange method does not always imply a single
format of the ServerKeyExchange signature. For example, the elliptic curves key exchange method may
be used with an arbitrary elliptic curve <xref target="RFC4492"/> which
requires different data in the ServerKeyExchange than when used with a named curve. Such key exchange
suboptions are negotiated using TLS extensions and such extensions should be covered by the signature, to prevent any attack that takes advantage
of the different signature format.
</t>
<t>
For that we propose that the signature of the ServerKeyExchange message to be modified
to include in addition to explicit identifiers of the algorithms, all the previously exchanged messages.
The proposed signature for a ServerKeyExchange message is shown below.

     <figure>
      <artwork><![CDATA[
  enum { server (0), client (1) } ConnectionEnd;

  enum { dhe_dss (0), dhe_rsa (1), 
         ec_diffie_hellman (2) 
       } KeyExchangeAlgorithm;

  struct {
    digitally-signed struct {
      ConnectionEnd entity;
      KeyExchangeAlgorithm kx_algorithm;
      select (KeyExchangeAlgorithm) {
        case dhe_dss:
        case dhe_rsa:
          ServerDHParams params;
        case ec_diffie_hellman:
          ServerECDHParams;
      }
      opaque handshake_messages<0..2^24-1>;
    }
  } ServerKeyExchange;
]]></artwork>
</figure>

<!--       opaque handshake_messages[handshake_messages_length]; -->


The new format includes explicit indicators of the entity (server), the key exchange algorithm used, 
the handshake messages exchanged, and the parameters of the key exchange.
This modification will be negotiated by using a new TLS extension to allow backwards compatibility.
</t>


</section>

      <section anchor="mac:extension" title="The extension">
        <t>
        In order for a client to advertise its support for the new ServerKeyExchange format
        we add a new extension "new_server_key_exchange", with value TBD-BY-IANA, 
        to the enumerated ExtensionType defined in <xref target="RFC5246"/>. The "extension_data" field of this extension is
	empty.
	</t>

      </section>
      <section anchor="mac:behavior" title="Server and client behavior">
	<t>
        Clients, that wish to protect against cross-protocol attacks, SHOULD include the extension of type "new_server_key_exchange" 
	in the (extended) client hello. 
	</t>

	<t>
	   Servers that receive an extended client hello containing a
	   "new_server_key_exchange" extension, MAY accept the request for the new ServerKeyExchange
	   format by including an extension of type
	   "new_server_key_exchange" in the extended server hello. 
	</t>
	<t>
	  Servers compliant to this document, that did not receive the extension MUST set the gmt_unix_time part of the
	  Random value included in ServerHello to zero. Because in cross-protocol attacks the server's random value
          is redirected to the client, this is a way for the server to indicate support for the extension even in the presence of an adversary.
	</t>
	<t>
	  Clients compliant to this document, that advertised this extension but
	  didn't receive a corresponding extension from the server, MUST check the gmt_unix_time part of the
	  Random value included in ServerHello message for the value zero. If the gmt_unix_time is zero the client MUST abort the handshake with an "illegal_parameter" fatal alert.
	</t>
<t>
Note that this extension is applies to all versions of the TLS protocol including
TLS 1.2 <xref target="RFC5246"/> and SSL 3.0 <xref target="RFC6101"/>. 
</t>

      </section>



      <section anchor="security" title="Security considerations">
        <t>
        This extension modifies the ServerKeyExchange message in order to prevent
attacks to the protocol similar in nature with the Wagner and Schneier attack. In order for the protection
to be applicable, both the client and the server must sbupport this extension. 
        </t>
        <t>
        Compliant servers that did not receive the extension from the client are required to set the 4 bytes of the server's random value, that encodes the time, as zero. This provides a tool
to indicate support for the extended format even in the presence of an adversary, but comes at the cost of reducing the total randomness from the server from 32 bytes to 28 bytes. 
        </t>
      </section>

      <section anchor="IANA" title="IANA Considerations">
  <t>
   This document defines the TLS extension "new_server_key_exchange" (value TBD-BY-IANA)
   whose value should be assigned from the TLS ExtensionType Registry defined
   in <xref target="RFC5246"/>.

  </t>
      </section>

      <!--
      <section title="Acknowledgements">
        <t>
        </t>
      </section>
      -->




   </middle>

   <back>
    <references title="Normative References">

    <reference anchor='WS-ATTACK'>
        <front>
            <title>WS-ATTACK of the SSL 3.0 protocol</title>
            <author initials='D.' surname='Wagner'
                    fullname='David Wagner'>
            </author>
            <author initials='B.' surname='Schneier'
                    fullname='Bruce Schneier'>
            </author>

            <date month='November' year='1996' />
        </front>
        <seriesInfo name="The Second USENIX Workshop on Electronic Commerce Proceedings, USENIX Press" value=""/>
    </reference>

   &RFC2119;
   &RFC5246;
  </references>

  <references title="Informative References">
   &RFC6101;
   &RFC4492;
  </references>

  </back>
</rfc>
