<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC2629 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2629.xml">
<!ENTITY RFC3552 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3552.xml">
<!ENTITY I-D.narten-iana-considerations-rfc2434bis SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.narten-iana-considerations-rfc2434bis.xml">

<!ENTITY RFC4120 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4120.xml">
<!ENTITY RFC4556 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4556.xml">
<!ENTITY RFC5349 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5349.xml">
<!ENTITY RFC6113 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6113.xml">

]>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<?rfc strict="yes" ?>
<?rfc toc="yes"?>
<?rfc tocdepth="4"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes" ?>
<?rfc compact="yes" ?>
<?rfc subcompact="no" ?>
<rfc submissionType="IETF" category="std" consensus="yes" number="8070" ipr="trust200902">


  <!-- ***** FRONT MATTER ***** -->

  <front>

    <title abbrev="PKINIT Freshness">Public Key Cryptography for Initial Authentication in Kerberos (PKINIT) Freshness Extension</title>


    <author fullname="Michiko Short" initials="M.S." role="editor"
            surname="Short">
      <organization>Microsoft Corporation</organization>

      <address>
        <postal>
          <street></street>

   

          <city></city>

          <region></region>

          <code></code>

          <country>United States of America</country>
        </postal>

        <phone></phone>

         <email>michikos@microsoft.com</email>

 
      </address>
    </author>

    <author fullname="Seth Moore" initials="S.M." 
            surname="Moore">
      <organization>Microsoft Corporation</organization>

      <address>
        <postal>
          <street></street>

          <city></city>

          <region></region>

          <code></code>

          <country>United States of America</country>
        </postal>

        <phone></phone>


        <email>sethmo@microsoft.com</email>

      
      </address>
    </author>

    <author fullname="Paul Miller" initials="P.M." 
            surname="Miller">
      <organization>Microsoft Corporation</organization>

      <address>
        <postal>
          <street></street>

          <city></city>

          <region></region>

          <code></code>

          <country>United States of America</country>
        </postal>

        <phone></phone>


        <email>paumil@microsoft.com</email>

     
      </address>
    </author>


   <date month="February" year="2017" />


    <area>Security</area>

    <workgroup>Kitten Working Group</workgroup>

    <abstract>
      <t>This document describes how to further extend the Public Key Cryptography for Initial Authentication in Kerberos (PKINIT) extension (defined in RFC 4556) to exchange an opaque data blob that a Key Distribution Center (KDC) can validate to ensure that the client is currently in possession of the private key during a PKINIT Authentication Service (AS) exchange.</t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">
      <t>The Kerberos PKINIT extension <xref target="RFC4556"/> defines two schemes for using asymmetric cryptography in a Kerberos pre-authenticator.  One uses Diffie-Hellman key exchange and the other depends on public key encryption.  The public key encryption scheme is less commonly used for two reasons:<list style="symbols">

         <t>Elliptic Curve Cryptography (ECC) Support for PKINIT <xref target="RFC5349" /> only specified Elliptic Curve Diffie-Hellman (ECDH) key agreement, so it cannot be used for public key encryption.</t>

         <t>Public key encryption requires certificates with an encryption key, which is not deployed on many existing smart cards.</t>

         </list> 
      </t>

      <t>In the Diffie-Hellman exchange, the client uses its private key only to sign the AuthPack structure (specified in Section 3.2.1 of <xref target="RFC4556"/>), which is performed before any traffic is sent to the KDC.  Thus, a client can generate requests with future times in the PKAuthenticator, and then send those requests at those future times. Unless the time is outside the validity period of the client's certificate, the KDC will validate the PKAuthenticator and return a Ticket-Granting Ticket (TGT) the client can use without possessing the private key.</t>

      <t>As a result, a client performing PKINIT with the Diffie-Hellman key exchange does not prove current possession of the private key being used for authentication.  It proves only prior use of that key.  Ensuring that the client has current possession of the private key requires that the signed PKAuthenticator data include information that the client could not have predicted.</t>

    <section title="Kerberos Message Flow Using KRB_AS_REQ without Pre-authentication">

	<t>Today, password-based AS exchanges <xref target="RFC4120"/> often begin with the client sending a KRB_AS_REQ without pre-authentication. When the principal requires pre-authentication, the KDC responds with a KRB_ERROR containing information needed to complete an AS exchange, such as the supported encryption types and salt values. This message flow is illustrated below:</t>

      <figure align="center" anchor="PKINIT_message_flow">
        <preamble></preamble>

        <artwork align="left"><![CDATA[
Client                                          KDC

AS-REQ without pre-authentication     ---->    
                                      <----     KRB-ERROR

AS-REQ                                ---->     
                                      <----     AS-REP

TGS-REQ                               ---->     
                                      <----     TGS-REP

                  

            ]]></artwork>

        <postamble></postamble>
      </figure>	

	<t>We can use a similar message flow with PKINIT, allowing the KDC to provide a token for the client to include in its KRB_AS_REQ to ensure that the PA_PK_AS_REQ <xref target="RFC4556"/> was not pre-generated.</t>

    </section>

      <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"></xref>.</t>
      </section>
</section>   





    <?rfc needLines="8" ?>

    <section title="Message Exchanges">
   <t>The following summarizes the message flow with extensions to <xref target="RFC4120"/> and <xref target="RFC4556"/> required to support a KDC-provided freshness token during the initial request for a ticket:<list style="numbers">

        
            <t>The client generates a KRB_AS_REQ, as specified in Section 2.9.3 of <xref target="RFC4120"/>, that contains no PA_PK_AS_REQ and includes a freshness token request.</t>

            <t>The KDC generates a KRB_ERROR, as specified in Section 3.1.4 of <xref target="RFC4120"/>, providing a freshness token.</t>


            <t>The client receives the error, as specified in Section 3.1.5 of <xref target="RFC4120"/>, extracts the freshness token, and includes it as part of the KRB_AS_REQ as specified in <xref target="RFC4120"/> and <xref target="RFC4556"/>.</t>

            <t>The KDC receives and validates the KRB_AS_REQ, as specified in Section 3.2.2 of <xref target="RFC4556"/>, then additionally validates the freshness token.</t>

            <t>The KDC and client continue, as specified in <xref target="RFC4120"/> and <xref target="RFC4556"/>.</t>

          </list> 
  
</t>
    <section title="Generation of KRB_AS_REQ Message">
            <t>The client indicates support of freshness tokens by adding a padata element with padata-type PA_AS_FRESHNESS and padata-value of an empty octet string.</t>
    </section>

    <section title="Generation of KRB_ERROR Message">
            <t>The KDC will respond with a KRB_ERROR <xref target="RFC4120"/> message with the error-code KDC_ERR_PREAUTH_REQUIRED <xref target="RFC4120"/> adding a padata element with padata-type PA_AS_FRESHNESS and padata-value of the freshness token to the METHOD-DATA object.</t>
    </section>

    <section title="Generation of KRB_AS_REQ Message">
            <t>After the client receives the KRB-ERROR message containing a freshness token, it extracts the PA_AS_FRESHNESS padata-value field of the PA-DATA structure as an opaque data blob. The PA_AS_FRESHNESS padata-value field of the PA-DATA structure SHALL then be added as an opaque blob in the freshnessToken field when the client generates the PKAuthenticator specified in <xref target="ExtPKAuth"/> for the PA_PK_AS_REQ message. This ensures that the freshness token value will be included in the signed data portion of the KRB_AS_REQ value.</t>
    </section>

    <section title="Receipt of KRB_AS_REQ Message">
            <t>If the realm requires freshness and the PA_PK_AS_REQ message does not contain the freshness token, the KDC MUST return a KRB_ERROR <xref target="RFC4120"/> message with the error-code KDC_ERR_PREAUTH_FAILED <xref target="RFC4120"/> with a padata element with padata-type PA_AS_FRESHNESS and padata-value of the freshness token to the METHOD-DATA object.</t>
            <t>When the PA_PK_AS_REQ message contains a freshness token, after validating the PA_PK_AS_REQ message normally, the KDC will validate the freshnessToken value in the PKAuthenticator in an implementation-specific way. If the freshness token is not valid, the KDC MUST return a KRB_ERROR <xref target="RFC4120"/> message with the error-code KDC_ERR_PREAUTH_EXPIRED <xref target="RFC6113"/>. The e-data field of the error  contains a METHOD-DATA object <xref target="RFC4120"/>, which specifies a valid PA_AS_FRESHNESS padata-value. Since the freshness tokens are validated by KDCs in the same realm, standardizing the contents of the freshness token is not a concern for interoperability.</t>
    </section>

    <section title="Receipt of Second KRB_ERROR Message">
            <t>If a client receives a KDC_ERR_PREAUTH_EXPIRED KRB_ERROR message that includes a freshness token, it SHOULD retry using the new freshness token.</t>
    </section>

    </section>

    <section title="PreAuthentication Data Types">

        <texttable>
          <preamble>The following are the new PreAuthentication data types:</preamble>

          <ttcol align="center">Padata and Data Type</ttcol>

          <ttcol align="center">Padata-type Value</ttcol>

          <c>PA_AS_FRESHNESS</c>
          <c>150</c>

          <postamble></postamble>
        </texttable>

    </section>

    <section title="Extended PKAuthenticator" anchor="ExtPKAuth">

      <figure>
        <preamble>The PKAuthenticator structure specified in Section 3.2.1 of <xref target="RFC4556"/> is extended to include a new freshnessToken as follows:</preamble>

        <artwork><![CDATA[
PKAuthenticator ::= SEQUENCE {
   cusec        [0] INTEGER (0..999999),
   ctime        [1] KerberosTime,
             -- cusec and ctime are used as in [RFC4120], for
             -- replay prevention.
   nonce        [2] INTEGER (0..4294967295),
             -- Chosen randomly;  this nonce does not need to
             -- match with the nonce in the KDC-REQ-BODY.
   paChecksum   [3] OCTET STRING OPTIONAL,
             -- MUST be present.
             -- Contains the SHA1 checksum, performed over
             -- KDC-REQ-BODY.
   ...,
   freshnessToken     [4] OCTET STRING OPTIONAL,
             -- PA_AS_FRESHNESS padata value as recieved from the 
             -- KDC. MUST be present if sent by KDC
   ...
}

            ]]></artwork>
      </figure>

    </section>




    <section anchor="IANA" title="IANA Considerations">
        <texttable>
          <preamble>IANA has assigned numbers for PA_AS_FRESHNESS listed in a subregistry of the "Kerberos Parameters" registry titled "Pre-authentication and Typed Data" as follows:</preamble>

          <ttcol align="center">Type</ttcol>

          <ttcol align="center">Value</ttcol>

          <ttcol align="center">Reference</ttcol>

          <c>150</c>

          <c>PA_AS_FRESHNESS</c>

          <c>[RFC8070]</c>

          <postamble></postamble>
        </texttable>

    </section>

    <section anchor="Security" title="Security Considerations">
      <t>The freshness token SHOULD include signing, encrypting, or sealing data from the KDC to determine authenticity and prevent tampering.</t>
      <t>Freshness tokens serve to guarantee that the client had the key when constructing the AS-REQ. They are not required to be single use tokens or bound to specific AS exchanges. Part of the reason the token is opaque is to allow KDC implementers the freedom to add additional functionality as long as the tokens expire so that the "freshness" guarantee remains.</t>

    </section>

    <section anchor="InterOp" title="Interoperability Considerations">
      <t>Since the client treats the KDC-provided data blob as opaque, changing the contents will not impact existing clients. Thus, extensions to the freshness token do not impact client interoperability.</t>
      <t>Clients SHOULD NOT reuse freshness tokens across multiple exchanges. There is no guarantee that a KDC will allow a once-valid token to be used again. Thus, clients that do not retry with a new freshness token may not be compatible with KDCs, depending on how they choose to implement freshness validation.</t>
      <t>Since upgrading clients takes time, implementers may consider allowing both freshness-token based exchanges and "legacy" exchanges without use of freshness tokens. However, until freshness tokens are required by the realm, the existing risks of pre-generated PKAuthenticators will remain.</t>

    </section>
  </middle>

  <!--  *****BACK MATTER ***** -->

  <back>

    <references title="Normative References">
      <!--?rfc include="http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml"?-->
      &RFC2119;&RFC4556;&RFC5349;&RFC4120;&RFC6113;

    </references>
    <section anchor="Acknowledgements" title="Acknowledgements" numbered="no">
      <t>Douglas E. Engert, Sam Hartman,  Henry B. Hotz, Nikos Mavrogiannopoulos, Martin Rex, Nico Williams, and Tom Yu were key contributors to the discovery of the freshness issue in PKINIT.</t>
      <t>Sam Hartman, Greg Hudson, Jeffrey Hutzelman, Nathan Ide, Benjamin Kaduk, Bryce Nordgren, Magnus Nystrom, Nico Williams, and Tom Yu reviewed the document and provided suggestions for improvements.</t>
    </section>
  </back>
</rfc>
