<?xml version="1.0" encoding="UTF-8"?>
  <?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
  <!-- generated by https://github.com/cabo/kramdown-rfc2629 version  -->

<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
]>

<?rfc toc="yes"?>
<?rfc sortrefs="yes"?>
<?rfc symrefs="yes"?>
<?rfc docmapping="yes"?>

<rfc docName="draft-ietf-dprive-early-data-00" category="std">

  <front>
    <title abbrev="DNS Early Data">Using Early Data in DNS over TLS</title>

    <author initials="A." surname="Ghedini" fullname="Alessandro Ghedini">
      <organization>Cloudflare, Inc.</organization>
      <address>
        <email>alessandro@cloudflare.com</email>
      </address>
    </author>

    <date year="2020" month="April" day="22"/>

    
    <workgroup>DPRIVE</workgroup>
    

    <abstract>


<t>This document illustrates the risks of using TLS 1.3 early data with DNS over
TLS, and specifies behaviors that can be adopted by clients and servers to
reduce those risks.</t>



    </abstract>


  </front>

  <middle>


<section anchor="introduction" title="Introduction">

<t>TLS 1.3 <xref target="TLS13"/> defines a mechanism, called 0-RTT session resumption
or early data, that allows clients to send data to servers in the first
round-trip of a resumed connection without having to wait for the TLS handshake
to complete.</t>

<t>This can be used to send DNS queries to DNS over TLS <xref target="DOT"/> servers
without incurring in the cost of the additional round-trip required by the TLS
handshake. This can provide significant performance improvements in cases where
new DNS over TLS connections need to be established often such as on mobile
clients where the network might not be stable, or on resolvers where keeping an
open connection to many authoritative servers might not be practical.</t>

<t>However the use of early data allows an attacker to capture and replay the
encrypted DNS queries carried on the TLS connection. This can have unwanted
consequences and help in recovering information about those queries. While
<xref target="TLS13"/> describes tecniques to reduce the likelihood of a replay attack,
they are not perfect and still leave some potential for exploitation.</t>

</section>
<section anchor="notational-conventions" title="Notational Conventions">

<t>The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”,
“SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this
document are to be interpreted as described in BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/>
when, and only when, they appear in all capitals, as shown here.</t>

</section>
<section anchor="early-data-in-dns-over-tls" title="Early Data in DNS over TLS">

<t>Early data forms a single stream of data along with other application data,
meaning that one or more DNS queries can either be partially or fully contained
within early data. Once the TLS handshake has completed, the early data is known
to not be a replayed copy of that data, but this doesn’t mean that it can’t be
replayed, or that it hasn’t already been replayed, in another connection.</t>

<t>A server can signal to clients whether it is willing to accept early data in
future connections by providing the “early_data” TLS extension as part of a TLS
session ticket, as well as limit the amount of early data it is willing to
accept using the “max_early_data_size” field of the “early_data” extension.</t>

<t>In addition to the mitigation mechanisms mandated in <xref target="TLS13"/> that reduce the
ability of an attacker to replay early data, but may not completely eliminate
it, a server that decided to offer early data to clients MAY reject early data
at the TLS layer, or delay the processing of early data after the handshake is
completed.</t>

<t>If the server rejects early data at the TLS layer, a client MUST forget
information it optmisitically assumed about the onnection when sending early
data, such as the negotiated protocol <xref target="ALPN"/>. Any DNS queries sent
in early data will need to be sent again, unless the client decides to abandon
them.</t>

<t>Not all types of DNS messages are safe to be sent as early data, as they might
modfify the server’s state, or expose sensitive data, through replay. Clients
MUST NOT use early data to send messages that make use of opcodes other than
“Query” and RR types not listed in the registry defined in <xref target="registry"/>. Servers
receiving any of those messages MUST reply with a “FormErr” response code.</t>

</section>
<section anchor="security-considerations" title="Security Considerations">

<section anchor="information-exposure" title="Information Exposure">

<t>By replaying DNS queries that were captured when transmitted over early data,
an attacker might be able to expose information about those queries, even if
encrypted.</t>

<t>For example, it’s a common behavior for DNS servers to statefully rotate the
order of RRs when replying to DNS queries for an RRSet that contains multiple
RRs. If the order of rotation is predictable, replaying a captured early data
DNS query and observing the order of RRs in DNS responses before and after the
replayed query, might allow the attacker to confirm whether the query targeted
a specific name that was suspected of being queried.</t>

<t>When accepting early data, servers SHOULD either use fixed ordering for multiple
RRs in the same DNS response or shuffle the RRs at random, but MUST NOT use
stateful and deterministic ordering across multiple queries.</t>

</section>
<section anchor="denial-of-service" title="Denial of Service">

<t>Accepting early data exposes a server to potential denial of service through
the replay of queries that might be expensive to handle.</t>

<t>When under load, a server MAY reject TLS early data such that the client is
forced to retry them after the handshake is completed.</t>

</section>
</section>
<section anchor="iana-considerations" title="IANA Considerations">

<t>This document has no actions for IANA.</t>

<section anchor="registry" title="Registry for DNS Resource Record (RR) TYPEs for TLS Early Data">

<t>This document establishes a registry of DNS RR types that can be used within
TLS early data, titled “DNS Resource Record (RR) TYPEs for Use with TLS Early
Data”, under the existing “Domain Name System (DNS) Parameters” heading.</t>

<t>The entries in the registry are:</t>

<texttable>
      <ttcol align='left'>TYPE</ttcol>
      <ttcol align='left'>Reference</ttcol>
      <c>A</c>
      <c>[this document]</c>
      <c>NS</c>
      <c>[this document]</c>
      <c>CNAME</c>
      <c>[this document]</c>
      <c>SOA</c>
      <c>[this document]</c>
      <c>PTR</c>
      <c>[this document]</c>
      <c>MX</c>
      <c>[this document]</c>
      <c>TXT</c>
      <c>[this document]</c>
      <c>AAAA</c>
      <c>[this document]</c>
      <c>SRV</c>
      <c>[this document]</c>
      <c>DNAME</c>
      <c>[this document]</c>
      <c>DS</c>
      <c>[this document]</c>
      <c>DNSKEY</c>
      <c>[this document]</c>
</texttable>

<t>The values in this registry MUST correspond to existing entries in the
“Resource Record (RR) TYPEs” registry. Specifically, the value of the “TYPE”
column for each entry in this new registry MUST match the value of the “TYPE”
column of an entry in the “Resource Record (RR) TYPEs” registry.</t>

</section>
</section>


  </middle>

  <back>

    <references title='Normative References'>





<reference  anchor="TLS13" target='https://www.rfc-editor.org/info/rfc8446'>
<front>
<title>The Transport Layer Security (TLS) Protocol Version 1.3</title>
<author initials='E.' surname='Rescorla' fullname='E. Rescorla'><organization /></author>
<date year='2018' month='August' />
<abstract><t>This document specifies version 1.3 of the Transport Layer Security (TLS) protocol.  TLS allows client/server applications to communicate over the Internet in a way that is designed to prevent eavesdropping, tampering, and message forgery.</t><t>This document updates RFCs 5705 and 6066, and obsoletes RFCs 5077, 5246, and 6961.  This document also specifies new requirements for TLS 1.2 implementations.</t></abstract>
</front>
<seriesInfo name='RFC' value='8446'/>
<seriesInfo name='DOI' value='10.17487/RFC8446'/>
</reference>



<reference  anchor="DOT" target='https://www.rfc-editor.org/info/rfc7858'>
<front>
<title>Specification for DNS over Transport Layer Security (TLS)</title>
<author initials='Z.' surname='Hu' fullname='Z. Hu'><organization /></author>
<author initials='L.' surname='Zhu' fullname='L. Zhu'><organization /></author>
<author initials='J.' surname='Heidemann' fullname='J. Heidemann'><organization /></author>
<author initials='A.' surname='Mankin' fullname='A. Mankin'><organization /></author>
<author initials='D.' surname='Wessels' fullname='D. Wessels'><organization /></author>
<author initials='P.' surname='Hoffman' fullname='P. Hoffman'><organization /></author>
<date year='2016' month='May' />
<abstract><t>This document describes the use of Transport Layer Security (TLS) to provide privacy for DNS.  Encryption provided by TLS eliminates opportunities for eavesdropping and on-path tampering with DNS queries in the network, such as discussed in RFC 7626.  In addition, this document specifies two usage profiles for DNS over TLS and provides advice on performance considerations to minimize overhead from using TCP and TLS with DNS.</t><t>This document focuses on securing stub-to-recursive traffic, as per the charter of the DPRIVE Working Group.  It does not prevent future applications of the protocol to recursive-to-authoritative traffic.</t></abstract>
</front>
<seriesInfo name='RFC' value='7858'/>
<seriesInfo name='DOI' value='10.17487/RFC7858'/>
</reference>



<reference  anchor="RFC2119" target='https://www.rfc-editor.org/info/rfc2119'>
<front>
<title>Key words for use in RFCs to Indicate Requirement Levels</title>
<author initials='S.' surname='Bradner' fullname='S. Bradner'><organization /></author>
<date year='1997' month='March' />
<abstract><t>In many standards track documents several words are used to signify the requirements in the specification.  These words are often capitalized. This document defines these words as they should be interpreted in IETF documents.  This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t></abstract>
</front>
<seriesInfo name='BCP' value='14'/>
<seriesInfo name='RFC' value='2119'/>
<seriesInfo name='DOI' value='10.17487/RFC2119'/>
</reference>



<reference  anchor="RFC8174" target='https://www.rfc-editor.org/info/rfc8174'>
<front>
<title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
<author initials='B.' surname='Leiba' fullname='B. Leiba'><organization /></author>
<date year='2017' month='May' />
<abstract><t>RFC 2119 specifies common key words that may be used in protocol  specifications.  This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the  defined special meanings.</t></abstract>
</front>
<seriesInfo name='BCP' value='14'/>
<seriesInfo name='RFC' value='8174'/>
<seriesInfo name='DOI' value='10.17487/RFC8174'/>
</reference>




    </references>

    <references title='Informative References'>





<reference  anchor="ALPN" target='https://www.rfc-editor.org/info/rfc7301'>
<front>
<title>Transport Layer Security (TLS) Application-Layer Protocol Negotiation Extension</title>
<author initials='S.' surname='Friedl' fullname='S. Friedl'><organization /></author>
<author initials='A.' surname='Popov' fullname='A. Popov'><organization /></author>
<author initials='A.' surname='Langley' fullname='A. Langley'><organization /></author>
<author initials='E.' surname='Stephan' fullname='E. Stephan'><organization /></author>
<date year='2014' month='July' />
<abstract><t>This document describes a Transport Layer Security (TLS) extension for application-layer protocol negotiation within the TLS handshake. For instances in which multiple application protocols are supported on the same TCP or UDP port, this extension allows the application layer to negotiate which protocol will be used within the TLS connection.</t></abstract>
</front>
<seriesInfo name='RFC' value='7301'/>
<seriesInfo name='DOI' value='10.17487/RFC7301'/>
</reference>



<reference  anchor="RFC8470" target='https://www.rfc-editor.org/info/rfc8470'>
<front>
<title>Using Early Data in HTTP</title>
<author initials='M.' surname='Thomson' fullname='M. Thomson'><organization /></author>
<author initials='M.' surname='Nottingham' fullname='M. Nottingham'><organization /></author>
<author initials='W.' surname='Tarreau' fullname='W. Tarreau'><organization /></author>
<date year='2018' month='September' />
<abstract><t>Using TLS early data creates an exposure to the possibility of a replay attack.  This document defines mechanisms that allow clients to communicate with servers about HTTP requests that are sent in early data.  Techniques are described that use these mechanisms to mitigate the risk of replay.</t></abstract>
</front>
<seriesInfo name='RFC' value='8470'/>
<seriesInfo name='DOI' value='10.17487/RFC8470'/>
</reference>




    </references>


<section anchor="acknowledgments" title="Acknowledgments">

<t>Thanks to Martin Thomson, Mark Nottingham and Willy Tarreau for writing
<xref target="RFC8470"/> which heavily inspired this document, and to Daniel Kahn Gillmor
and Colm MacCárthaigh who also provided important ideas and contributions.</t>

</section>


  </back>

<!-- ##markdown-source:
H4sIAABHoF4AA41Y7XIbtxX9j6dA6R9OZkROVLu1q5lOy0hy7Im+QtJxPJmM
B9wFSVS7wAbAimZtPUyfpS/Wcy+wy6USudEfLRdf9+Pccw92PB6LaGKlT+Tb
YOxanitf7eSZikoaK8+u5tLdaS8XF3NRusKqGjNLr1ZxbHRcjcvGmzs91rRq
XGLVuFJRhyjUcun13QnvsN9TFBhdO787kSGWYuv87dq7tsG8m9mbH8+FCFHZ
8oOqnMVBOx1EY07kz9EVRzI4H71eBTzt6vQAk2rVNDD8FyFUGzfOnwg5FhJ/
xoYTOZ3I7za6NNbwu2T/tNIh4BjvDgadX5/I08q15apSXh/JN7aY8IiulalO
pOrX/bPop00KVwsxHo+lWoboVRGFWGxMINvaWtsoTVW1NIK4yLjR0ptwG6Rb
yZYjjtDK48kzyTGUFEO5NXHTx15gwpHEsTI0ujArg22WeqPujPO0oYqyUBav
pCpdE3UplztZVAZHh7RMe2yDqU54XbaFxiIXsh2TZHttyrLSQjyB09E7zIrG
WSE64z59+gcej5/9ffbq9OXz53+9v5elXhkLW5SsdbFR1oT6CJZUFSz4Zjxb
LHBwCNhFeh3auuENnR/4eZSsxxK3Db3J0WEhzOZI8I9kPuBI0VsZD3gBNLYc
R28aCqRKR+Dgwlmr2XYOomujpEghzNhpq0yUK5hA+5BnsLoMG3WrBUaRx6bS
UU9y/nJQ24BtO5soJ7+22lMO8G5YHgjRn86uFxSgFy//8hIByoaLzhBji9Z7
siW7UrgQyXx6VmVpyGxVyYFvXv/aGp9Smo0WvdET2dvZeHdnSi2DWVsgBK+i
bLSHr7WySLipaYauOcA4vVDIjdxutNfC6u2hI/sYBml18h6BQFWrZWUCKgZG
R21laIuNVICylbV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