<?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 RFC4861 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4861.xml">

<!ENTITY RFC3756 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3756.xml">

<!ENTITY RFC4291 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4291.xml">

<!ENTITY RFC4862 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4862.xml">

<!ENTITY RFC4941 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4941.xml">

<!ENTITY RFC6437 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6437.xml">

<!ENTITY RFC4193 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4193.xml">


<!ENTITY RFC4271 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4271.xml">

<!ENTITY RFC5340 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5340.xml">

<!ENTITY RFC5570 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5570.xml">

<!ENTITY RFC3031 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3031.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 updates="4861" category="std" docName="draft-smith-6man-mitigate-nd-cache-dos-slnd-05" ipr="trust200902">

  <front>

    <title abbrev="Stateless Neighbor Discovery">Mitigating IPv6 Router Neighbor Cache DoS Using Stateless Neighbor Discovery</title>

    <author fullname="Mark Smith" initials="M.R." surname="Smith">
      <organization abbrev="IMOT">In My Own Time</organization>

      <address>
        <postal>
          <street>PO BOX 521</street>

          <city>HEIDELBERG</city>

          <region>VIC</region>

          <code>3084</code>

          <country>AU</country>
        </postal>

        <email>markzzzsmith@yahoo.com.au</email>

      </address>
    </author>

    <date year="2012" />

    <area>General</area>

    <workgroup>Internet Engineering Task Force</workgroup>

    <keyword>ipv6</keyword>
    <keyword>neighbor discovery</keyword>
    <keyword>neighbor cache</keyword>
    <keyword>DoS</keyword>
    <keyword>security</keyword>

    <abstract>
	<t>The IPv6 neighbor discovery cache is vulnerable to a Denial of Service attack that purposely exhausts the state used during the neighbor discovery process. This attack can be very disruptive when the target is a router. This memo proposes a stateless form of neighbor discovery to be used by routers to mitigate this attack. It does not require any changes to hosts.</t>

    </abstract>

  </front>

  <middle>
    <section title="Introduction">

	<t>The IPv6 neighbor discovery cache <xref target="RFC4861" /> is vulnerable to a Denial of Service attack that purposely exhausts the state used during the neighbor discovery process <xref target="RFC3756" />.</t>

	<t>When a router is the target of this attack, an off-link attacker sends traffic towards many non-existent addresses within a prefix attached to the router. This causes the router to create neighbor cache state for neighbor solicitations for these non-existent addresses. The denial of service occurs when the router's neighbor cache state capacity is exhausted due to too many outstanding neighor solicitations.</t>

	<t>Sizing a prefix proportional to the number of attached hosts, rather than using the standard /64 prefix size <xref target="RFC4291" />, would mitigate this attack. However, operational conveniences and benefits such as universal fixed length prefixes and interface identifiers, Stateless Address Autoconfiguration (SLAAC) <xref target="RFC4862" /> and privacy addresses <xref target="RFC4941" />,  and never having to resize the prefix or add secondary prefixes to attach more hosts to the link would be lost.</t>

	<t>This memo proposes a stateless form of neighbor discovery to prevent this type of DoS attack on a router. It does not require any changes to the operation of neighbor discovery on hosts. It takes advantage of hosts' ability to recover from packet loss in the network, necessary due to IPv6's best effort nature. This method would be used when the router's neighbor cache's state capacity reaches a medium to high threshold of use, suggesting a neighbor cache DoS attack is occuring. An optional enhancement is to distinguish packet sources as trusted or untrusted, and to continue to provide trusted packet sources with traditional stateful neighbor discovery.</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="Terminology">

	<t>Stateful Neighbor Discovery (SFND): Traditional neighbor discovery, as specified in <xref target="RFC4861" />. This form of neighbor discovery maintains per packet destination state for all unresolved destinations during the neighbor discovery process. The neighbor cache's state capacity is intentionally exhausted to cause the neighbor cache Denial of Service attack.</t>

	<t>Stateless Neighbor Discovery (SLND): The form of neighbor discovery described in this memo. This form of neighbor discovery does not maintain per packet destination state for unresolved destinations during the neighbor discovery process.</t>

	<t>IGP: Interior Gateway Protocol, such as OSPF <xref target="RFC5340" />.</t>

	<t>EGP: Exterior Gateway Protocol, such as BGP <xref target="RFC4271" />.</t>

    </section>

    <section title="Opportunities for Stateless Neighbor Discovery">

	<t>During traditional stateful neighbor discovery, state is used to perform the following:</t>

	<t>
        <list style="symbols">
		<t>ensure a received neighbor advertisement corresponds to a previously sent neighbor solicitation</t>
		<t>to retransmit a limited number of neighbor solicitations if previous solicitations remain unanswered</t>
		<t>to store a small number of packets that triggered the neighbor discovery process, so that they can be transmitted if neighbor discovery completes successfully</t>
		<t>to generate ICMPv6 destination unreachable, address unreachble messages should neighbor discovery fail</t>
        </list>
	</t>

	<t>Stateless neighbor discovery sacrifices these functions and the related state to mitigate the neighbor cache DoS attack.</t>

    	<section anchor="nd_adv_val" title="Neighbor Advertisement Validation">
	<t>Ensuring received neighbor advertisements correspond to previously sent neighbor solicitations prevents on-link nodes from sending unsolicited neighbor advertisements to the router, and then having them added to the router's neighbor cache without validation. This would allow on-link hosts to perform a neighbor cache DoS attack, as they could send many neighbor advertisements for non-existent addresses within the link assigned prefixes, exhausting the neighbor cache capacity.</t>

	<t>If neighbor advertisement validation occurs, then the router is vulnerable to an off-link sourced neighbor cache DoS attack, but is not vulnerable to an on-link sourced neighbor cache DoS attack. If neighbor advertisement validation does not occur, then the router is vulnerable to an on-link sourced neighbor cache DoS attack, but is now not vulnerable to an off-link sourced neighbor cache DoS attack.</t>
	<t>Considering that on-link nodes will usually have a vested interest in the router continuing to operate, that there will be a much smaller set of on-link sources, and that they'll be far better known and possibly access controlled, the likelihood of an on-link sourced neighbor cache DoS is much lower than an off-link sourced neighbor cache DoS. It is therefore beneficial to sacrifice on-link neighbor cache DoS protection to gain off-link neighbor cache DoS protection. Also note that during the stateless neighbor discovery process proposed in this memo, neighbor advertisement validation is only sacrificed when an off-link sourced neighbor cache DoS appears to be taking place. Under normal circumstances on-link sourced neighbor advertisement validation continues to occur.</t>

    	</section>
    	<section title="Optimisation Functions">

	<t>The nature of IPv6 is best effort, meaning that there is a possibility that packets may be lost as they transit the network, and that IPv6 will not make any attempt to recover lost packets. If an application residing on an IPv6 node requires reliable packet delivery, it will need to utilise locally implemented reliable upper layer protocols such as TCP and SCTP, or implement it's own reliability mechanisms. These reliability mechanisms involve retransmitting packets. Alternatively, the application needs to accept the possibility and consequences of packet loss.</t>

	<t>The remaining uses of stateful neighbor discovery state are not assured of success. The limited number of neighbor solicitation retransmissions may not be enough, causing neighbor discovery to fail even though the target node exists. There may be more packets sent that trigger neighbor discovery than are stored for transmission when neighbor discovery completes successfully, causing them to be dropped. The ICMPv6 destination unreachable message may be dropped on the way back to the traffic originating node, perhaps intentionally by a network located firewall.</t>

	<t>This means that these functions are useful but not essential optimisations. If necessary, they do not need to be performed, as the packet source will retransmit it's packets, reinitiating the neighbor discovery process, or accept that packet loss has occured. This provides the opportunity to perform a stateless form of neighbor discovery if there is evidence that a neighbor cache DoS attack is occuring, mitigating the off-link sourced neighbor cache DoS attack.</t>

    	</section>

    </section>

    <section title="Stateless Neighbor Discovery">

	<section title="SLND Variables">
	<t>To perform stateless neighbor discovery, four variables are maintained:</t>
	<t>SLND Flag - This flag indicates whether or not the interface will perform SLND if necessary. By default, this flag should be set to on.</t>
	<t>SLDN Activate Threshold - This variable specifies the threshold when stateless neighbor discovery is activated. The threshold specifies a neighbor cache utilisation level. It is expressed as a percentage, with a default value of 80%. It may either be a per-interface or router global variable depending on whether the router implementation has per-interface neighbor caches or a global neighbor cache used by all interfaces.</t>
	<t>SLND Active Flag - This flag indicates whether or not the interface is currently performing SLND. It is maintained for each interface on the router.</t>
	<t>SLND Neighbor Solicitation Rate Limit ("SLND NS Rate Limit") - This variable specifies a threshold for multicast Neighbor Solictiations when the interface is performing SLND, specified in packets per second.  It is a per-interface variable, as different interfaces may have different thresholds.  The rate value should be an appropriate portion of the multicast packet per second capabilities of the interface link technology, such as 10%.  A router may maintain a global threshold that is applied to interfaces that do not have an interface specific rate limit.</t>
    	</section>
	<section title="SLND Processing">
	<t>The stateless neighbor discovery process may occur once a router has determined the outgoing interface for a packet, and that the packet's destination is on-link.</t>

	<t>If the packet's destination address is present in the neighbor cache, and the link-layer address has been resolved, the packet is forwarded to it's destination.</t>

	<t>If the packet's destination address is not present in the neighbor cache, and the SLND Flag is off, traditional stateful neighbor discovery is performed for the packet's destination.</t>

	<t>If the SLND Flag is on, and the SLND Active flag is off, traditional stateful neighbor discovery is performed.</t>

	<t>If the SLND Flag is on, and the SLND Active flag is on, stateless neighbor discovery is performed as follows:</t>

	<t>
	<list style="numbers">
		<t>The router determines if sending a multicast neighbor solicitation would exceed the SLND NS Rate Limit for the outgoing interface. If the SLND NS Rate Limit would be exceeded, drop the packet and do not proceed any further.</t>
		<t>A multicast neighbor solicitation is sent by the router for the destination address in the packet. The packet is then dropped.</t>
		<t>As some later point in time, the router is likely to receive a unicast neighbor advertisement, for a previously sent neighbor solicitation.</t>
		<t>If the SLND Active Flag is off, the router ignores the neighbor advertisement.</t>
		<t>If the SLND Active Flag is on, the router creates an entry in it's neighbor cache using the information received in the unicast neighbor advertisement. Stateless neighbor discovery is now complete.</t>
	</list>
	</t>

	<t>The utilisation of the neighbor cache needs to be measured to determine if it crosses the SLDN Activate Threshold. If the utilisation increases above the SLDN Activate Threshold, the SLND Active Flag is switched on, and if it decreases below the SLDN Activate Threshold, the SLND Active Flag is switched off. Neighbor cache utlisation should be measured and compared to the SLDN Activate Threshold when:</t>
	
	<t>
        <list style="symbols">
		<t>entries are added to the neighbor cache, during either stateful or stateless neighbor discovery</t>
		<t>entries are removed from the neighbor cache when Neighbor Unreachability Detection discovers the neighbor has disappeared</t>
        </list>
	</t>

    	</section>

	<section title="Optional Enhancements">
		<section title="Selective Stateless Neighbor Discovery">
		<t>When a neighbor cache DoS attack appears to be occurring, it could be useful to continue to provide traditional stateful neighbor discovery service to hosts that are considered unlikely to initiate or participate in the DoS attack. These hosts could be considered trusted hosts, while the remaining set of hosts are untrusted.</t>
		<t>The determination of whether a host is trusted or untrusted would take place when neighbor discovery is determined to be necessary, during the stateless neighbor discovery process. The determination of trust is made based on attributes of the packets that trigger the neighbor discovery process. If none of the packet attributes indicate either a trusted or untrusted host, then the host is considered to be untrusted.</t>
		<t>There are two basic packet attributes that an enhanced implementation should provide mechanisms to use to classify a packet source as trusted or untrusted:</t>
		<t>
	        <list style="symbols">
			<t>source address</t>
			<t>ingress interface</t>
		</list>
		</t>
		<t>An implementation may be able to reuse its existing packet classification mechanisms to determine trust, such as those used to implement network QoS. This would mean that other packet attributes, such as Traffic Class, Flow Label <xref target="RFC6437" />, the CALIPSO option <xref target="RFC5570" /> or MPLS label values <xref target="RFC3031" />, could also be used to determine packet source trustworthiness.</t>
			<section title="Source Address">
<t>The source address of the packet that has triggered the neighbor discovery process can be used to determine the trust level of the origin host. The information used to classify the source address can come from two possible sources:</t>
	<t>
        <list style="symbols">
		<t>an operator configured prefix list</t>
		<t>the network's routing information</t>
        </list>
	</t>
				<section title="Operator Configured Prefix List">
	<t>An operator configured prefix list consists of a static list of prefixes and their lengths, each with a flag indicating whether traffic with source addresses that falls within the specified prefix is from a trusted or untrusted source.</t>
	<t>How this list is evaluated would be implementation dependent, however it is likely to be either sequential from first to last entry, or using a longest match algorithm.</t>
	<t>This list should have a default entry of the ULA prefix (fc00::/7) <xref target="RFC4193" />, flagged as a trusted source. An implementation must allow this entry to be removed.</t>
    				</section>
				<section title="Routing Information">
	<t>The network's routing information can be used to distinguish trusted and untrusted packet sources. An advantage of using routing information for this purpose is that it will typically be dynamically and automatically distributed to all routers within the network, when dynamic routing protocols are used. This avoids changes to the operator configured prefix list on individual routers when trusted prefixes are added or removed from the network.</t>

	<t>The contents of a stub network's route table is typically all the internal routes for the network, and then a default route used to reach the Internet. The list of internal routes can be used to distinguish between trusted and untrusted sources, with packet sources matching internal routes being trusted, and all other packet sources being untrusted.</t>

	<t>In more complex routing environments, such as those using one or more IGPs and an EGP such as BGP <xref target="RFC4271" />, there may be other methods available to distinguish between trusted and untrusted sources. For example, routes carried in an IGP could be considered trusted, while routes carried in BGP are untrusted. For a network using BGP to carry all reachability information, except network transit and loopback interface routes, internal routes may be tagged with one or more BGP communities to indicate they are also trusted prefixes.</t>

	<t>There may be cases where a subset of the internal routes need to be considered untrusted, despite them being propagated internally via a routing protocol. These routes will likely be for links at the edge of the local network, where untrusted hosts can be attached without local network control or authorisation. These routes need to be labelled as untrusted, and that information propagated to all routers within the local network. Route labelling mechanisms such as OSPF's External Route Tag <xref target="RFC5340" /> or a BGP community could be used for this purpose.</t>

	<t>A default route should never be used as a trusted packet source route. If a router's operator wishes to trust all packet sources, they should specify the prefix that covers all IPv6 addresses, ::/0, as an operator configured trusted prefix. (The ::/0 prefix is only a default route when used as routing information.)</t>

	<t>Implementations should provide simple and convenient methods to use the network's routing information to distinguish between trusted and untrusted packet source prefixes.</t>
    				</section>
    			</section>
			<section title="Ingress Interface">
	<t>A packet's ingress interface on the router could be used to determine whether statelful or stateless neighbor discovery takes place. Interfaces on the router would be labelled as trusted or untrusted.</t>
	<t>The default trust level for interfaces would be up to the router's implenter. Considerations could be the likely deployment scenario for the router implementation (e.g., residential Internet access, or within an enterprise network), and the type of interface (e.g., an interface type that is usually used to attach the router to the Internet, such as an ADSL interface, would be labelled untrusted). These default interface trust assignments should be easy to change.</t>
    			</section>
    		</section>

    	</section>


    </section>

    <section anchor="Acknowledgements" title="Acknowledgements">

    <t>Oliver Ddin provided review and comments, and suggested the use of ingress interface and other more general packet attributes to determine packet source trust.</t>

    <t>Review and comments were provided by Ray Hunter, Matthew Moyle-Croft and  Karl Auer.</t>

    <t>This memo was prepared using the xml2rfc tool.</t>

    </section>

    <section anchor="Security" title="Security Considerations">

	<t>This memo proposes a security mitigation for an off-link sourced neighbor cache Denial of Service attack, aimed at a router.</t>

	<t>As discussed in <xref target="nd_adv_val" />, the method proposed creates an opportunity for an on-link sourced neighbor cache DoS attack, when mitigating the off-link sourced neighbor cache DoS. This is considered to be an acceptable security trade-off.</t>

    </section>

    <section title="Change Log [RFC Editor please remove]">
	
	<t>draft-smith-6man-mitigate-nd-cache-dos-slnd-00, initial version, 2012-09-04</t>

	<t>draft-smith-6man-mitigate-nd-cache-dos-slnd-01, more clarity, 2012-10-13</t>
	<t>
        <list style="symbols">
		<t>more comprehensive introduction (problem definition) text</t>
		<t>make it more obvious that hosts don't need to be changed</t>
		<t>low-end/embedded hosts can consider all packet sources untrusted</t>
		<t>misc. minor text updates </t>
        </list>
	</t>

	<t>draft-smith-6man-mitigate-nd-cache-dos-slnd-05, structual changes, 2012-11-08</t>

	<t>
        <list style="symbols">
		<t>moved opportunities for SLND section to before SLND description</t>
		<t>spit SLND into basic functionality and optional enhancements</t>
		<t>use of ingress interface and other more general packet attributes to determine trust</t>
        </list>
	</t>

    </section>

  </middle>

  <back>

    <references title="Normative References">

      &RFC2119;

    </references>

    <references title="Informative References">

      &RFC4861;

      &RFC3756;

      &RFC4291;

      &RFC4862;

      &RFC4941;

      &RFC6437;

      &RFC4193;

      &RFC4271;

      &RFC5340;

      &RFC5570;

      &RFC3031;

    </references>

  </back>
</rfc>
