<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [

<!ENTITY RFC2460 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2460.xml">

<!ENTITY RFC5095 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5095.xml">

<!ENTITY RFC3704 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3704.xml">

<!ENTITY RFC4443 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4443.xml">

<!ENTITY RFC4302 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4302.xml">

<!ENTITY RFC8200 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8200.xml">

<!ENTITY RFC0791 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.0791.xml">

<!ENTITY RFC8754 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8754.xml">

<!ENTITY RFC8660 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8660.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="5095,8200" category="std" docName="draft-smith-6man-more-secure-rh-02" ipr="trust200902">

  <front>

    <title>More Secure IPv6 Routing Header Processing</title>

    <author fullname="Mark Smith" initials="M.R." surname="Smith">

      <address>
        <postal>
          <street>PO BOX 521</street>

          <city>HEIDELBERG</city>

          <region>VIC</region>

          <code>3084</code>

          <country>AU</country>
        </postal>

        <email>markzzzsmith@gmail.com</email>

      </address>
    </author>

    <date year="2022" />

    <area>General</area>

    <workgroup>Internet Engineering Task Force</workgroup>

    <keyword>ipv6</keyword>
    <keyword>router</keyword>
    <keyword>routing header</keyword>
    <keyword>rh</keyword>


    <abstract>
	<t>The original IPv6 Type 0 Routing Header has been deprecated due to the security risk of a packet forwarding loop being formed, by specifying a large sequence of alternating IPv6 node addresses to visit. This memo proposes a method to prevent these forwarding loops forming, allowing the IPv6 Type 0 Routing Header to be more securely and more safely used. The method may also be applicable to other unicast source routing scenarios.</t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">

	    <t><xref target="RFC5095" /> deprecated the IPv6 Type 0 Routing Header as it could be used to create a traffic loop, by specifying a large sequence of alternating IPv6 node addresses to visit. This traffic loop could consume large amounts of network capacity, causing congestion, and possibly a network capacity denial of service attack. (The packets caught in the forwarding loop would eventually be dropped as their hop-count field will eventually reach zero.)</t>

	    <t>This memo specifies a method of preventing these traffic loops occurring, which allows the IPv6 Type 0 to be more securely and more safely used. This method may also be applicable to other unicast source routing scenarios.</t>

    </section>

    <section title="The Fundamental Problem">

	    <t>The fundamental problem with the type 0 RH, and other source Routing Headers that support multiple routing hops in general, is that packets can be made to travel back towards where they've come from. This then facilitates the first step of a packet being able to enter a forwarding loop.</t>

    </section>

    <section title="Solution">

	<t>Packets need to be prevented from travelling back towards where they've come from, which then prevents a forwarding loop from being formed.</t>

	<t>The problem of packets going back towards where they've come from exists in multicast, and has been solved by performing a Reverse Path Forwarding (RPF) check on a packet as part of the multicast forwarding procedure.</t>

	<t>This RPF check ensures that a packet does not leave via the router in direction back towards the packet's source address. This direction back towards the packet's source may be via the packet's ingress interface, or a different egress interface back towards the packet's source in an asymmetric routing scenario.</t>

	<t>This memo specifies that a Reverse Path Forwarding Check is peformed when processing the IPv6 Type 0 Routing Header to prevent the packet going back towards its source.</t>

	<t><xref target="RFC3704" />, although describing RPF checks to prevent source IP address spoofing, provides good descriptions of the RPF checking process.</t>

    </section>

    <section title="Method">

	<t>The following method is used to process IPv6 Type 0 Routing Headers while also preventing their packets from entering a forwarding loop.</t>

	<t>
	<list style="numbers">
		<t>Perform the Type 0 Routing Header processing algorithm as specified in <xref target="RFC2460" />, section 4.4. This will result in the packet's Type 0 Routing Header and Destination Address being updated to the next address specified in the routing header to visit.</t>
		<t>Perform an RPF check against the updated packet.</t>
		<t>If the packet is to now travel back towards its source, discard the packet, and generate an ICMPv6 Destination Unreachable, Routing Header RPF Check Failed error (specified below), sending it to the packet's source (address).</t>
		<t>Otherwise, forward the packet to its new Destination Address.</t>
	</list>
	</t>

	<t>Note that an implementation could perform the RPF check against the next address specified in the Type 0 Routing Header before updating the packet's Type 0 Routing Header and Destination Address field as a processing optimisation. If the RPF check fails in this case, the packet's Type 0 Routing Header and Destination Address will need to be updated so that it can then be correctly used as the message body for the ICMPv6 Destination Unreachable error message <xref target="RFC4443" />.</t>

    </section>

    <section title="ICMPv6 Destination Unreachable, Routing Header RPF Check Failed">
	    <t>A new ICMPv6 Destination Unreachable error message is defined for a "Routing Header RPF Check Failed", Type 1, Code [IANA-TBD]. Processing of this error message is as per the general Destination Unreachable message processing specified in <xref target="RFC4443" />. There is no special handling of this error message at the receiver.</t>

    </section>

    <section title="Updates to RFC8200">

	    <t>This memo makes the reason for the IPv6 Type 0 Routing Header deprecation invalid. Consequently, <xref target="RFC8200" /> is updated to now specify the Type 0 Routing Header formerly specified in <xref target="RFC2460" />.</t>

    </section>

    <section title="More General Applicability">

	<t>The method of preventing a packet or a frame from travelling back towards its origin when being forwarded can be applied to any unicast source routing scenario where a forwarding loop is possible.</t>

	<t>Examples of where it could be applied are the IPv6 Segment Routing Header <xref target="RFC8754" />, Segment Routing over MPLS <xref target="RFC8660" />, the IPv6 Compressed Rouing Header <xref target="CRH" /> and IPv4 <xref target="RFC0791" />.</t>

    </section>

    <section title="Inspiration">

	<t>The idea of using an RPF check to prevent forwarding loops when performing unicast source routing was inspired by using an RPF check to prevent forwarding loops in hop-by-hop forwarding through the network using an anycast IPv6 address <xref target="FFANYCAST" />. In this scenario, a packet is forwarded towards the next closest instance of the anycast address in the network, excluding anycast address instances that are back towards the packet's source.</t>

    </section>

    <section anchor="Security" title="Security Considerations">

	    <t>This memo addresses the primary security issue that caused the Type 0 Routing Header to be deprecated.</t>

	    <t>This memo does not address other security issues related to routing headers and source routing, such as using a routing header to bypass a security policy enforcement device, or untrusted packets with routing headers entering a routing header trusting domain. Other mitigations to these security issues, such as source address filtering at ingress to the local network, or packet authentication <xref target="RFC4302" />, need to be deployed.</t>

    </section>

    <section anchor="iana" title="IANA Considerations">

	<t>IANA are requested to allocate a suitable Type 1 Destination Unreachable error code for "Routing Header RPF Check Failed".</t>

    </section>

    <section anchor="acknowledgements" title="Acknowledgements">

	<t>Review and comments were provided by YOUR NAME HERE!</t>


	<t>This memo was prepared using the xml2rfc tool.</t>

    </section>

    <section title="Change Log [RFC Editor please remove]">
	
	<t>draft-smith-6man-more-secure-rh-00, initial version, 2022-02-14</t>

	<t>draft-smith-6man-more-secure-rh-01, 2022-02-17</t>
	<t>
	<list style="symbols">
		<t>IEEE 802.2 Source Route Bridging does a check for a forwarding loop when forwarding.</t>
		<t>Better wording and minor corrections.</t>
	</list>
	</t>

	<t>draft-smith-6man-more-secure-rh-02, 2022-02-24</t>
	<t>
	<list style="symbols">
		<t>Hop-by-hop anycast inspiration</t>
	</list>
	</t>

    </section>

  </middle>

  <back>

    <references title="Normative References">

	   &RFC2460;

	   &RFC4443;

	   &RFC8200;

    </references>

    <references title="Informative References">

	   &RFC5095;

	   &RFC3704;

	   &RFC4302;

	   &RFC0791;

	   &RFC8754;

	   &RFC8660;

	   <reference anchor="CRH" target="https://datatracker.ietf.org/doc/draft-bonica-6man-comp-rtg-hdr/">
        <front>
            <title>The IPv6 Compact Routing Header (CRH)</title>
            <author/>
            <date/>
        </front>
	   </reference>

	<reference anchor="FFANYCAST" target=">https://datatracker.ietf.org/doc/draft-smith-6man-form-func-anycast-addresses/">
        <front>
            <title>IPv6 Formal Anycast Addresses and Functional Anycast Addresses</title>
            <author/>
            <date/>
        </front>

	   </reference>

    </references>

  </back>
</rfc>
