<?xml version="1.0" encoding="US-ASCII"?>
<!-- This template is for creating an Internet Draft using xml2rfc,
     which is available here: http://xml.resource.org. -->
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!-- One method to get references from the online citation libraries.
     There has to be one entity for each item to be referenced. 
     An alternate method (rfc include) is described in the references. -->
<!ENTITY RFC5905 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5905.xml">
<!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC2434 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2434.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">
]>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<!-- used by XSLT processors -->
<!-- For a complete list and description of processing instructions (PIs), 
     please see http://xml.resource.org/authoring/README.html. -->
<!-- Below are generally applicable Processing Instructions (PIs) that most I-Ds might want to use.
     (Here they are set differently than their defaults in xml2rfc v1.32) -->
<?rfc strict="yes" ?>
<!-- give errors regarding ID-nits and DTD validation -->
<!-- control the table of contents (ToC) -->
<?rfc toc="yes"?>
<!-- generate a ToC -->
<?rfc tocdepth="4"?>
<!-- the number of levels of subsections in ToC. default: 3 -->
<!-- control references -->
<?rfc symrefs="yes"?>
<!-- use symbolic references tags, i.e, [RFC2119] instead of [1] -->
<?rfc sortrefs="yes" ?>
<!-- sort the reference entries alphabetically -->
<!-- control vertical white space 
     (using these PIs as follows is recommended by the RFC Editor) -->
<?rfc compact="yes" ?>
<!-- do not start each main section on a new page -->
<?rfc subcompact="no" ?>
<!-- keep one blank line between list items -->
<!-- end of list of popular I-D processing instructions -->
<rfc category="std" docName="draft-stenn-ntp-not-you-refid-00" ipr="trust200902">
  <!-- category values: std, bcp, info, exp, and historic
     ipr values: full3667, noModification3667, noDerivatives3667
     you can add the attributes updates="NNNN" and obsoletes="NNNN" 
     they will automatically be output with "(if approved)" -->

  <!-- ***** FRONT MATTER ***** -->

  <front>
    <!-- The abbreviated title is used in the page header - it is only necessary if the 
         full title is longer than 39 characters -->

    <title abbrev="Network Time Protocol Not You REFID">Network Time
    Protocol Not You REFID</title>

    <!-- add 'role="editor"' below for the editors if appropriate -->

    <!-- Another author who claims to be an editor -->

    <author fullname="Sharon Goldberg" initials="S." surname="Goldberg">
      <organization>Boston University</organization>

      <address>
        <postal>
          <street>111 Cummington St</street>

          <!-- Reorder these if your country does things differently -->

          <city>Boston, MA</city>

          <region/>

          <code>02215</code>

          <country>US</country>
        </postal>

        <phone/>

        <email>goldbe@cs.bu.edu</email>

        <!-- uri and facsimile elements may also be added -->
      </address>
    </author>

    <author fullname="Harlan Stenn" initials="H." surname="Stenn">
      <organization>Network Time Foundation</organization>

      <address>
        <postal>
          <street>P.O. Box 918</street>

          <!-- Reorder these if your country does things differently -->

          <city>Talent, OR</city>

          <region/>

          <code>97540</code>

          <country>US</country>
        </postal>

        <phone/>

        <email>stenn@nwtime.org</email>

        <!-- uri and facsimile elements may also be added -->
      </address>
    </author>

<!-- other authors -->

    <date year="2016"/>

    <!-- If the month and year are both specified and are the current ones,
         xml2rfc will fill in the current day for you. If only the current
         year is specified, xml2rfc will fill in the current day and month
         for you. If the year is not the current one, it is necessary to
         specify at least a month (xml2rfc assumes day="1" if not specified
         for the purpose of calculating the expiry date).  With drafts it is
         normally sufficient to specify just the year. -->

    <!-- Meta-data Declarations -->

    <area>General</area>

    <workgroup>Internet Engineering Task Force</workgroup>

    <!-- WG name at the upperleft corner of the doc,
         IETF is fine for individual submissions.  
	 If this element is not present, the default is "Network Working
         Group", which is used by the RFC Editor as a nod to the history of
         the IETF. -->

    <keyword>NTP</keyword>

    <!-- Keywords will be incorporated into HTML output
         files in a meta tag but they have no effect on text or nroff
         output. If you submit your draft to the RFC Editor, the
         keywords will be used for the search engine. -->

    <abstract>
      <t>NTP has been widely used through several revisions, with the latest
      being <xref target="RFC5905">RFC 5905</xref>.  A core component of the
      protocol and the algoritms is the Reference ID, or REFID, which is
      used to identify the source of time used for synchronization (aka the
      "system peer").  Traditionally, when the source of time was another
      system, the REFID was the IPv4 address of that other system.  The
      purpose of the REFID is to prevent a one-degree "timing loop": where
      if A has several timing sources that include B, if B decides to get
      its time from A, then A should not then decide to get its time from B.
      The REFID is therefore a vital core-component of the base NTP packet.
      If a system's REFID is the IPv4 address of its time source, then with
      a simple query a remote attacker can learn the target's REFID.  The
      remote attacker can then try to use that information to send spoofed
      NTP packets to the target or the target's time source, attempting to
      cause a disruption in time service <xref target="NDSS16"></xref>.
      Since the core purpose of the REFID is to prevent a one-degree timing
      loop, this proposal is a backward-compatible way to limit the amount
      of information that is leaked in the REFID. Specifically, it allows
      the prevention of one-degree timing loops by allowing a system A to
      reveal to a querying system B that B is not A's time source, but
      without revealing the actual time source to which A is
      synchronized.</t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">
      <t>NTP has been widely used through several revisions, with the latest
      being <xref target="RFC5905">RFC 5905</xref>.  A core component of the
      protocol and the algoritms is the Reference ID, or REFID, which is
      used to identify the source of time used for synchronization.
      Traditionally, when the source of time was another system, the REFID
      was the IPv4 address of that other system.  If the source of time was
      using IPv6 for its connection, then a 4 octet digest value of the IPv6
      address was used as the REFID. The purpose of the REFID is to prevent
      a one-degree timing loop, where if A has several timing sources that
      include B, if B decides to get its time from A, then A should not then
      decide to get its time from B.</t>

      <t>Recently it was observed in <xref target="NDSS16"></xref> that a
      remote attacker can query a target system to learn its time source
      from the REFID included in target's response packet.  The remote
      attacker can then use this information to send spoofed packets to the
      target or its time source, in an attempt to disrupt time service.  The
      REFID thus unnecessarily leaks information about a target's time
      server to remote attackers.  The best way to mitigate this
      vulnerability is to decouple the IP address of the time source from
      the REFID.  To do this, a system can use an otherwise-impossible value
      for its REFID, called the "not-you" value, when it believes that a
      querying system is not its time source.</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="The REFID">
      <t>The interpretation of a REFID is based on the stratum, as
      documented in <xref target="RFC5905">RFC 5905</xref>, section 7.3,
      "Packet Header Variables". The core reason for the REFID in the NTP
      Protocol is to prevent a degree-one timing loop, where server B
      decides to follow A as its time source, and A then decides to follow B
      as its time source.</t>
      
      <t>At Stratum 2+, which will be the case if two servers A and B are
      exchanging timing information, then if server B follows A as its time
      source, A's address will be B's REFID.  When A uses IPv4, the default
      REFID is A's IPv4 address.  When A uses IPv6, the default REFID is a
      four-octet digest of A's IPv6 address.  Now, if A queries B for its
      time, then A will learn that B is using A as its time source by
      observing A's address in the REFID field of the response packet sent
      by B.  Thus, A will not select B as a potential time source, since
      this would cause a timing loop.</t>
      
      <t>However, this mechanism also allows a third-party C to learn that A
      is the time source that is being used by B.  When A is using IPv4, C
      can learn this by querying B for its time, and observing that the
      REFID in B's response is the IPv4 address of A.  Meanwhile, when A is
      using IPv6, then C can again query B for its time, and then can use an
      offline dictionary attack to determine the IPv6 address that
      corresponds to the digest value in the response sent by B. C could
      construct the necessary dictionary by compiling a list of publically
      accessible IPv6 servers.  Remote attackers can use this technique to
      identify the time sources used by a target, and then send spoofed
      packets to the target or its time source in order to disrupt time
      service as was done e.g., in <xref target="NDSS16"></xref>
      or <xref target="CVE-2015-8138"></xref>.</t>
    </section>

    <section title="The Not-You REFID">
      <t>This proposal allows the one-degree loop detection to work while
      keeping potentially abusable information from being disclosed to
      uninterested parties.  It does this by returning the normal REFID to
      queries that come from an address that the current system believes is
      its time source (aka its "system peer"), and otherwise returning a
      special IP address that is interpreted to mean "not you".  The "not
      you" IP address is 127.127.127.127 when the query is made from an IPv4
      address, or when the query is made from an IPv6 address whose
      four-octect hash does not equal 127.127.127.127. The "not you" IP
      address is 127.127.127.128 when the query is made from an address
      whose four-octect hash equals to 127.127.127.127.</t>

      <t>Note that this mechanism is transparent to the party that sends
      timing queries.  A querying system that uses IPv4 continues to check
      that its IPv4 address does not appear in the REFID before deciding
      whether to take time from the current system.  A querying system that
      uses IPv6 continues to check that the four-octet hash of its IPv6
      address does not appear in the REFID before deciding whether to take
      time from the current system.</t>

      <t>This proposal will hide the current system's system peer from
      querying systems that the current system believes are not the current
      system's system peer.  Note well, however, that the current system
      will return the "not you" value to a query from its system peer if the
      system peer sends its query from an unexpected IP address.</t>
    </section>

    <!-- Possibly a 'Contributors' section ... -->

<!--
    <section anchor="IANA" title="IANA Considerations">
      <t>This memo requests IANA to allocate NTP Extension Field Types
      0x0006 (Suggested REFID, MAC required), 0x2006 (Suggested REFID, MAC
      OPTIONAL) for this purpose.</t>
    </section>
-->

    <section anchor="Security" title="Security Considerations">
      <t>Many systems running NTP are configured to return responses to
      timing queries by default. These responses contain a REFID field,
      which generally reveals the address of the system's time source.  This
      behavior can be exploited by remote attackers who wish to first learn
      the address of a target's time source, and then attack the target
      and/or its time source.  As such, this proposal is designed to harden
      NTP against these attacks by limiting the amount of information leaked
      in the REFID field.</t>
    </section>

    <section anchor="Acknowledgements" title="Acknowledgements">
      <t>The authors wish to acknowledge useful discussions with Aanchal
      Malhotra and Matthew Van Gundy.</t>
    </section>

  </middle>

  <!--  *****BACK MATTER ***** -->

  <back>
    <!-- References split into informative and normative -->

    <!-- There are 2 ways to insert reference entries from the citation libraries:
     1. define an ENTITY at the top, and use "ampersand character"RFC2629; here (as shown)
     2. simply use a PI "less than character"?rfc include="reference.RFC.2119.xml"?> here
        (for I-Ds: include="reference.I-D.narten-iana-considerations-rfc2434bis.xml")

     Both are cited textually in the same manner: by using xref elements.
     If you use the PI option, xml2rfc will, by default, try to find included files in the same
     directory as the including file. You can also define the XML_LIBRARY environment variable
     with a value containing a set of directories to search.  These can be either in the local
     filing system or remote ones accessed by http (http://domain/dir/... ).-->

    <references title="Normative References">
      <!--?rfc include="http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml"?-->

      &RFC2119;

      <!--?rfc include="http://xml.resource.org/public/rfc/bibxml/reference.RFC.5905.xml"?-->

      &RFC5905;

    </references>

    <!-- Here we use entities that we defined at the beginning. -->

    <references title="Informative References">
      <!--&RFC3552;-->

      <reference anchor="NDSS16">
            <front>
                <title>Attacking the Network Time Protocol</title> 
                <author initials="A." surname="Malhotra"><organization /></author>
                <author initials="I." surname="Cohen"><organization /></author>
                <author initials="E." surname="Brakke"><organization /></author>
                <author initials="S." surname="Goldberg"><organization /></author>
                <date year="2016" />
            </front>
            <seriesInfo name="in" value="ISOC Network and Distributed System Security Symposium 2016 (NDSS'16)" />
        </reference>
        
        
      <reference anchor="CVE-2015-8138">
            <front>
                <title>Network Time Protocol Origin Timestamp Check Impersonation Vulnerability (CVE-2015-8138)</title> 
                <author initials="M." surname="Van Gundy"><organization /></author>
                <author initials="J." surname="Gardner"><organization /></author>
                <date year="2016" />
            </front>
            <seriesInfo name="in" value="TALOS VULNERABILITY REPORT (TALOS-2016-0077)" /> 
        </reference>
 
    </references> 

    <!--
    <section anchor="app-additional" title="Additional Stuff">
      <t>This becomes an Appendix.</t>
    </section>
-->

    <!-- Change Log

v00 2016-04-NN  HMS Initial Submission   
                                                                                        -->
  </back>
</rfc>
