<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc strict="yes" ?>
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes" ?>
<?rfc compact="yes" ?>
<?rfc subcompact="no" ?>
<rfc category="info" docName="draft-weimer-tls-previous-certificate-01" ipr="trust200902">
  <front>
    <title abbrev="Previous Certificate TLS Extension">TLS Extension
    For Indicating A Previously-Seen Server Certificate Chain</title>
    <author fullname="Florian Weimer" surname="Weimer">
      <organization abbrev="Red Hat">Red Hat GmbH</organization>
      <address>
	<postal>
	  <street>Wankelstraße 5</street>
	  <city>Stuttgart</city>
	  <code>70563</code>
	  <country>DE</country>
	</postal>
	<email>fweimer@redhat.com</email>
      </address>
    </author>

    <date month="November" year="2012"/>
    <area>Security Area</area>
    <workgroup>TLS</workgroup>

    <abstract>
      <t>This document describes a TLS extension which enables a TLS
      client to send to a TLS server a certificate chain which the
      client has previously received from the same server.  Server
      operators are expected to use this information to detect use of
      fraudulent certificates on the Internet.
      </t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">
      <t>The <xref target="RFC5246">TLS protocol</xref> does not
      provide any non-cryptographic mechanism to detect which server
      certificates are in use.  The <xref target="RFC2560">OCSP
      protocol</xref> does not embed the actual certificate in
      requests, which means that certificate authorities are not able
      to detect unexpected certificates, either.</t>

      <t>This document describes an extension which a TLS client can
      use during the TLS handshake to send back to a server the
      certificate chain that the client has seen during a previous
      connection attempt (presumably the last).  The server operator
      can analyze incoming certificates and investigate those which it
      has not obtained itself.</t>

      <t>It is expected that attackers simply strip the extension, to
      avoid alerting server operators.  However, assuming that a
      subset of the clients which are exposed to a fraudulent
      certificate are mobile, some of them will eventually move to a
      network which provides a clear path to the server.  At this
      point, the server will receive the fraudulent certificate, and
      the server operator can initiate countermeasures.
      </t>

      <t>Compared to client-side detection, server-side detection has
      the advantage that the client user interface does not need
      changing.  Additionally, the server operator is in a better
      position to tell fraudulent from authorized certificates.</t>

      <section title="Requirements Language">
        <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">RFC 2119</xref>.</t>
      </section>
    </section>

    <section title="Extension Definitions">
      <t>In order to send a previously-encountered server certificate
      chain, clients MAY include an extension of type
      "previous_certificate_chain" in the client hello, with extension
      type TBD.</t>

      <figure>
	<preamble>
	  The "extension_data" field of this extension SHALL contain a
	  "PreviousCertificateChain" structure, which is defined as:
	</preamble>
	<artwork>
struct {
    Certificate certificate;
} PreviousCertificateChain;
	</artwork>
      </figure>

      <t>This extension can be used with <xref
      target="RFC4347">DTLS</xref>.</t>

      <t>The client MUST take the certificate chain from the
      "certificate" message in a previous, successful TLS handshake
      with the same endpoint, and include it in the "certificate"
      field.  The most recent handshake matching these criteria SHOULD
      be used.  Two endpoints are the same if they have the same name
      or address, as supplied by the user or an application protocol
      which uses TLS.  Successful handshakes MAY include those where
      the user has overridden certificate validaty or trust
      checks.</t>

      <t>If the certificate chain does not fit into the client hello,
      the extension defined in the next section SHOULD be used.</t>

      <t>A TLS server MAY ignore this extension.  It MUST NOT assume a
      particular order of the presented certificates.  It SHOULD NOT
      include it in the server hello.  A client MUST ignore the
      extension if it is included in the server hello.</t>

      <section title="Extension for large certificate chains">
	<t>The TLS protocol limits for certificate chain lengths
	exceed those for extension lengths.  An attacker can therefore
	evade detection by intentionally supplying a certificate chain
	which contains many certificates or a large certificate.  In
	order to address this problem, a client implementing the
	"previous_certificate_chain" extension SHOULD use the
	"large_previous_certificate_chain" extension.
	</t>
	<t>The "large_previous_certificate_chain" has type TBD, and
	the the "extension_data" field SHALL contain the
	"PreviousCertificateChain" structure defined above.</t>
	<t>The certificate chain in the "certificate" field SHOULD be
	prepared in the following manner:
	<list>
	  <t>If the certificate chain that caused the client to accept
	  the certificate as valid does not exceed the imposed size limit,
	  this certificate chain MUST be used.</t>
	  <t>Otherwise, if including the server certificate does not
	  exceed the size limit, it SHOULD be included.</t>
	  <t>The client should add as many certificates as possible,
	  within the size constraint, starting at the trusted root CA
	  and going down the chain.</t>
	</list></t>
	<t>Otherwise, server and client behavior is the same as for
	the "previous_certificate_chain" extension.</t>
	<t>If a client is not able to process certificate chains at
	all which would exceed the limits implicitly imposed by the
	"previous_certificate_chain" extension, implementation of the
	"large_previous_certificate_chain" extension is OPTIONAL.</t>
      </section>

      <section title="Server-Side Processing">
	<t>No server-side processing is required.  It is expected that
	operators analyze incoming extensions on an intrusion
	detection system, and trigger internal alerts when unknown
	certificates chained to a global trust root are encountered.
	This is possible because the extension is transmitted in the
	clear.</t>
      </section>
    </section>

    <section title="Interaction With Client Certificates">
      <t>The extensions described above can and should be used with
      client certificates.</t>
      <t>Authentication with client certificates typically includes a
      hash (signed by the client) which covers the entire handshake.
      Therefore, replacement of the server certificate by an attacker
      leads to a handshake failure.  Depending on how client
      certificate verification is implemented in the server, an
      attacker could obtain a successful handshake if the client
      certificate is replaced as well, but this is observable on the
      server side.</t>
    </section>

    <section anchor="Security" title="Security Considerations">
      <t>The mechanism described in this document is by no means
      cryptographically strong.  It is the explicit goal of this
      document to provide detection capabilities which do not rely on
      cryptography and cryptography-related infrastructure.</t>

      <t>If a server dynamically generates its server certificate, it
      can recognize reconnecting clients.  In comparison to the
      session resumption mechanism built into TLS, this ability last
      for a longer time.  For privacy-sensitive applications, use
      of these extensions should be disabled or restricted.</t>

      <t>Clients may deliberately transmit incorrect certificate
      chains.  For the "previous_certificate_chain" extension, this
      can be detected on the server side because such a certificate
      chain will not be linked to a globally accepted root
      certificate.</t>

      <t>If a client downgrades its advertised TLS protocol version or
      set of extensions on handshake failures, an attacker may
      suppress sending these extensions, especially if the attacker
      can force the client to perform such a downgraded handshake
      after the fraudulent certificate has been used.</t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include="http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml"?>
      <?rfc include="http://xml.resource.org/public/rfc/bibxml/reference.RFC.4347.xml"?>
      <?rfc include="http://xml.resource.org/public/rfc/bibxml/reference.RFC.2560.xml"?>
      <?rfc include="http://xml.resource.org/public/rfc/bibxml/reference.RFC.5246.xml"?>
    </references>
  </back>
</rfc>
