<?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-ghedini-dprive-early-data-02" 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="February" day="25"/>

    
    
    

    <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:
H4sIAEktVV4AA41Y7XIbtxX9j6dA6R9OZkROVDu1q5lOy0hy7Im+QtJ1PJmM
B9wFSVS7wAbAimZtPUyfpS/Wcy+wy6USudEfLRdf9+Pccw92PB6LaGKlT+Tb
YOxanitf7eSZikoaK8+u5tLdaS8XF3NRusKqGjNLr1ZxvN7o0lgzLhtv7vRY
08JxiYXjSkUdolDLpdd3J7zJfltRYHTt/O5EhlgKEaKy5QdVOYuddzqIxpzI
n6MrjmRwPnq9Cnja1ekBNtSqaWDpL0KoNm6cPxFyLCT+jA0ncjqR3yfD+F0y
eFrpEHCMdweDzq9P5Gnl2nJVKa+P5BtbTHhE18pUJ1L16/5R9NMmhauFGI/H
Ui1D9KqIQiw2JpBtba1tlKaqWhpBFGTcaOlNuA3SrWTLIUYs5fHkmeSISYqY
3Jq46YMtMOFI4lgZGl2YlcE2S71Rd8Z52lBFWSiLV1KVrom6lMudLCqDo0Na
pj22wVQnvC7bQmORC9mOSbK9NmVZaSGewOnoHWZF46wQnXGfPv0dj8fP/jZ7
dfry+fO/3N/LUq+MhS1K1rrYKGtCfQRLqgoWfDOeLRY4OATsIr0Obd3whs4P
/DxK1mOJ24be5OiwEGZzJPhHMh/4o+itjAeYvGttOY7eNBRIlY7AwYWzVrPt
HETXRkmRQpix01aZKFcwgfYhz2B1GTbqVguMIo9NpaOe5PzloLYB23Y2UU5+
bbWnHODdsB4Qoj+dXS8oQC9efvsSAcqGi84QY4vWe7Ilu1K4EMl8elZlachs
VcmBb17/2hqfUpqNFr3RE9nb2Xh3Z0otg1lbIASvomy0h6+1ski4qWmGrjnA
OL1QyI3cbrTXwurtoSP7GAZpdfIegUANq2VlAioGRkdtZWiLjVSAspW1Wxrg
p8sh78wWWx23zt8C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